-
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
CopySchemaShard doesn't work properly with collation and charset defaults set on table #5265
Comments
The comment on the compare schema explicitly states that we expect that the source and targets have the same default character set settings. Trying to make it smarter is essentially an endless complication because mysql has default settings on every schema entity and they layer on top of each other. The only reasonable fix for the problem is to add an option to We should still compare and report the differences. That will tell the users that they need to verify this mismatch. |
There's a similar issue for the "CREATE DATABASE" step of CopySchemaShard, where things might differ slightly because of differences in MySQL versions. Note that we do that as a separate step, so a "force" flag would have to bypass a failure on that step too. |
I am adding a patch to add a |
Signed-off-by: Jacques Grove <[email protected]>
@sougou I was rereading your comment above and I actually had a question, particularly about this:
If someone sets a table default, would that override any layers before that? Would it be possible to at least unambiguously handle some cases automatically that way, or do you need to know the full picture to make any reasonable assertion? |
That may work and could be worthy workaround. |
Issue #5265 ; add a --skip-verify option to CopySchemaShard.
A workaround has been merged, so I am removing this from the v6.0 milestone. |
I'm closing this as it's no longer an issue. If you feel that I'm missing something here please let me know and we can re-open it. Thanks! |
Overview of the Issue
SHOW CREATE TABLE
can sometimes return aCREATE TABLE
statement that is different from how the table was actually created. In this case, setting the defaultCOLLATION
andCHARSET
options for the table can result inSHOW CREATE TABLE
returning aCREATE TABLE
command that explicitly sets theCOLLATE
option onvarchar
fields.The end result is that the vitess
CopySchemaShard
command will create a table on the destination shard with a differentCREATE TABLE
statement than it was originally created with, resulting in two slightly different tables. This will cause theCopySchemaShard
command to report failure.Reproduction Steps
In MySQL, on a tablet, create a table like this:
Show create table will display:
If you create the table using:
or
Show create table will display:
If you run
CopySchemaShard
with a source of the table created with the firstCREATE TABLE
statement above, it will create a table using the secondCREATE TABLE
statement, causing the two tables to be different and the command to fail.It's possible that there are some cases where if the connection's charset/collation differ to the table,
SHOW CREATE TABLE
may report back something that is more verbose, so the results of this reproduction may vary.The text was updated successfully, but these errors were encountered: