MySQL data synchronized to downstream TiDB via DM, sync status shows "Duplicate entry 'xxx' for key 'PRIMARY'"

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: mysql 数据通过DM同步到下游TIDB,sync状态出现Duplicate entry ‘xxx’ for key ‘PRIMARY’"

| username: LKLK

MySQL data is synchronized to downstream TiDB V5.4.1 through DM, and the sync status shows “Duplicate entry ‘xxx’ for key ‘PRIMARY’”.

Table structure:

CREATE TABLE `t_order_local_price` (
  `o_id` int(11) NOT NULL,
  `olp_curr` varchar(5) NOT NULL,
  `olp_curr_price` decimal(11,3) NOT NULL,
  `olp_curr_price_usd` decimal(11,3) NOT NULL,
  PRIMARY KEY (`o_id`),
  KEY `olp_curr` (`olp_curr`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin

When the “Duplicate entry ‘xxx’ for key ‘PRIMARY’” error occurs, I only find one record in the upstream source data, but it already exists in the downstream. Is this a bug in DM? How can I resolve it? The table is also very small.

[Attachment]

Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.

| username: jerry | Original post link

Primary key conflict, check if there are other tasks also writing data into it!!

| username: HACK | Original post link

Before this issue occurred, did your DM replication stop due to other problems? You can check when this record was inserted upstream.

| username: h5n1 | Original post link

Refer to the article below:

| username: system | Original post link

This topic was automatically closed 1 minute after the last reply. No new replies are allowed.