Limit type | Description |
Limits on the source database | The tables that you want to synchronize must have PRIMARY KEY or UNIQUE constraints, and all fields must be unique. Otherwise, the destination database may contain duplicate data records. 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. The following requirements for WAL logs must be met: The value of the wal_level parameter is set to 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.
If the source database has one or more 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. 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.
|
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. If you run a full or incremental data synchronization task, the tables to be synchronized from the source database contain foreign keys, triggers, or event triggers, and the account of the destination database is a privileged account, DTS temporarily sets the session_replication_role parameter to replica at the session level during full or incremental data synchronization. If the account of the destination database does not have the permission, you must manually set the session_replication_role parameter to replica in the destination database. During full or incremental data synchronization, if you perform cascade update or delete operations on the source database while the session_replication_role parameter is set to replica, 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. If you select a schema as the object to be synchronized, 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 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 in the source database to replicate data. 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 no data from other sources is written to the destination database during data synchronization, you can use DMS to perform online DDL operations on source tables. For more information, see Perform lock-free DDL operations. Data inconsistency between the source and destination databases occurs if data from other sources is written to the destination database during 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. 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, newly written 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;
$$;
|
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 Database Account 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.
|