Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: TiCDC同步DDL语句问题
[TiDB Usage Environment] Production Environment
[TiDB Version] V6.1.0
[Reproduction Path] Using ticdc to synchronize data to MySQL
[Encountered Problem: Problem Phenomenon and Impact]
When adding an index to the TiDB table, the MySQL add index statement is executed multiple times. Setting the parameter sync-ddl to false still synchronizes the DDL statement.
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]
MySQL executing the add index statement
ticdc configuration:
It is possible to execute multiple times. Refer to TiCDC 简介 | PingCAP 文档中心. You only need to ensure that the first DDL is executed correctly. Subsequent add index DDLs will automatically report an error due to the same index name. CDC will recognize the error due to index duplication and continue to synchronize subsequent data.
The current situation seems to be caused by the downstream MySQL executing DDL being blocked, leading to CDC internal thread timeout retries. The recommended solution is to resolve the downstream DDL blocking issue, or alternatively, pause CDC synchronization, manually create the downstream index, and then resume synchronization. This way, it will proceed smoothly.
The operation of adding an index above has never been successful, so it has not been able to report an error, causing the upstream CDC to be unable to detect the error and continue to synchronize subsequent data? Another question is whether setting sync-ddl to false is truly effective. We have previously encountered a situation where sync-ddl was set to false, but the DDL was still collected.
It should be parallel, not executed multiple times.
It’s not parallel; there is a sequential order.
After execution, it looks like this. Adding an index in MySQL can be quite time-consuming if the table is large. I hope not to synchronize DDL statements, but it seems that sync-ddl is not very useful.
It’s not parallel, it’s serial.
This is taking a long time to execute and getting stuck. If it takes too long, it will cause the CDC to disconnect. It’s best to create an index on MySQL first, then create the index on TiDB. MySQL will skip this DDL and directly synchronize the subsequent ones.