Help Center/ Data Replication Service/ Troubleshooting/ Solutions to Failed Check Items/ Database Parameters/ Whether There Are Foreign Keys Containing Unsupported Reference Operations in the Source Database
Updated on 2023-02-15 GMT+08:00

Whether There Are Foreign Keys Containing Unsupported Reference Operations in the Source Database

MySQL and GaussDB(for MySQL) Serving as the Source in Full+Incremental or Incremental Migration and Synchronization, MySQL and GaussDB(for MySQL) Serving as the Source in DR

Table 1 Whether there are foreign keys containing unsupported reference operations in the source database

Check Item

Whether there are foreign keys containing unsupported reference operations in the source database

Description

In a synchronization object, there are foreign keys that contain reference operations such as CASCADE, SET NULL, and SET DEFAULT. These operations will cause the update or deletion of rows in parent tables and affect records in child tables. Also, operations related to child tables are not recorded in binlogs. The DRS cannot synchronize data, and data in child tables is inconsistent.

Failure Cause and Handling Suggestion

Failure cause: In a synchronization object, there are foreign keys that contain reference operations such as CASCADE, SET NULL, and SET DEFAULT. These operations will cause the update or deletion of rows in parent tables and affect records in child tables. Also, operations related to child tables are not recorded in binlogs. The DRS cannot synchronize data, and data in child tables is inconsistent.

Handling suggestion: Delete foreign keys that contain reference operations such as CASCADE, SET NULL, and SET DEFAULT from child tables, or do not synchronize these child tables.

Reference statement for deleting a foreign key:

ALTER TABLE table_name DROP FOREIGN KEY foreign_key_name