Can the TiKV client in Java control the GC time? How to set it?

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

Original topic: tikv client java 可以控制gc时间吗?怎么设置呢?

| username: 迷人的Ti

[TiDB Usage Environment] Poc
[TiDB Version] 6.5.4
[Encountered Issue: Problem Phenomenon and Impact]
When the tikv client in Java retrieves CDC events from tikv, the values obtained each time for historical times are not completely consistent, with some data loss. It is suspected that the data has been garbage collected (GC). How can the GC time be set?

| username: xfworld | Original post link

The TSO of CDC will move forward and will not stay in one place…

If it has not been called, compact, the data version will not be recycled, unless you have installed a TiDB node… which may trigger GC.

Reference documents:

| username: Fly-bird | Original post link

You can configure GC through the following system variables:

| username: ti-tiger | Original post link

The TiKV client Java can control the GC time, but it needs to be achieved by modifying the TiDB configuration. The specific steps are as follows:

  • Use the following command to update the tikv_gc_life_time variable in the mysql.tidb table, setting it to the desired value (e.g., 30 minutes):
update mysql.tidb set variable_value ='30m' where variable_name ='tikv_gc_life_time' ;
| username: system | Original post link

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