When the data migration task is in the Sync
stage, if you add additional tables to the configuration file and restart the task, DM does not re-execute full export and import for the newly added tables. Instead, DM continues incremental replication from the previous checkpoint.
Therefore, if the full data of the newly added table has not been imported to the downstream, you need to use a separate data migration task to export and import the full data to the downstream.
Record the position information in the global checkpoint (is_global=1
) corresponding to the existing migration task as checkpoint-T
, such as (mysql-bin.000100, 1234)
. Record the position information of the full export metedata
(or the checkpoint of another data migration task in the Sync
stage) of the table to be added to the migration task as checkpoint-S
, such as (mysql-bin.000099, 5678)
. You can add the table to the migration task by the following steps:
-
Use
stop-task
to stop an existing migration task. If the table to be added belongs to another running migration task, stop that task as well. -
Use a MySQL client to connect the downstream TiDB database and manually update the information in the checkpoint table corresponding to the existing migration task to the smaller value between
checkpoint-T
andcheckpoint-S
. In this example, it is(mysql- bin.000099, 5678)
.-
The checkpoint table to be updated is
{task-name}_syncer_checkpoint
in the{dm_meta}
schema. -
The checkpoint rows to be updated match
id=(source-id)
andis_global=1
. -
The checkpoint columns to be updated are
binlog_name
andbinlog_pos
.
-
-
Set
safe-mode: true
for thesyncers
in the task to ensure reentrant execution. -
Start the task using
start-task
. -
Observe the task status through
query-status
. WhensyncerBinlog
exceeds the larger value ofcheckpoint-T
andcheckpoint-S
, restoresafe-mode
to the original value and restart the task. In this example, it is(mysql-bin.000100, 1234)
.