How to Set the TTL for Compaction

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

Original topic: 如何设置Compaction的TTL呢

| username: TiDBer_TLK8Du2x

In the past few days, while testing the compaction method of TiKV, I found that using GO-YCSB to stress test 50GB of data with the FIFO compression strategy would periodically delete data, as shown in the image below:
image

Upon investigation, I learned that this compression method deletes old data whenever a data’s lifecycle ends. This results in an overwhelming advantage when comparing its performance with leveled and tiered strategies. I would like to ask how to modify the data lifecycle. Is it by changing the TTL? After modifying the TTL, I always fail to start the cluster, and the log shows the following error:
[“Recovering raft logs takes 195.957µs”] [thread_id=1]
[2024/06/28 20:31:37.100 +08:00] [ERROR] [engine_factory.rs:197] [“failed to create kv engine”] [err=“Engine(Status { code: IoError, sub_code: None, sev: NoError, state: "Not implemented: TTL is only supported in Block-Based Table format. " })”] [path=/tidb-data/tikv-20160] [thread_id=1]