snapshot is older than GC safe point

TiDB 5.4.0
用sync-diff做新老集群数据一致性的时候报错“snapshot is older than GC safe point”
[2022/09/06 17:27:06.098 +08:00] [FATAL] [main.go:120] [“failed to initialize diff process”] [error=“create db connections {“host”:“10.10.**",“port”:4000,“user”:“sync_diff_inspector”,“schema”:"",“snapshot”:“435800657503191048”} error Error 8055: snapshot is older than GC safe point 2022-09-06 17:14:48 +0800 CST"] [errorVerbose="create db connections {“host”:"10.10.”,“port”:4000,“user”:“sync_diff_inspector”,“schema”:”",“snapshot”:“435800657503191048”} error Error 8055: snapshot is older than GC safe point 2022-09-06 17:14:48 +0800 CST\ngithub.com/pingcap/tidb-tools/sync_diff_inspector/source/common.CreateDB\ \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/source/common/conn.go:28\ github.com/pingcap/tidb-tools/sync_diff_inspector/source.initDBConn\ \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/source/source.go:236\ github.com/pingcap/tidb-tools/sync_diff_inspector/source.NewSources\ \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/source/source.go:114\ main.(*Diff).init\ \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:139\ main.NewDiff\ \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/diff.go:97\ main.checkSyncState\ \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/main.go:117\ main.main\ \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/main.go:104\ runtime.main\ \t/usr/local/go/src/runtime/proc.go:250\ runtime.goexit\ \t/usr/local/go/src/runtime/asm_amd64.s:1571"] [stack=“main.checkSyncState\ \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/main.go:120\ main.main\ \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb-tools/sync_diff_inspector/main.go:104\ runtime.main\ \t/usr/local/go/src/runtime/proc.go:250”]

【 TiDB 使用环境】生产\测试环境\ POC
【 TiDB 版本】
【遇到的问题】
【复现路径】做过哪些操作出现的问题
【问题现象及影响】
【附件】

  • 相关日志、配置文件、Grafana 监控(https://metricstool.pingcap.com/)
  • TiUP Cluster Display 信息
  • TiUP CLuster Edit config 信息
  • TiDB-Overview 监控
  • 对应模块的 Grafana 监控(如有 BR、TiDB-binlog、TiCDC 等)
  • 对应模块日志(包含问题前后 1 小时日志)

若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出的打印结果,请务必全选并复制粘贴上传。

snapshot is older than GC safe point
超过了GC的时间
GC默认时间10m

只能把快照时间参数去掉就可以了

如何设置GC时间呢,生产环境一般设置多大合适呢?

在数据更新频繁的场景下如果设置得比较大(如数天甚至数月),可能会有一些潜在的问题:
参数在mysql.tidb里可以看到 tikv_gc_life_time
用update进行修改

1.SELECT * FROM mysql.tidb WHERE variable_name = ‘tikv_gc_safe_point’;
可以执行这语句查看下safe_point,选择safe_point内的snapshot进行对比
2.UPDATE mysql.tidb SET VARIABLE_VALUE = ‘3h’ WHERE VARIABLE_NAME=‘tikv_gc_life_time’;
默认是10分钟,可以设置3h,根据自己维护时间去设置合适的时长

好的,谢谢了,我做数据迁移用的,4个小时够了,完了设置回小点的

看起来这个问题已经解决,麻烦选择一条有用的回答,并关闭这个话题,谢谢。

GC时间的问题,操作期间把GC时间调整一下,操作完成后,再调整回来就是了。