GC-related issues

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: gc 相关问题

| username: 胡杨树旁

When watching the video ‘Quick Response to Data Loss’, I found two GC parameters, one on the TiDB side and one on the TiKV side, namely tidb_gc_life_time and tikv_gc_life_time. I don’t quite understand these two parameters.

You can query the tidb_gc_life_time parameter using show variables like '%gc%';, but the tikv_gc_life_time parameter is queried from mysql.tidb.

| username: weixiaobing | Original post link

tidb_gc_life_time Introduced from Version v5.0

  • Scope: GLOBAL
  • Persisted to Cluster: Yes
  • Default Value: 10m0s
  • Range: [10m0s, 8760h0m0s]
  • This variable is used to specify the retention period for data during each garbage collection (GC). The variable value is in Go’s Duration string format. During each GC, the safe point is determined by subtracting the value of this variable from the current time.

tidb_gc_life_time is a cluster variable added to prevent errors in GC tasks caused by accidental table updates. tikv_gc_life_time is the key of the field in mysql.tidb. Both are the same, and updating either value will synchronize with the other.

| username: hey-hoho | Original post link

Before version 5.0, the mysql.tidb table was used to update gc-life-time. After version 5.0, it was changed to use system variables (recommended usage), which means the same thing.

| username: 胡杨树旁 | Original post link

Understood, the effect is the same after version 5.0.

| username: 胡杨树旁 | Original post link

Before version 5.0, if you wanted to adjust GC, did you still adjust it in mysql.tidb?

| username: hey-hoho | Original post link

Yes, that system variable did not exist before version 5.0.

| username: 胡杨树旁 | Original post link

Okay, thank you.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.