Skip to content

I'm trying to use the with_ttl option to automatically delete older records. #57

Answered by Congyuwang
Menziess asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, surprise to me as well. See this link: https://github.com/facebook/rocksdb/wiki/Time-to-Live

It appears that ttl in rocksdb means it will at least live that long. and the value is deleted only during compaction. So expired value may get deleted in the process when more values inserted during compaction.

From RocksDB

  • Expired TTL values are deleted in compaction only:(Timestamp+ttl<time_now)
  • Get/Iterator may return expired entries(compaction not run on them yet)
  • Different TTL may be used during different Opens
  • read_only=true opens in the usual read-only mode. Compactions will not be triggered(neither manual nor automatic), so no expired entries removed

Some warnings:

  • Calling DB::Open…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Menziess
Comment options

Answer selected by Congyuwang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #56 on March 23, 2023 17:11.