TiDB Data Migration Shard Merge

TiDB Data Migration (DM) supports merging the DML and DDL data in the upstream MySQL/MariaDB sharded tables and migrating the merged data to the downstream TiDB tables.

If you need to migrate and merge MySQL shards of small datasets to TiDB, refer to this tutorial.

Restrictions

Currently, the shard merge feature is supported only in limited scenarios. For details, refer to Sharding DDL usage Restrictions in the pessimistic mode and Sharding DDL usage Restrictions in the optimistic mode.

Configure parameters

In the task configuration file, set shard-mode to pessimistic:

  1. shard-mode: "pessimistic"
  2. # The shard merge mode. Optional modes are ""/"pessimistic"/"optimistic". The "" mode is used by default
  3. # which means sharding DDL merge is disabled. If the task is a shard merge task, set it to the "pessimistic"
  4. # mode. After getting a deep understanding of the principles and restrictions of the "optimistic" mode, you
  5. # can set it to the "optimistic" mode.

Handle sharding DDL locks manually

In some abnormal scenarios, you need to handle sharding DDL Locks manually.