Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: sync-diff报"the isEqual1 and isEqual2 cannot be both true错误
【TiDB Usage Environment】Production Environment
【TiDB Version】Source database is 4.0.0, target database is 6.5.3
【Reproduction Path】Data comparison after synchronization
【Encountered Problem: Phenomenon and Impact】sync-diff reports “the isEqual1 and isEqual2 cannot be both true” error
【Resource Configuration】None
【Attachments: Screenshots/Logs/Monitoring】
[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]$
Configuration:
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
Command as follows:
nohup ./sync_diff_inspector_v6.5.4 --config ./tidb-sync-diff-task.toml --log-level “debug” > ./task.log &
isEqual1 and isEqual2 cannot both be set to true at the same time.
sync-diff needs to set a default snapshot.
isEqual1 and isEqual2 cannot both be set to true. Please adjust accordingly.
Hello, what specific settings are you referring to? Thank you.
Where can I adjust this? Thank you.
[task] Configure the following target-configs = [“config1”]
This link cannot be opened.
You need to use a VPN. The solution inside is “sync-diff requires setting a default snapshot.”
GitHub is not accessible. Could you please help paste an example of setting the default snapshot? Thanks.
The solution provided by the submitter is very simple.
isEqual1 and isEqual2 cannot both be set to true at the same time.
Thank you. How exactly is the default snapshot set? I couldn’t find relevant information. Do the following count?
[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”
Refer to this document:
First, try setting snapshot=“auto”. If that doesn’t work, try specifying a concrete value.
Or comment out the snapshot line.
We have now specified specific values, and there is an error. I will try snapshot=‘auto’.
Additionally, I set the parameters isEqual1 and isEqual2, but it reports that these two parameters are unrecognized.
isEqual1 and isEqual2 are not parameters.
- CDC can only use 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.syncpoint_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:263\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/source.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/pingcap/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.main\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/main.go:104\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:267”]
- After removing the snapshot parameter, it still reports an error
[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”]
Is it possible to set the snapshot of the target end to be the same as the source end?