vtgate: Handle SET for sql_auto_is_null#3611
Merged
sougou merged 2 commits intovitessio:masterfrom Jan 31, 2018
Merged
Conversation
Contributor
|
Wow. Nasty feature. We should disable it. To make vttablet enforce this, you can add the check in the PS: The test has a minor compilation error. |
Many ORMs (most notably Rails' ActiveRecord and Django) start their MySQL connections with a `SET sql_auto_is_null=0`. This setting is superfluous in all MySQL engines that are supported by Vitess, where `sql_auto_is_null` is always disabled by default. Furthermore, it doesn't seem feasible to actually implement this feature in Vitess because of sharded queries. Because of this, we propose handling the case where the feature is set to 0 (i.e. a no-op), and returning an explicit error when somebody tries to actually enable the feature. This improves the compatibility of Vitess' MySQL layer with these ORMs, and improves the UX for users attempting to enable `sql_auto_is_null` in a connection.
Collaborator
Author
|
Ah yes, that's the perfect spot. Updated the PR! |
Contributor
|
Some new tests are failing. Looks like you need to add that query to fakesqldb. |
Collaborator
Author
|
phew! Took me a while to get the fakesqldb queries wired up everywhere. Finally got it right. Ready to review! |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @sougou! Here's a small patch to improve compatibility with Ruby on Rails for the MySQL layer. I know you discussed this briefly with @arthurnn in chat.
I would also love it if there was a way for Vitess (probably the vttablets) to ensure that
sql_auto_is_nullhas not been enabled manually by the user (i.e. in the MySQL configs), because the feature is insane and it's gonna break stuff. I haven't found the right place to add the check tho.Many ORMs (most notably Rails' ActiveRecord and Django) start their
MySQL connections with a
SET sql_auto_is_null=0.This setting is superfluous in all MySQL engines that are supported by
Vitess, where
sql_auto_is_nullis always disabled by default.Furthermore, it doesn't seem feasible to actually implement this feature
in Vitess because of sharded queries.
Because of this, we propose handling the case where the feature is set
to 0 (i.e. a no-op), and returning an explicit error when somebody tries
to actually enable the feature.
This improves the compatibility of Vitess' MySQL layer with these ORMs,
and improves the UX for users attempting to enable
sql_auto_is_nullina connection.