DM数据同步主键冲突

为提高效率,请提供以下信息,问题描述清晰能够更快得到解决:

【TiDB 版本】TIDB 4.0.11 DM 2.0.1

【问题描述】TIDB端只有只读账号权限,没有写操作。怎么同步会告主键冲突呢。

        "subTaskStatus": [
            {
                "name": "yace_3306",
                "stage": "Paused",
                "unit": "Sync",
                "result": {
                    "isCanceled": false,
                    "errors": [
                        {
                            "ErrCode": 10006,
                            "ErrClass": "database",
                            "ErrScope": "not-set",
                            "ErrLevel": "high",
                            "Message": "startLocation: [position: (, 0), gtid-set: ], endLocation: [position: (3306-binlog.000926, 94455866), gtid-set: ]: execute statement failed: commit",
                            "RawCause": "Error 1062: Duplicate entry '85465514861390' for key 'PRIMARY'",
                            "Workaround": ""
                        }
                    ],
                    "detail": null
                },
                "unresolvedDDLLockID": "",

提问前建议搜索下,排查请参考下面的帖子

是在sync增量同步阶段

一样的,需要先查一下数据插入数据库的时间

这应该是同步机制问题,重启同步就没有问题,重启的前5分钟默认是安全模式。

这个告警连哪个表出现主键冲突都没有了,1.X版本还有那个表报错的详情。

日志里也没有吗

TIDB.log里面是有的,

好的,我们确认下。

worker.log

[2021/03/30 20:43:17.857 +08:00] [WARN] [syncer.go:864] [“error detected when executing SQL job, skip flush checkpoint”] [task=yace_3306] [unit=“binlog replication”] [checkpoint=“position: (3306-binlog.000924, 146693675), gtid-set: (flushed position: (3306-binlog.000924, 146395969), gtid-set: )”]
[2021/03/30 20:43:17.859 +08:00] [WARN] [syncer.go:566] [“something wrong with rollback global checkpoint”] [task=yace_3306] [unit=“binlog replication”] [“previous position”=“position: (3306-binlog.000924, 146693675), gtid-set: “] [“current position”=“position: (3306-binlog.000924, 146395969), gtid-set: “]
[2021/03/30 20:43:17.859 +08:00] [INFO] [subtask.go:291] [“unit process returned”] [subtask=yace_3306] [unit=Sync] [stage=Paused] [status=”{“totalEvents”:335410334,“totalTps”:626,“masterBinlog”:”(3306-binlog.000924, 146788849)”,“syncerBinlog”:”(3306-binlog.000924, 146395969)",“binlogType”:“remote”}"]
[2021/03/30 20:43:17.859 +08:00] [ERROR] [subtask.go:310] [“unit process error”] [subtask=yace_3306] [unit=Sync] [“error information”="{“ErrCode”:10006,“ErrClass”:“database”,“ErrScope”:“not-set”,“ErrLevel”:“high”,“Message”:“startLocation: [position: (, 0), gtid-set: ], endLocation: [position: (3306-binlog.000924, 146634664), gtid-set: ]: execute statement failed: commit”,“RawCause”:“Error 1062: Duplicate entry ‘85465513436444’ for key ‘PRIMARY’”}"]
[2021/03/30 20:43:20.378 +08:00] [WARN] [task_checker.go:389] [“task can’t auto resume”] [component=“task checker”] [task=yace_3306]

好的,我们反馈下。感谢。