-
Notifications
You must be signed in to change notification settings - Fork 289
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
syncer(dm) : fix default collation with upstream in create table statement #3575
syncer(dm) : fix default collation with upstream in create table statement #3575
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/run-all-tests |
/run-all-tests |
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.
also we should check dump/load phase will correctly handle collation.
by we have done some work of get SQL mode from the header of query event, maybe this would help |
…-diff-default-collation
seems we can get replication-time-connection from binlog QueryEvent ptal @WizardXiao |
ok, tanks, i will try. |
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.
Do we need to do the same thing to columns and databases?
i think this pr will only support tables and if anything go well, we may think about columns and databases later. |
After some test about mysql binlog, there is a problem when we use |
|
Not 8.0.26, almost every modern versions |
SHOW CREATE TABLE will not write collation when |
thanks! i think maybe adjust
|
@WizardXiao I think this PR deserve a release note as it's an important bugfix. |
I assume this works fine with the New framework for collations enabled? Do we need to add tests for that? |
/run-all-tests |
|
/run-verify-ci |
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 assume this works fine with the New framework for collations enabled? Do we need to add tests for that?
This PR only handle the increment phase, pingcap/tidb#30292 handles dump/load phase. A testing PR will be submitted after including them two.
/run-all-tests |
/run-all-tests |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 89113bf
|
@WizardXiao: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created: #3753. |
What problem does this PR solve?
fix https://github.com/pingcap/ticdc/issues/3420
in this case:
sql1:
create database if not exists test
sql2:
create database test CHARACTER SET=utf8mb4
sql3:
create table test.t1 (id int)
sql4:
create table test.t1 (id int) CHARSET=utf8mb4
if syncer send the same ddl to downstream tidb, database or table will has diffrent
collation
from upstream mysql, because the default collation is different between tidb and mysql.What is changed and how it works?
it will adjust collation when sync
create database
orcreate table
statement.for database, it will add
collation
by binlog query event and handle ddl like these:sql1:
create database if not exists test COLLATE = utf8mb4_general_ci
sql2:
create database test CHARACTER SET=utf8mb4 COLLATE = utf8mb4_general_ci
for table has no
charset
andcollation
, as we can not getcollation
from binlog, so there will have issue about timeliness, because dm can set start position at increment mode. so we will check and add warning log in dm.in this case, downstream db will use
collation
from database for table, so user can use dm sync dabase ddl sql, but if not, user should make sure dabase'scollation
is right if create dabase manually. so the ddl will be handled like that:sql3:
create table test.t1 (id int)
and warning logdetect create table risk which use implicit charset and collation
for table has
charset
but nocollation
, we will add default collation bySHOW CHARACTER SET
, so the dll will be handled like that:sql4:
create table test.t1 (id int) CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci
Check List
Tests
Release note