Issues with tidb_gc_life_time in TiDB v6.1.0

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

Original topic: tidb v6.1.0 tidb_gc_life_time问题

| username: Hacker_5KEgzcj2

[TiDB Usage Environment] Production
[TiDB Version] v6.1.0
The new version’s GC setting time cannot exceed 24 hours.

| username: Raymond | Original post link

There shouldn’t be. Did you write the format incorrectly?

| username: Hacker_5KEgzcj2 | Original post link

I’ve also seen this. Modifications in the lower version 5.4.1 are fine, but in version 6.1.0, it doesn’t work. It works for 24h, but if adjusted to 25h, it doesn’t work. I really don’t know why.

| username: Raymond | Original post link

Adjusting it to 48 hours still doesn’t work?

| username: Hacker_5KEgzcj2 | Original post link

No, it won’t work as long as it exceeds 24 hours. Anything under 24 hours is fine.

| username: Hacker_5KEgzcj2 | Original post link

The default value of the tidb_gc_life_time parameter is 10m, which means that the data will be retained for 10 minutes before being garbage collected.

| username: onlyacat | Original post link

Tried 6.1.0, didn’t work.
6.3.0 works.
I guess the new version fixed it.

| username: 我是咖啡哥 | Original post link

Try using this method.

UPDATE mysql.tidb SET VARIABLE_VALUE="48h" WHERE VARIABLE_NAME="tikv_gc_life_time";
| username: 啦啦啦啦啦 | Original post link

It should be this issue. This version has a time check restriction, which was fixed in 6.1.1.

| username: 裤衩儿飞上天 | Original post link

My 6.1.2 doesn’t have this issue

TiDB root@10.18.13.224:test> show variables like '%tidb_gc%'
+------------------------+--------+
| Variable_name          | Value  |
+------------------------+--------+
| tidb_gc_concurrency    | -1     |
| tidb_gc_enable         | ON     |
| tidb_gc_life_time      | 10m0s  |
| tidb_gc_max_wait_time  | 86400  |
| tidb_gc_run_interval   | 10m0s  |
| tidb_gc_scan_lock_mode | LEGACY |
+------------------------+--------+
6 rows in set
Time: 0.039s
TiDB root@10.18.13.224:test> set global tidb_gc_life_time='48h';
Query OK, 0 rows affected
Time: 0.082s
TiDB root@10.18.13.224:test> show variables like '%tidb_gc_life_time%'
+-------------------+---------+
| Variable_name     | Value   |
+-------------------+---------+
| tidb_gc_life_time | 48h0m0s |
+-------------------+---------+
1 row in set
Time: 0.023s
TiDB root@10.18.13.224:test>
| username: 会飞的土拨鼠 | Original post link

The default value of 10 minutes feels a bit small, and it can be configured according to the specific query duration requirements. I have only set it to 24 hours; I haven’t set it for more than a day. – Adjust GC to retain data within the last day update mysql.tidb set VARIABLE_VALUE=“24h” where VARIABLE_NAME=“tikv_gc_life_time”;

| username: tidb菜鸟一只 | Original post link

I always change it like this: UPDATE mysql.tidb SET variable_value=‘25h’ WHERE variable_name=‘tikv_gc_life_time’; No problem.

| username: Hacker_5KEgzcj2 | Original post link

Well, I’ll give this method a try.

| username: Hacker_5KEgzcj2 | Original post link

This method is feasible, normal modification. :+1:

| username: Raymond | Original post link

Is “show variables like ‘%tikv_gc_life_time%’;” effective as well?

| username: system | Original post link

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