Category | Description |
Limits on the source and destination databases | If the tables to be synchronized do not have primary keys and UNIQUE constraints, you must enable the Exactly-Once write feature when you configure the data synchronization task. Otherwise, the destination database may contain duplicate data records. For more information, see Synchronize tables without primary keys or UNIQUE constraints. If you select tables as the objects to be synchronized and you want to edit the tables, such as renaming tables or columns in the destination database, you can synchronize up to 5,000 tables in a single data synchronization task. If you run a task to synchronize more than 5,000 tables, a request error occurs. In this case, we recommend that you configure multiple tasks to synchronize the tables or configure a task to synchronize the entire database. DTS cannot synchronize temporary tables in source database, internal triggers, or some internal procedures and functions written in the C programming language. DTS can synchronize custom parameters of the COMPOSITE, ENUM, and RANGE types. The tables to be synchronized must have the PRIMARY KEY, FOREIGN KEY, UNIQUE, or CHECK constraints. The following requirements for WAL logs must be met: The value of the wal_level parameter must be logical. If you perform only incremental data synchronization, the WAL logs of the source database must be stored for more than 24 hours. If you perform both full data synchronization and incremental data synchronization, the WAL logs of the source database must be stored for at least seven days. Otherwise, DTS may fail to obtain the WAL logs and the task may fail. In exceptional circumstances, data inconsistency or loss may occur. After full data synchronization is complete, you can set the retention period to more than 24 hours. Make sure that you set the retention period of WAL logs based on the preceding requirements. Otherwise, service reliability or performance in the Service Level Agreement (SLA) of DTS may not be guaranteed.
Limits on operations to be performed on the source database: If you want to perform a primary/secondary switchover on the source ApsaraDB RDS for PostgreSQL instance, the Logical Replication Slot Failover feature must be enabled. This prevents logical subscriptions from being interrupted and ensures that your data synchronization task can run as expected. For more information, see Logical Replication Slot Failover. The logical subscription from source database has limits on the usage of DTS. If the size of a single data to be synchronized from the source database exceeds 256 MB upon incremental data changes, the data synchronization instance that is running fails to run and cannot be recovered. You need to configure the task again. During schema synchronization and full data synchronization, do not execute DDL statements to change the schemas of databases or tables. Otherwise, the data synchronization task fails.
If the source database has long-running transactions and incremental data is synchronized in the data synchronization task, the write-ahead logging (WAL) logs generated before the long-running transactions in the source database are committed may be accumulated. As a result, the disk space of the source database may be insufficient. If a major version upgrade for the source database of a data synchronization instance that is running is performed, the instance fails to run and cannot be recovered. You need to configure the task again.
|
Other limits | A data synchronization task can synchronize data from only one database. To synchronize data from multiple databases, you must create a data synchronization task for each database. DTS cannot synchronize tables that have inheritance relationships across schemas. During data synchronization, if you select a schema as the object to synchronize, take note of the following limits: If you create a table in the schema or run the RENAME command to rename the table, you must execute the ALTER TABLE schema.table REPLICA IDENTITY FULL; statement before you write data to the table. This ensures data consistency. When you execute this statement, we recommend that you do not lock the table. Otherwise, a deadlock occurs. DTS does not check the validity of metadata, such as sequences. You must manually check the validity of metadata. After your workloads are switched to the destination database, new sequences do not increment from the maximum value of the sequences in the source database. Therefore, you must query the maximum value of the sequences in the source database before you switch your workloads to the destination database. Then, you must specify the queried maximum value as the starting value of the sequences in the destination database. You can run the following statements to query the maximum value of the sequences in the source database:
do language plpgsql $$
declare
nsp name;
rel name;
val int8;
begin
for nsp,rel in select nspname,relname from pg_class t2 , pg_namespace t3 where t2.relnamespace=t3.oid and t2.relkind='S'
loop
execute format($_$select last_value from %I.%I$_$, nsp, rel) into val;
raise notice '%',
format($_$select setval('%I.%I'::regclass, %s);$_$, nsp, rel, val+1);
end loop;
end;
$$;
Note The returned SQL statements contain all sequences in the source database. You can perform operations in the destination database based on your business requirements. DTS creates the following temporary tables in the source database to obtain the DDL statements of incremental data, the schemas of incremental tables, and the heartbeat information. During data synchronization, do not delete temporary tables in the source database. Otherwise, the data synchronization task fails. After the DTS instance is released, temporary tables are automatically deleted. public.dts_pg_class , public.dts_pg_attribute , public.dts_pg_type , public.dts_pg_enum , public.dts_postgres_heartbeat , public.dts_ddl_command , and public.dts_args_session .
To ensure that the latency of data synchronization is accurate, DTS adds a heartbeat table to the source database. The name of the heartbeat table is dts_postgres_heartbeat. During data synchronization, DTS creates a replication slot for the source database. The replication slot is prefixed with dts_sync_ . DTS can obtain the incremental logs of the source database within the last 15 minutes by using this replication slot. Note After the DTS instance is released, the replication slot is automatically deleted. If you change the password of the source database or delete the IP addresses of DTS from the IP address whitelist, the replication slot cannot be automatically deleted. In this case, you must delete the replication slot in the source database to prevent the replication slot from piling up. If the data synchronization task is released or fails, DTS automatically deletes the replication slot. If a primary/secondary switchover is performed on the source PostgreSQL database, you must log on to the secondary database to delete the replication slot.

Before you synchronize data, evaluate the impact of data synchronization on the performance of the source and destination databases. We recommend that you synchronize data during off-peak hours. During initial full data synchronization, DTS uses the read and write resources of the source and destination databases. This may increase the loads on the database servers. During initial full data synchronization, concurrent INSERT operations cause fragmentation in the tables of the destination database. Therefore, after initial full data synchronization is complete, the size of the used tablespace of the destination database is larger than that of the source database. If you use only DTS to write table data to the destination database, you can use DMS to perform online DDL operations on source tables during data synchronization. For more information, see Change schemas without locking tables. Data inconsistency between the source and destination databases occurs if data from other sources is written to the destination database during the data synchronization. For example, if you use DMS to execute online DDL statements while data from other sources is written to the destination database, data loss may occur in the destination database. If you use a privileged account or superuser account as the destination database account to perform full data synchronization or incremental data synchronization, and the tables to be synchronized contain foreign keys, triggers, or event triggers, DTS temporarily sets the session_replication_role parameter to replica at the session level. If the destination database account does not have the required permissions, you must manually set the session_replication_role parameter to replica. If the value of the session_replication_role parameter is replica and you perform the cascade update or delete operations on the source database during full data synchronization or incremental data synchronization, data inconsistency may occur. After the data synchronization task is released, you can change the value of the session_replication_role parameter back to origin. A two-way data synchronization instance contains a forward synchronization task and a reverse synchronization task. If an object is to be synchronized in both the forward and reverse synchronization tasks when you configure or reset the instance, the following rules apply: Only one of the tasks can synchronize both the full data and incremental data of objects. The other task synchronizes only the incremental data of the objects. The source data of the current task can be synchronized only to the destination database in the task. The synchronized data is not used as the source data of the other task.
If a DTS task fails to run, DTS technical support will try to restore the task within 8 hours. During the restoration, the task may be restarted, and the parameters of the task may be modified. Note Only the parameters of the task may be modified. The parameters of databases are not modified. The parameters that may be modified include but are not limited to the parameters in the "Modify instance parameters" section of the Modify the parameters of a DTS instance topic.
|
Special cases | If the source database is an ApsaraDB RDS for PostgreSQL instance, take note of the following limits: During data synchronization, do not modify the endpoint and zone of the ApsaraDB RDS for PostgreSQL instance. Otherwise, the data synchronization task fails. If the source database is a self-managed PostgreSQL database, take note of the following limits: The values of the max_wal_senders and max_replication_slots parameters must be greater than the sum of the following numbers: the number of used replication slots in the self-managed PostgreSQL database and the number of DTS instances that must be created to synchronize data from this database. If the source database is a Cloud SQL for PostgreSQL instance provided by Google Cloud Platform, you must set the Database Account parameter to a database account with the cloudsqlsuperuser permission for the source database. When you select the objects to be synchronized, you must select the objects that the specified account is authorized to manage. Otherwise, you must grant the OWNER permission on the selected objects to the specified account. Note An account with the cloudsqlsuperuser permission cannot manage the data that is owned by other accounts that have the cloudsqlsuperuser permission.
|