feat(CuckooFilter): add cf.exists and cf.mexists command#3467
feat(CuckooFilter): add cf.exists and cf.mexists command#3467nagisa-kunhah wants to merge 12 commits into
Conversation
|
@jihuayu Sorry for the noise. The initial version of this PR branch accidentally contained replayed upstream commits because it was not cleanly rebased onto the latest |
|
@nagisa-kunhah Thank you for your contribution. It doesn't matter. I only care about the code diff. Please @ me if you have any other questions. Tips:
|
f6d62cb to
33d36bb
Compare
33d36bb to
3471314
Compare
3471314 to
76c01ae
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds RedisBloom-compatible existence queries for Kvrocks’ CuckooFilter implementation by introducing CF.EXISTS and CF.MEXISTS commands, backed by new read-path APIs in the Cuckoo filter type layer and validated through both Go integration/unit tests and C++ unit tests.
Changes:
- Add
CF.EXISTSandCF.MEXISTScommand implementations and register them as read-only commands. - Implement
redis::CuckooChain::Exists/MExistsusing per-sub-filter bucket lookups via a newCuckooSubFilter::Containshelper. - Add test coverage for missing keys, wrong types, argument validation, ordering, and post-expansion behavior (Go + C++).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/gocase/unit/type/bloom/cuckoo_filter_test.go | Adds Go tests for cf.exists/cf.mexists, including wrongtype/arity and expansion scenarios. |
| tests/cppunit/types/cuckoo_filter_test.cc | Adds extensive C++ unit tests for Exists/MExists behavior (including expansion and edge-case items). |
| src/types/redis_cuckoo_chain.h | Exposes new Exists/MExists APIs on the Cuckoo filter type. |
| src/types/redis_cuckoo_chain.cc | Implements Exists/MExists by scanning sub-filters and checking bucket slots. |
| src/types/cuckoo_filter_sub_filter.h | Adds a read-only Contains method for sub-filter membership checks. |
| src/types/cuckoo_filter_sub_filter.cc | Implements Contains using cached page prefetch + per-slot scans of candidate buckets. |
| src/storage/redis_metadata.h | Clarifies base_capacity meaning for auto-created vs reserved filters (comment update). |
| src/commands/cmd_cuckoo_filter.cc | Adds cf.exists and cf.mexists Commander implementations and registers them. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jihuayu
left a comment
There was a problem hiding this comment.
Hi @nagisa-kunhah. Thank you for your contribution. Overall, this looks good.
|
|
Hi @jihuayu , thank you for your careful review. I have addressed all your comments and added some unit tests. Feel free to @ me if you have any questions. |


task id: #3359