-
Notifications
You must be signed in to change notification settings - Fork 188
loader, syncer: Update sql_mode to more compatible #1869
Conversation
* update load.go/syncer.go with modifying sql_mode, * add sql_mode Integration Test
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 notice there're two usage of SQL mode: one to execute SQLs and one to parse upstream DDLs
/run-all-tests |
Integration test
@okJiang Seems after we remove But In the original test case, the insert fails because upstream change column type but downstream (tidb) don't support this, so after skip ddl, the insert should fail bacuase data in not fit in downstream anymore. @GMHDBJD @lance6716 @kennytm PTAL at this case, I think we should still keep the |
I rethought about this, If data have been successfully inserted in the upstream, it must be valid even if the origin value may not be. So I think we should always enable |
@glorv I think we should keep |
But once always enable
And at the beginning we wanted to solve the problem that user insert invalid datetime #1735. |
not catch up with your discussion, I just want to remind the data may be inserted in a session SQL mode that is different with global SQL mode |
/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.
LGTM
/run-all-tests |
PTAL @lance6716 @GMHDBJD |
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.
rest lgtm
); | ||
|
||
-- test sql_mode PIPES_AS_CONCAT | ||
insert into t_1(num) values('pipes'||'as'||'concat'); |
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.
why this can be inserted into an int
field 😂
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.
Because it exists here as a bit operation OR.
-- test sql_mode NO_AUTO_VALUE_ON_ZERO | ||
insert into t_1(id, name) values (10, 'a'); | ||
insert into t_1(id, name) values (0, 'b'); | ||
insert into t_1(id, name) values (0, 'c'); |
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.
since we didn't set sql mode in this SQL file, above two insert are converted to auto increment value, so the binlog is writtern with the auto increment value not zero, and this didn't test DM will add NO_AUTO_VALUE_ON_ZERO with AdjustSQLModeCompatible
since db2 (source2) has done this test, maybe we could remove above lines.
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.
Yes, I think it just tested what you said above.
[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 |
2 similar comments
/run-all-tests |
/run-all-tests |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: d436f23
|
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #1894. |
What problem does this PR solve?
close #1735 and #1818
What is changed and how it works?
By add/delete some upstream's global.sql_mode to make downstream's sql_mode more compatible.
Check List
Tests
Code changes
Side effects
Related changes