The Data Cleaning Process in TiKV Storage

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

Original topic: TiKV 在存储数据时, 数据清理过程

| username: 飞到北京的企鹅

In the storage of data, TiKV stores data in the key#version value format. Therefore, the same key with different versions will not be merged in RocksDB. Under what circumstances is historical data cleared?

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

Are you asking how GC data is handled?

| username: xfworld | Original post link

After version 7.X, there will be a TTL expiration description for data. Currently, TiKV handles multiple versions mainly by relying on RocksDB’s compaction. There are two ways TiKV initiates the compaction process: