The requirements and instructions for syncing MySQL, MariaDB, Percona, TDSQL-C MySQL, TDSQL Boundless to TencentDB TDSQL MySQL are essentially the same as those for TDSQL MySQL syncing to TDSQL MySQL. See relevant content for operations. Currently, only differences are displayed.
1. In the synchronization links from MySQL/MariaDB/Percona to TDSQL MySQL, the mapping of partitioned tables is as follows:
1.1 If the user has no table type mapping, the primary key is selected as the shard key by default, and the sharding method is hash; for a composite primary key, the first primary key is selected as the shard key.
1.1.1 Partitioned tables created at the source must comply with the table creation specifications for partitioned tables on the target side TDSQL MySQL (for example, the type of the shardkey field must be int/bigint/smallint/char/varchar; when the shardkey field type is char/varchar, the field length must be defined; shardkey cannot contain Chinese characters, and so on), and the partitioning rules in both the full and incremental stages must meet the requirements of the target side; otherwise, it will result in synchronization error reporting.
1.1.2 If the primary key type of the source database, after it is mapped and converted by DTS, does not meet the requirements for the shard key type of the target database (the shard key must be int, bigint, smallint, char, or varchar), it will be created as a non-sharded table.
1.2 For the mapping of partitioned tables, only first-level partitioning (hash, range, list) is currently supported, using the primary key as the partitioning key. If no partitioning type is specified, hash is used by default for first-level partitioning mapping.
1.2.1 When mapping to first-level Range/List partitions, the supported partition key data types in the target database are TINYINT, SMALLINT, MEDIUMINT, INT (INTEGER), BIGINT, CHAR, and VARCHAR. When setting Range/List partitions, ensure the partitioning policy covers all data from full + incremental sources; otherwise, data cannot be written according to partitioning rules, resulting in task errors.
1.2.2 When the partitioning key is mapped to first-level Hash partitions, the partitioning key must be part of the primary key and unique index. The supported partitioning key data types in the target database are SMALLINT, INT (INTEGER), BIGINT, CHAR, and VARCHAR.
1.3 If the source-side MySQL/MariaDB/Percona uses sharded tables, they can only be created as non-sharded tables after being synchronized to the target-side TDSQL MySQL.
2. In the scenario of synchronizing MySQL/MariaDB/Percona to TDSQL MySQL, due to the limitations on auto-increment fields imposed by sharded tables and broadcast tables on the target side TDSQL MySQL, the corresponding restrictions on the source side are as follows:
2.1 The source side does not support using the ALTER TABLE MODIFY AUTO_INCREMENT syntax to modify a regular field to AUTO_INCREMENT. If there are similar operations modifying the auto-increment field AUTO_INCREMENT, the synchronization task will cause error reporting.
2.2 If a table at the source has an auto-increment column, that column must be part of the primary key; otherwise, the synchronization task will cause error reporting.