tencent cloud

Data Transfer Service

Syncing Online DDL Temp Table

Unduh
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-11-30 17:41:18
Diterjemahkan & Diperiksa oleh AI

Overview

When you use tools such as gh-ost and pt-Online-schema-change (pt-osc) to perform Online DDL on tables in the source database, you need to synchronize the temp tables generated by the Online DDL changes to the target database. DTS allows you to associate the temp table names of the target tables in advance when you select synchronization objects, so that the temp tables generated later in the source database can be synchronized together.
When you use the gh-ost tool to perform Online DDL on table_name, DTS supports synchronizing the temp tables _table_name_ghc, _table_name_gho, and _table_name_del to the target database.
When you use the pt-osc tool to perform Online DDL on table_name, DTS supports synchronizing the temp tables _table_name_new and _table_name_old to the target database.
To process shadow tables generated by Alibaba Cloud DMS lock-free changes, see the "Alibaba Cloud DMS Lock-free Changes" section below.

Alibaba Cloud DMS Lock-Free Change

Alibaba Cloud DMS "Lock-free Schema Change" is also implemented based on shadow tables, but the shadow table names contain a randomly generated change ID at runtime, and the naming convention differs from that of pt-osc and gh-ost. After you select "Alibaba Cloud DMS Lock-free Change", DTS identifies shadow tables in the incremental stage based on the tp_{change_ID}_{type}_table_name rule:
Shadow tables: tp_{change_ID}_ogt_table_name (short format: tp_{change_ID}_g_table_name), tp_{change_ID}_del_table_name (short format: tp_{change_ID}_d_table_name).
Heartbeat tables: tp_{change_ID}_ogl_table_name, tp_{change_ID}_l_table_name.
The processing method differs from that of pt-osc and gh-ost: DTS filters out DML and CREATE/ALTER/DROP operations on shadow tables and does not synchronize shadow tables to the target. When DMS executes RENAME TABLE table_name TO tp_{change_ID}_del_table_name, tp_{change_ID}_ogt_table_name TO table_name to complete the switchover, DTS converts it into a DDL statement and executes it on the target to keep the target table structure consistent with the source.

Application Scope

The link ranges supported for synchronizing Online DDL temp tables are as follows:
MySQL/MariaDB/Percona/TDSQL-C for MySQL > MySQL
MySQL/MariaDB/Percona > MariaDB
MySQL/MariaDB/TDSQL-C for MySQL > TDSQL-C for MySQL
MySQL/MariaDB/Percona/TDSQL-C for MySQL > Kafka
MySQL/MariaDB/Percona > TDSQL Boundless
Alibaba Cloud DMS lock-free change: sync tasks where the source database is MySQL, MariaDB, Percona, or TDSQL-C MySQL.

Restriction

The table mapping (table renaming) feature conflicts with the temp table migration feature (online DDL), and only one of them can be enabled at any time.
If the business database contains normal tables that match the naming pattern tp_{number}_{ogt|del|g|d}_table_name, their data changes will also be filtered out. Confirm this before you select "Alibaba Cloud DMS Lock-free Change".
Alibaba Cloud DMS lock-free changes executed during the full sync stage are not guaranteed to be synchronized to the target. You are advised to execute DDL changes during the incremental stage.
Alibaba Cloud DMS Lock-free Change can be selected together with pt-osc and gh-ost, and each tool identifies its own shadow tables independently.

Directions

1. Log in to the DTS console, select Data Sync on the left sidebar, and create a sync task.
2. In the Set sync options and objects step, enable Sync Online DDL Temp Table and select an option for Online DDL Tool.
If you select gh-ost, DTS will migrate the temp tables (_table name_ghc, _table name_gho, and _table name_del) generated by the gh-ost tool to the target database.
If you select pt-osc, DTS will migrate the temp tables (_table name_new and _table name_old) generated by the pt-osc tool to the target database.
If you select Alibaba Cloud DMS Lock-free Change, DTS will filter out data changes from shadow tables such as tp_{change_ID}_ogt_table_name and tp_{change_ID}_del_table_name, and convert the RENAME operation into a DDL statement to be executed on the target side when DMS switches the old and new tables.
Note
In Selected Object on the right, you need to select the specified table, and then the button Sync Online DDL Temp Table will be displayed below. If you select databases or ‍the "Tables" folder, the button won't be displayed.
If the source database already contains tables with the same names as temp tables _table name_new and _table name_old, pt-osc will generate other temp tables with different names, which DTS cannot sync. In this case, if you just choose the table itself as the Sync Object, data in temp tables created by online DDL updates cannot be migrated to the target database. Instead, you must select the entire database or instance where the table to be synced resides.


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan