-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(mysql): improve compatibility with ProxySQL #425
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
fix(mysql): improve compatibility with ProxySQL #425
Conversation
|
That's unfortunate. As these are ran on every new connection I'd prefer to keep the single execute when we can. Can you conditionally do this based on the server supporting multiple statements? Something like if conn.stream.capabilities.contains(Capabilities::MULTI_STATEMENTS) {
// can send all statements at once
} else {
// need to send them one at a time
} |
|
I'll check to see what capabilities are being returned. |
98a918a to
e2f18d7
Compare
|
I threw in a log statement to check out what capabilities were being advertised:
With I considered adding a new option to the MySQL builder, but I think the more prudent course would be to have a build feature, so I've updated the PR to use that instead. |
|
I did some digging. It does look like ProxySQL is mostly behaving correctly. There just isn't a capability to show "hey we support multiple non-CRUD statements". However See: https://dev.mysql.com/doc/refman/5.6/en/set-variable.html#set-variable-multiple-assignments Can you try tweaking the statement to be formed like that and see if ProxySQL is okay with it? |
|
I did some tweaks as recommended, and am currently doing a long-run to verify that I'm not getting any errors. I did notice that, if I don't include one semicolon at the end, ProxySQL didn't seem to be preserving the session variables (the Including the semicolon at the end triggers ProxySQL to still consider it a "multi-select" statement and lock the connection, but it does properly preserve the session variables and function as expected. This does cause a warning to be emitted by ProxySQL, but since there isn't actually another statement after the semicolon, I'm not getting a "bad SQL" error back. I'll update the PR with the new single-statement connection setup. |
Joins the MySQL connection setup statements into a single statement to prevent issues with ProxySQL, which requires special handling of connections that might be shared between multiple backends. Fixes launchbadge#422 Signed-off-by: Marcus Griep <marcus@griep.us>
e2f18d7 to
274826e
Compare
|
Thank you for investigating and fixing this. This seems to improve support for older versions of MySQL as well. 👍 |
Joins the MySQL connection setup statements into a single statement to prevent issues with ProxySQL, which requires special handling of connections that might be shared between multiple backends.
Original: