How can application identify that the TTL of key has expired, if compaction wasn’t activated yet and we want to avoid finding the record?
Reply by Hilik, Speedb’s co-founder and chief scientist:
We can provide a special get that will return the time that the data was written (or else do not return a key if the ttl has expired). These are PR that can be asked and implemented based on priority… You can also use the user time stamp functionality to get a key with time stamp that you entered.
From the author of the question:
‘“That you entered” - do you mean the timestamp of the record creation? Can you pls give an example?’
‘If using DB:Get() with user timestamp enable, on record that TTL has expired (but not compacted yet) will it return anything? For example: I create a record at 08:00 with TTL 10 seconds and the compaction is expected to run at 08:00:15. I query the table at 08:00:12. (is it the expected &ts to the api?) . Will the get return the record of not?’
Reply by Hilik, Speedb’s co-founder and chief scientist:
quoted from rocksdb wiki “Get/Iterator may return expired entries(compaction not run on them yet)” so the answer was yes in version 6 … I did not see new document so i guess the answer is still yes… I agree this is a misbehave (bug) …
Reply by Hilik, Speedb’s co-founder and chief scientist:
as for the first question , the user defined timestamp allows the user to add a timestamp to the key . for more info please look at rocksdb Wiki : https://github-wiki-see.page/m/facebook/rocksdb/wiki/User-defined-Timestamp-(Experimental)