-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Routing Rules: Improved escaping of reserved and invalid names for tables and keyspaces #9522
Routing Rules: Improved escaping of reserved and invalid names for tables and keyspaces #9522
Conversation
@@ -57,7 +57,7 @@ ENGINE=InnoDB`, mysql.MaximumPositionSize)} | |||
// This is to support in-place upgrades from 13.0.x to 14.0.x | |||
func AlterReparentJournal() []string { | |||
return []string{ | |||
"`ALTER TABLE _vt.reparent_journal CHANGE COLUMN primary_alias master_alias VARBINARY(32) NOT NULL`", | |||
"ALTER TABLE _vt.reparent_journal CHANGE COLUMN primary_alias master_alias VARBINARY(32) NOT NULL", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deepthi, FYI: this sql query had extra backticks which was causing failures I noticed in the logs.
b514ef9
to
ac5c357
Compare
Nice work, @rohit-nayak-ps ! I think you addressed the two unexpected issues I noticed before when I tried to fix this quickly. |
…te. Escape keyspace while creating database during reshard. Update e2e tests to validate these scenarios Signed-off-by: Rohit Nayak <rohit@planetscale.com>
50633af
to
c0a866a
Compare
FWIW, manual tests against this branch are looking good. I used this:
Then executing these steps in the docker_local container:
|
d7318a1
to
6ab785e
Compare
And address my own minor review nits Signed-off-by: Matt Lord <mattalord@gmail.com>
6ab785e
to
e8d783c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had previously created a draft PR where I was adding the backticks directly to the routing rules and that got messy. I like how this was addressed here — simple and clean. Thanks, @rohit-nayak-ps !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This is a follow-up to vitessio#9522 We missed that and thus MoveTables Cancel can still fail when tables have special characters in them or use reserved words. Signed-off-by: Matt Lord <mattalord@gmail.com>
Description
This PR has the following changes:
Routing Rules
The target of a routing rule during MoveTables can contain the name of keyspaces and/or tables which are reserved or invalid mysql identifiers. These need to be backticked while generating the sql. https://github.com/vitessio/vitess/blob/b514ef94b56414751d230f86b9e966b84c303677/go/vt/vtgate/vindexes/vschema.go#L492
Reshard
Copying the schema from one shard to another, if a keyspace has special characters, causes errors while running
Create Database
because the database name is invalid and needs backticking.https://github.com/vitessio/vitess/blob/b514ef94b56414751d230f86b9e966b84c303677/go/vt/mysqlctl/tmutils/schema.go#L236
Test changes
The e2e tests for vreplication are updated to:
Lead
so as to name it with a reserved mysql keyword, and to test with mixed casemerchant-type
so as to use-
to test the backticks while runningcreate database
during ReshardRelated Issue(s)
User
table during a MoveTable result in a lowercase name and table not found #8994Checklist