sync-diff报"the isEqual1 and isEqual2 cannot be both true错误

【 TiDB 使用环境】生产环境
【 TiDB 版本】源库是4.0.0,目标库6.5.3
【复现路径】数据同步后比对
【遇到的问题:问题现象及影响】sync-diff报"the isEqual1 and isEqual2 cannot be both true错误
【资源配置】无
【附件:截图/日志/监控】

[2024/01/27 13:48:37.510 +08:00] [INFO] [diff.go:553] [“chunk split successfully”] [“chunk id”=“{"table-index":26,"bucket-index-left":73,"bucket-index-right":73,"chunk-index":2,"chunk-count":4}”] [count1=1277] [count2=1275]
[2024/01/27 13:48:37.512 +08:00] [FATAL] [diff.go:575] [“the isEqual1 and isEqual2 cannot be both true”] [stack=“main.(*Diff).binSearch\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:575\nmain.(*Diff).BinGenerate\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:506\nmain.(*Diff).consume\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:446\nmain.(*Diff).Equal.func2\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:282\ngithub.com/pingcap/tidb-tools/sync_diff_inspector/utils.(*WorkerPool).Apply.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/utils/utils.go:94”]
[tidb@cnsz082764 output-ubisql-tidb-task6]$

配置:
more xxx-tidb-sync-diff-task.toml

Diff Configuration.

######################### Global config #########################
check-thread-count = 4
export-fix-sql = true
check-struct-only = false

######################### Datasource config #########################
[data-sources]
[data-sources.tidb_prd]
host = “xxx”
port = 6080
user = “xx”
password = xxx
snapshot = xxxx

[data-sources.tidb_prd1]
host = “xxxx”
port = 6080
user = xx
password = xxxx
snapshot = “447303592564490243”

######################### Task config #########################
[task]
output-dir = “/full_bak/sync-diff/output-ubisql-tidb-task6”
source-instances = [“tidb_prd”]
target-instance = “tidb_prd1”
target-check-tables = [“xxx.*”]

[table-configs.config1]
target-tables = [“xxx.xxx”]
index-fields = [“ID”]
chunk-size = 50000

命令如下:
nohup ./sync_diff_inspector_v6.5.4 --config ./tidb-sync-diff-task.toml --log-level “debug” > ./task.log &

isEqual1和 isEqual2不能同时设置为true

1 个赞

https://github.com/pingcap/tidb-tools/issues/626
sync-diff需要设置缺省快照。

isEqual1和 isEqual2不能同时设置为true,调整一下

你好,具体是什么设置,谢谢。

请问这个在哪里调整。谢谢。

[task]下面配置下target-configs = [“config1”]

https://github.com/pingcap/tidb-tools/issues/626
这个链接打不开啊

isEqual1 代表什么意思?

需要科学上网,里面的解决方案就是“sync-diff需要设置缺省快照。”。

github打不开,可以帮忙粘贴下设置缺省快照的案例吗?谢谢/


提交者给的解决方案很简单。

isEqual1和 isEqual2不能同时设置为true

谢谢,请问default snapshot具体是怎么设置?没有找到相关资料。下面这些算吗?

[data-sources.tidb_prd]
host = “xxxx”
port = xxxx
user = “xxxx”
password = “xxxx”
snapshot = “433408135904886975”

[data-sources.ubisql_prd]
host = “xxxx”
port = xxxx
user = “xxxx”
password = “xxxx”
snapshot = “433408135942111294”

参考这篇文档
https://docs.pingcap.com/zh/tidb/stable/sync-diff-inspector-overview
先把snapshot="auto"试一下,不行再试一下具体值。

或者把snapshot这行注释掉。

我们现在是指定了具体值,有报错误。我试试snapshot=‘auto’。

另外isEqual1和isEqual2这两个参数我设置,报不能识别这两个参数。

isEqual1和isEqual2并不是参数。

  1. CDC才能使用snapshot=“auto”

[2024/02/02 09:29:34.799 +08:00] [FATAL] [main.go:120] [“failed to initialize diff process”] [error=“fetching auto-position tidb_snapshot failed: Error 1146 (42S02): Table ‘tidb_cdc.s
yncpoint_v1’ doesn’t exist”] [errorVerbose=“Error 1146 (42S02): Table ‘tidb_cdc.syncpoint_v1’ doesn’t exist\nfetching auto-position tidb_snapshot failed\ngithub.com/pingcap/tidb-tools
/sync_diff_inspector/source.getAutoSnapshotPosition\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/source/source.go:248\ngithub
.com/pingcap/tidb-tools/sync_diff_inspector/source.initDBConn\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/source/source.go:2
63\ngithub.com/pingcap/tidb-tools/sync_diff_inspector/source.NewSources\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/source/s
ource.go:117\nmain.(*Diff).init\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:137\nmain.NewDiff\n\t/home/jenkins/agent
/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:95\nmain.checkSyncState\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingca
p/tidb-tools/sync_diff_inspector/main.go:117\nmain.main\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/main.go:104\nruntime.mai
n\n\t/usr/local/go/src/runtime/proc.go:267\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1650”] [stack=“main.checkSyncState\n\t/home/jenkins/agent/workspace/build-common/go
/src/github.com/pingcap/tidb-tools/sync_diff_inspector/main.go:120\nmain.main\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/ma
in.go:104\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:267”]

  1. 去掉snaphot参数后,还是会报错
    [2024/02/01 21:20:21.266 +08:00] [FATAL] [diff.go:575] [“the isEqual1 and isEqual2 cannot be both true”] [stack=“main.(*Diff).binSearch\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:575\nmain.(*Diff).binSearch\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:562\nmain.(*Diff).BinGenerate\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:506\nmain.(*Diff).consume\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:446\nmain.(*Diff).Equal.func2\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:282\ngithub.com/pingcap/tidb-tools/sync_diff_inspector/utils.(*WorkerPool).Apply.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/utils/utils.go:94”]

将目标端的snapshot设置成与源端相同可以吗?