Help Center/ Data Replication Service/ FAQs/ Real-Time Synchronization/ What Should I Do If Data Inconsistency Occurs Due to Inconsistent Primary Keys or Unique Keys of DRS?
Updated on 2024-11-30 GMT+08:00

What Should I Do If Data Inconsistency Occurs Due to Inconsistent Primary Keys or Unique Keys of DRS?

Scenarios

During real-time synchronization from MySQL to MySQL, the destination database already has a table structure. In the incremental synchronization phase, data inconsistency is detected, and the destination database structure is different from that of the source database.

Possible Causes

The unique index or primary key of the destination database is inconsistent with that of the source database. Especially when the unique index (primary key) of the destination database is less than that of the source database, if two different data records are written to the source database in the incremental phase, the two data records overwrite each other in the destination database due to unique key conflicts, as a result, the data in the destination database is less than that in the source database, and data inconsistency occurs.

Solution

  1. Locate the task and click Edit in the Operation column. On the Set Synchronization Task page, modify the objects to be synchronized, delete the tables with inconsistent data, and start the task.
  2. Clear the data in the corresponding table in the destination database and change the table structure to be compatible with the source database.
  3. Click Edit in the Operation column of the task again to modify the objects to be synchronized, add the table, and start the task to update the table data.