5

I want to create a tool to delete all of the data older than some days in rocksdb or leveldb, but i don't know how to start it.

Michael
  • 367
  • 5
  • 12

1 Answers1

1

RocksDB has a specific database, called Date_tiered DB. You can specify the ttl with which u want to open the database. It basically shards the data that gets inserted into multiple CFs and Drops the CFs as a whole when ttl has expired. Note that, when the Db is opened second time with a different ttl, the expiry time of the data is calculated based on the new ones.

Alternatively, you can create your own custom compaction filter to remove the old data in compaction time. This actually saves the pain of issuing a delete and can be done as a background job.