[18.x] Fix schemacopy collation issues#15859
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
c3acb5d to
f3895d1
Compare
2a28040 to
7f47760
Compare
Signed-off-by: Arthur Schreiber <arthurschreiber@github.com>
7f47760 to
cfb8e60
Compare
|
@shlomi-noach Do you know what's going on here? Based on the log files when running some of the failing end-to-end tests, it looks like when the table is created with the collation information, each subsequent Does the sidecardb initialization not handle the collation information correctly? 🤔 |
|
Also, it doesn't matter whether I use the old or new collation names ( |
|
Ugh, I think I might have figured this out. Is this a bug in the schemadiff code? It looks like creating a column with just a And I guess the schema diff code then sees that as a change that was made (without any actual change) and runs the |
Signed-off-by: Arthur Schreiber <arthurschreiber@github.com>
|
Here's a test case that is currently failing: diff --git a/go/vt/schemadiff/schema_diff_test.go b/go/vt/schemadiff/schema_diff_test.go
index f6477c1885..d7cf8a9258 100644
--- a/go/vt/schemadiff/schema_diff_test.go
+++ b/go/vt/schemadiff/schema_diff_test.go
@@ -663,6 +663,15 @@ func TestSchemaDiff(t *testing.T) {
expectDeps: 0,
entityOrder: []string{"t1"},
},
+ {
+ name: "two identical tables, one with explicit charset, one without",
+ fromQueries: []string{
+ "create table foobar (id int primary key, foo varchar(64) character set utf8mb3 collate utf8mb3_bin)",
+ },
+ toQueries: []string{
+ "create table foobar (id int primary key, foo varchar(64) collate utf8mb3_bin)",
+ },
+ },
}
hints := &DiffHints{RangeRotationStrategy: RangeRotationDistinctStatements}
for _, tc := range tt { |
|
@arthurschreiber thank you for producing a test case! Looking into it. |
|
From what I can see, |
|
This is weird, because the following test passes in {
name: "ignore identical implicit charset",
from: "create table t (id int primary key, v varchar(64) character set utf8mb3 collate utf8mb3_bin)",
to: "create table t (id int primary key, v varchar(64) collate utf8mb3_bin)",
}, |
|
OK, I completely missed that the issue is with |
|
Not sure how backportable this will be to |
Signed-off-by: Arthur Schreiber <arthurschreiber@github.com>
Description
This fixes a collation error caused by a query run during health check in
vttablet.The same issue exists in v17.x, so a backport is required once this has been merged to v18.x.
Related Issue(s)
Illegal mix of collations for operation 'UNION' (errno 1271) (sqlstate HY000)in health streamer #15858Checklist
Deployment Notes