raffertyyu opened a new issue, #2315: URL: https://github.com/apache/kvrocks/issues/2315
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/kvrocks/issues) and found no similar issues. ### Version unstable branch ### Minimal reproduce step See below ### What did you expect to see? See below ### What did you see instead? See below ### Anything Else? I am getting familiar with kvrocks code. When I am reviewing the compact_filter.cc file, I found this piece of code. ```c++ bool MetadataFilter::Filter(int level, const Slice &key, const Slice &value, std::string *new_value, bool *modified) const { Metadata metadata(kRedisNone, false); rocksdb::Status s = metadata.Decode(value); auto [ns, user_key] = ExtractNamespaceKey(key, stor_->IsSlotIdEncoded()); if (!s.ok()) { LOG(WARNING) << "[compact_filter/metadata] Failed to decode," << ", namespace: " << ns << ", key: " << user_key << ", err: " << s.ToString(); return false; } DLOG(INFO) << "[compact_filter/metadata] " << "namespace: " << ns << ", key: " << user_key << ", result: " << (metadata.Expired() ? "deleted" : "reserved"); return metadata.Expired(); } ``` I am envisioning a scenario: Now, RocksDB has four levels of SST files: L0, L4, L5, and L6. Suppose there is a key, k1, which has a value (k1, v1) in the L6 level without an expiration time, and another value (k1, v2) in the L4 level with an expiration time t1. It can be achieved by sequentially executing: ``` set k1 v1 set k1 v2 ex 1 ``` After a second, k1 expired. Then the SST file containing (k1, v2) in L4 did a compaction between L4 and L5 levels. The compaction filter detect that (k1, v2) had expired and removed it from inputed sst files. At this point, if we attempt to get k1, will rocksdb directly read the value v1 from the L6 level? But if k1 expired, it should return null. So, will it return null or v1? I am unable to design a test to verify this scenario. ### Are you willing to submit a PR? - [ ] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
