参考文章收集gc相关信息 【SOP 系列 25】GC 常见问题排查
gc参数配置,select报错 获取不到tidb表
MySQL [(none)]> select * from mysql.tidb;
ERROR 9006 (HY000): GC life time is shorter than transaction duration, transaction starts at 2023-10-31 12:09:23.145 +0000 UTC, GC safe point is 2140-03-23 09:32:10.849 +0000 UTC
MySQL [(none)]>
MySQL [(none)]>
MySQL [(none)]>
MySQL [(none)]> show variables like '%gc%';
+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| tidb_gc_concurrency | -1 |
| tidb_gc_enable | ON |
| tidb_gc_life_time | 10m0s |
| tidb_gc_run_interval | 10m0s |
| tidb_gc_scan_lock_mode | LEGACY |
+------------------------+--------+
5 rows in set (0.007 sec)
查看tidb日志中gc-worker日志
[2023/10/31 10:16:26.140 +00:00] [INFO] [gc_worker.go:197] ["[gc worker] start"] [uuid=62e14f023bc0002]
[2023/10/31 10:16:26.144 +00:00] [DEBUG] [gc_worker.go:1826] ["[gc worker] load kv"] [key=tikv_gc_leader_uuid] [value=629bd7ea8d80002]
[2023/10/31 10:16:26.144 +00:00] [DEBUG] [gc_worker.go:1684] ["[gc worker] got leader"] [uuid=629bd7ea8d80002]
[2023/10/31 10:16:26.146 +00:00] [WARN] [gc_worker.go:276] ["[gc worker] check leader"] [error="inconsistent index PRIMARY handle count 1 isn't equal to value count 0"]
[2023/10/31 10:17:26.148 +00:00] [WARN] [gc_worker.go:276] ["[gc worker] check leader"] [error="[tikv:9006]GC life time is shorter than transaction duration, transaction starts at 2023-10-31 10:17:26.145 +0000 UTC, GC safe point is 2140-03-23 09:32:10.849 +0000 UTC"]
[2023/10/31 10:18:26.148 +00:00] [WARN] [gc_worker.go:276] ["[gc worker] check leader"] [error="[tikv:9006]GC life time is shorter than transaction duration, transaction starts at 2023-10-31 10:18:26.146 +0000 UTC, GC safe point is 2140-03-23 09:32:10.849 +0000 UTC"]
查看service-gc-safepoint
{
"service_gc_safe_points": [
{
"service_id": "gc_worker",
"expired_at": 9223372036854775807,
"safe_point": 1408180297622880256
}
],
"gc_safe_point": 1408180297622880256
}