How to Properly Configure GC

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

Original topic: 如何正确配置GC

| username: 孤君888

Is my way of setting GC incorrect? I saw some experts directly modify the mysql.tidb table as well. How should I configure it?

Also, why does the above method result in an error?

【Resource Configuration】
【Attachments: Screenshots/Logs/Monitoring】

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

 set global tidb_gc_life_time='72h';

Add quotation marks.
Updating the table is also possible.

| username: 孤君888 | Original post link

Just tested it, doesn’t work.

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

In v7.1, it works with or without quotes.

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

I tried 6.1.1 and it works. Are you logging in with root?


MySQL [(none)]> select version();
+--------------------+
| version()          |
+--------------------+
| 5.7.25-TiDB-v6.1.1 |
+--------------------+
1 row in set (0.00 sec)

MySQL [(none)]> show variables like '%gc_life%';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| tidb_gc_life_time | 10m0s |
+-------------------+-------+
1 row in set (0.00 sec)

MySQL [(none)]> set global tidb_gc_life_time=1h;
Query OK, 0 rows affected (0.05 sec)

MySQL [(none)]> show variables like '%gc_life%';
+-------------------+--------+
| Variable_name     | Value  |
+-------------------+--------+
| tidb_gc_life_time | 1h0m0s |
+-------------------+--------+
1 row in set (0.00 sec)

| username: 孤君888 | Original post link

No, I used a regular user with ALL privileges to set global. Isn’t that allowed?

| username: 孤君888 | Original post link

Very strange

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

How about directly updating that table?

| username: 孤君888 | Original post link

Directly modifying the table is OK.

mysql> update mysql.tidb set VARIABLE_VALUE='72h' where VARIABLE_NAME='tikv_gc_life_time';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql>
| username: 啦啦啦啦啦 | Original post link

Version 6.1.0 has a bug, refer to this link:

| username: 孤君888 | Original post link

Ah? This bug is huge :joy:

| username: 啦啦啦啦啦 | Original post link

The update is possible, it was fixed after version 6.1.1.

| username: zhanggame1 | Original post link

It’s actually a bug. Could it be a version limitation at that time?

| username: cassblanca | Original post link

Learning a bug

| username: system | Original post link

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