[TiDB Usage Environment] Poc
[TiDB DM Version] 6.5.0
[Reproduction Path] Operations performed that led to the issue
[Encountered Issue: Phenomenon and Impact] Using DM to upgrade MySQL 5.7 to 8.0, full synchronization mode works fine, but incremental synchronization encounters a sql_mode error when creating tables in downstream MySQL 8. Disabling sql_mode in downstream MySQL 8 also results in an error, as shown below:
“Message”: “startLocation: [position: (mysql-bin.000003, 237639569), gtid-set: 84c1354f-419e-11ee-af95-fa163ecab0ce:1-1513], endLocation: [position: (mysql-bin.000003, 237639640), gtid-set: 84c1354f-419e-11ee-af95-fa163ecab0ce:1-1513]: gen insert sqls failed, sourceTable: test.repl5_8, targetTable: test.repl5_8: failed to set default downstream sql_mode ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION in schema tracker”,
“RawCause”: “Error 1231: Variable ‘sql_mode’ can’t be set to the value of ‘NO_AUTO_CREATE_USER’”,
The resolution date is close to DM 6.6, making it difficult to determine if 6.6 includes this fix, but it is certain that DM 7.0 and above will not have this problem.
So, upgrade DM.
Here’s a temporary solution: set the sql_mode of the downstream to be the same as the upstream, and remember to remove NO_AUTO_CREATE_USER because this has been removed in MySQL 8. Then, use binlog skip in DM to bypass this error.