replace 插入数据失败

【概述】 使用 sync-diff-inspector 校验两个tidb集群数据是否一致
结果数据不一致,执行replace语句后写入失败。

唯一键:

  PRIMARY KEY (`I_ID`) /*T![clustered_index] CLUSTERED */,
  UNIQUE KEY `FSI` (`I_FILE_ID`,`I_CHANNEL_ID`),
ERROR 1105 (HY000) at line 40950: can not be duplicated row, due to old row not found. handle 2396698 not found
ERROR 1105 (HY000) at line 40951: can not be duplicated row, due to old row not found. handle 2396699 not found
ERROR 1105 (HY000) at line 40952: can not be duplicated row, due to old row not found. handle 2396700 not found
ERROR 1105 (HY000) at line 40953: can not be duplicated row, due to old row not found. handle 2396701 not found
ERROR 1105 (HY000) at line 40956: can not be duplicated row, due to old row not found. handle 2396704 not found
ERROR 1105 (HY000) at line 40957: can not be duplicated row, due to old row not found. handle 2396705 not found
ERROR 1105 (HY000) at line 40964: can not be duplicated row, due to old row not found. handle 2396712 not found

数据不一致为啥要用replace插入呢?

sync-diff-inspector 校验 结果会生成replace语句

集群中查询数据不存在?check-struct-only 参数怎么配置的呀? 配置文件拿出来看看

是在测试环境吗?
业务环境可能统计信息不准确,要手动执行 analyze table {table_name}再对比看看

参考:双云灾备建设,使用sync-diff-inspector 工具校验后,replace补数据执行失败

大佬可参考另一个帖子:双云灾备建设,使用sync-diff-inspector 工具校验后,replace补数据执行失败

2396701 值为主键值

看了楼上老师发的帖子链接, admin check recover 或者重建 索引解决

你用那种方式解决的?

重建索引

了解了

索引和数据不一致的问题,bug吧?

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。