Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What will ProxySQL do when disable multiplexing #867

Closed
jkklee opened this issue Jan 6, 2017 · 7 comments
Closed

What will ProxySQL do when disable multiplexing #867

jkklee opened this issue Jan 6, 2017 · 7 comments

Comments

@jkklee
Copy link

jkklee commented Jan 6, 2017

I mean, if we use select @xxx or prepare statement using TEXT protocol, Proxysql will disable multiplexing automatic. How proxysql do the further process?
I guess:
In tis case,proxysql will not use the connections already in the connect-pool? and always create new connection with the backend?

@renecannao
Copy link
Contributor

At the end of a query, it is determined if the connection should be returned to the connection pool or not.
A connection is returned to the connection if:

  • multiplexing is globally enabled
  • the connection is marked as reusable
  • there are no active transaction : myds->myconn->IsActiveTransaction()==false
  • multiplexing is not disabled for that specific connection: myds->myconn->MultiplexDisabled()==false

What is relevant for your question is MySQL_Connection::MultiplexDisabled() .
Every backend connection has a status variable that tracks the various statuses of the connection.
MultiplexDisabled returns true in all the condition in which the connection it not safe to be shared, like if STATUS_MYSQL_CONNECTION_USER_VARIABLE was set.

@jkklee
Copy link
Author

jkklee commented Jan 6, 2017

got it,tks!

@jkklee
Copy link
Author

jkklee commented Jan 6, 2017

Another question please.
In ProxySQL, are the concepts of connection-pool and multiplexing the same?

@renecannao
Copy link
Contributor

They are very related to each other, but I wouldn't call them "the same".
Connection pool is a cache of connections that can be reused.
Multiplexing is a technique to reuse these connections.

@jkklee
Copy link
Author

jkklee commented Jan 6, 2017

Thanks very much.

@tantra35
Copy link

tantra35 commented Nov 26, 2017

@renecannao Can you clarify where in code happens set of status variable? We can't find in code any place when methods of MySQL_Connection like set_status_ are called. And it seems that multiplexing enable/disable just doesn't work. Because for example follow construction get unexpected result(in pseudo code):

initial value for a collumn of test table is 0

BEGIN
UPDATE test set a=1 where id=1;
select a from test where id=1;

then in php code we see value of a column a in table test

if a == 0 then
    ROLLBACK
ens

As result we got rollback, becase select statament goes to slave(read only server) and read old 0 value
But as described in this document https://github.com/sysown/proxysql/wiki/Multiplexing this is unexpected behaviour. Also if we set mysql-multiplexing=false proxysql global variablethis this also will not work and update and select queries goes to different servers

Then we have tried to find where in source code of proxysql react at least on global variable(mysql-multiplexing), and can't find anything, that can do this

@utdrmac
Copy link

utdrmac commented Feb 21, 2018

@jkklee Is this still an open issue or can you close it?

@jkklee jkklee closed this as completed Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants