During data consistency check, DTS compares the table data between the source and target databases and outputs the comparison result and inconsistency details for you to quickly process the inconsistent data. A data consistency check task is independent and does not affect the normal business in the source database or other DTS tasks.
Data consistency check tasks can be triggered automatically or created manually.
- Automatic triggering: During migration task configuration, if Full check is selected for Data Consistency Check, a data consistency check task will be triggered automatically when the migration task enters the incremental sync step.
- Manual creation: When the DTS task enters the incremental sync step, you can manually create one or multiple data consistency check tasks.
Linkages currently supporting data consistency check are as follows:
- MySQL/MariaDB/Percona/TDSQL for MySQL > MySQL
- MySQL/MariaDB/Percona/TDSQL for MySQL > MariaDB
- MySQL/MariaDB/Percona > TDSQL-C for MySQL
- MySQL/MariaDB/Percona/TDSQL for MySQL > TDSQL for MySQL
- MySQL/MariaDB/Percona/TDSQL for TDStore > TDSQL for TDStore
- During data consistency check, only the database/table objects selected in the source database are compared with those migrated to the target database. The consistency is not checked for data written during migration, other advanced objects (such as procedures and events), and accounts.
- A data consistency check task may increase the load in the source database instance. Therefore, you need to perform such tasks during off-peak hours.
- A data consistency check task can be executed repeatedly, but one DTS instance can initiate only one such task at any time.
- A table to be checked must have a primary key or unique key; otherwise, it will be skipped by DTS during the check.
- If you choose to complete or terminate a DTS task before a data consistency check task is completed, the check task will fail.
- As data consistency check requires creating a new database
__tencentdb__ in the source database and writing the checksum table to the database, if the source database is read-only, data consistency check will be skipped.
Currently, check tasks are imperceptible to the DDL operations. If you perform DDL operations in the source database during migration, the check result will be inconsistent with the actual data, and you need to initiate another check task to get the accurate comparison result.
Triggering a data consistency check task automatically
On the Set migration options and select migration objects page of a data migration task, select Full check for Data Consistency Check. In this way, a data consistency check task will be triggered automatically when the migration task enters the incremental sync step.
Creating a data consistency check task manually
- Log in to the DTS console.
- On the Data Migration page, select a migration task you want to check and click the task ID to enter the Task Details page.
- Switch the tab and click Data Consistency Check.
- Click Create Data Consistency Check.
A data consistency check task can be created only when the corresponding DTS task is in the incremental sync step. If the button is grayed out, the DTS task status does not meet the requirement; for example, the task has not entered the incremental sync step, has failed, or is terminated.
- In the pop-up window, click OK.
- After configuring the data consistency check parameters, click Start Data Comparison.
You can select All Migration Objects or Custom for the migration objects.
Viewing data consistency check result
- On the migration task homepage, view whether the check result is Consistent or Inconsistent in the Last Check Result column. Click View More to enter the Verification Details page.
- Click View to view the check result.
If the data is consistent, the result will be like: