You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "nagisa-kunhah (via GitHub)" <gi...@apache.org> on 2026/07/26 11:20:42 UTC
[PR] feat: del [kvrocks]
nagisa-kunhah opened a new pull request, #3567:
URL: https://github.com/apache/kvrocks/pull/3567
part of: #3552
## Summary
Add RedisBloom-compatible `CF.DEL key item` support for Cuckoo Filter.
`CF.DEL` deletes one matching fingerprint occurrence and returns `1` when a slot is cleared, or `0` when the key/item
is not found. Duplicate inserts require duplicate deletes, matching RedisBloom behavior.
## Design
The command layer adds `cf.del` as a write command and delegates deletion to `CuckooChain::Delete`.
Deletion loads the Cuckoo Filter metadata, hashes the item, generates the fingerprint, then searches sub-filters from
newest to oldest. The first matching slot in either candidate bucket is cleared, and only one occurrence is removed.
After a successful delete, metadata size is decremented and `num_deleted_items` is incremented. When the chain has
more than one sub-filter and accumulated deletes exceed 10% of the remaining item count, an internal compact pass is
triggered. Compact tries to move fingerprints from newer sub-filters into older ones, removes fully compacted latest
sub-filters, and deletes their persisted page keys to avoid stale data if the chain expands again later.
Page key construction is shared through small Cuckoo page helpers so compact cleanup uses the same encoding as normal
page access.
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(CuckooFilter): add cf.del command [kvrocks]
Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu commented on code in PR #3567:
URL: https://github.com/apache/kvrocks/pull/3567#discussion_r3794296771
##########
tests/cppunit/types/cuckoo_filter_test.cc:
##########
@@ -743,3 +783,164 @@ TEST_F(RedisCuckooFilterTest, ExpansionWritesNewFilterIndexPage) {
ASSERT_TRUE(s.ok()) << s.ToString();
EXPECT_EQ(page.size(), expected_page_size);
}
+
+TEST_F(RedisCuckooFilterTest, DeleteMissingKeyReturnsNotFound) {
+ bool deleted = true;
+ auto s = cuckoo_->Delete(*ctx_, key_, "missing", &deleted);
+ EXPECT_TRUE(s.IsNotFound()) << s.ToString();
+ EXPECT_NE(s.ToString().find("Not found"), std::string::npos);
+}
+
+TEST_F(RedisCuckooFilterTest, DeleteBasicClearsOneItem) {
+ reserveAndVerify(key_, 1000, 4, 500, 2);
+ addAndVerify(key_, "item", 1000, 4, 500, 2, 1);
+
+ bool deleted = false;
+ auto s = cuckoo_->Delete(*ctx_, key_, "item", &deleted);
+ ASSERT_TRUE(s.ok()) << s.ToString();
+ EXPECT_TRUE(deleted);
+ verifyMetadata(key_, 1000, 4, 500, 2, 0, 1, 1);
+
+ deleted = true;
+ s = cuckoo_->Delete(*ctx_, key_, "item", &deleted);
+ ASSERT_TRUE(s.ok()) << s.ToString();
+ EXPECT_FALSE(deleted);
+ verifyMetadata(key_, 1000, 4, 500, 2, 0, 1, 1);
+}
+
+TEST_F(RedisCuckooFilterTest, DeleteDuplicateItemsOneAtATime) {
+ reserveAndVerify(key_, 1000, 4, 500, 2);
+ for (int i = 0; i < 3; ++i) {
+ addAndVerify(key_, "duplicate", 1000, 4, 500, 2, i + 1);
+ }
+
+ for (int i = 0; i < 3; ++i) {
+ bool deleted = false;
+ auto s = cuckoo_->Delete(*ctx_, key_, "duplicate", &deleted);
+ ASSERT_TRUE(s.ok()) << s.ToString();
+ EXPECT_TRUE(deleted);
+ verifyMetadata(key_, 1000, 4, 500, 2, 2 - i, 1, i + 1);
+ }
+
+ bool deleted = true;
+ auto s = cuckoo_->Delete(*ctx_, key_, "duplicate", &deleted);
+ ASSERT_TRUE(s.ok()) << s.ToString();
+ EXPECT_FALSE(deleted);
+ verifyMetadata(key_, 1000, 4, 500, 2, 0, 1, 3);
+}
Review Comment:
I think these case Go tests is OK, so there’s no need to add C++ test cases.
##########
src/types/redis_cuckoo_chain.h:
##########
@@ -62,6 +65,8 @@ class CuckooChain : public Database {
bool *inserted);
rocksdb::Status commitSubFilterAndMetadata(engine::Context &ctx, const Slice &user_key, const std::string &ns_key,
CuckooChainMetadata *metadata, CuckooSubFilter *sub_filter);
+ rocksdb::Status commitDelete(engine::Context &ctx, const Slice &user_key, const std::string &ns_key,
Review Comment:
I feel that `commitDelete` is a bit odd from an architectural perspective, as it duplicates some of the logic in `commitSubFilterAndMetadata`. Could we reuse `commitSubFilterAndMetadata` for the commit-related logic instead?
##########
tests/gocase/unit/type/bloom/cuckoo_filter_test.go:
##########
@@ -107,6 +107,42 @@ func TestCuckooFilter(t *testing.T) {
require.Error(t, rdb.Do(ctx, "cf.add", "key", "item1", "item2").Err())
})
+ t.Run("Del wrong number of arguments", func(t *testing.T) {
+ require.Error(t, rdb.Do(ctx, "cf.del").Err())
+ require.Error(t, rdb.Do(ctx, "cf.del", "key_only").Err())
+ require.Error(t, rdb.Do(ctx, "cf.del", "key", "item1", "item2").Err())
+ })
+
+ t.Run("Del missing key", func(t *testing.T) {
+ key := "test_cuckoo_filter_del_missing"
+ require.NoError(t, rdb.Del(ctx, key).Err())
+ require.ErrorContains(t, rdb.Do(ctx, "cf.del", key, "item").Err(), "Not found")
+ })
+
+ t.Run("Del wrong type", func(t *testing.T) {
+ key := "test_cuckoo_filter_del_wrong_type"
+ require.NoError(t, rdb.Set(ctx, key, "value", 0).Err())
+ require.ErrorContains(t, rdb.Do(ctx, "cf.del", key, "item").Err(), "WRONGTYPE")
+ })
+
+ t.Run("Del basic", func(t *testing.T) {
Review Comment:
The current tests don't seem to cover cases that span multiple sub-filters. Could you add a test case for that?
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(CuckooFilter): add cf.del command [kvrocks]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3567:
URL: https://github.com/apache/kvrocks/pull/3567#discussion_r3799944533
##########
tests/cppunit/types/cuckoo_filter_test.cc:
##########
@@ -743,3 +783,164 @@ TEST_F(RedisCuckooFilterTest, ExpansionWritesNewFilterIndexPage) {
ASSERT_TRUE(s.ok()) << s.ToString();
EXPECT_EQ(page.size(), expected_page_size);
}
+
+TEST_F(RedisCuckooFilterTest, DeleteMissingKeyReturnsNotFound) {
+ bool deleted = true;
+ auto s = cuckoo_->Delete(*ctx_, key_, "missing", &deleted);
+ EXPECT_TRUE(s.IsNotFound()) << s.ToString();
+ EXPECT_NE(s.ToString().find("Not found"), std::string::npos);
+}
Review Comment:
Missing keys should not produce a NotFound error for CF.DEL if we want RedisBloom-compatible semantics (return 0 and deleted=false). This test currently expects NotFound and should be updated accordingly.
##########
src/types/redis_cuckoo_chain.cc:
##########
@@ -179,6 +179,45 @@ rocksdb::Status CuckooChain::Add(engine::Context &ctx, const Slice &user_key, co
return rocksdb::Status::Aborted("filter is full");
}
+rocksdb::Status CuckooChain::Delete(engine::Context &ctx, const Slice &user_key, const Slice &item, bool *deleted) {
+ *deleted = false;
+ std::string ns_key = AppendNamespacePrefix(user_key);
+
+ CuckooChainMetadata metadata(false);
+ auto s = getCuckooChainMetadata(ctx, ns_key, &metadata);
+ if (s.IsNotFound()) return rocksdb::Status::NotFound("Not found");
+ if (!s.ok()) return s;
Review Comment:
CF.DEL should be RedisBloom-compatible: when the key does not exist, RedisBloom returns integer 0 (no error). Returning rocksdb::Status::NotFound here causes the command layer to emit an error instead of 0, and also diverges from how BloomChain::MExists handles missing keys (returns OK + false).
This issue also appears on line 197 of the same file.
##########
tests/gocase/unit/type/bloom/cuckoo_filter_test.go:
##########
@@ -107,6 +107,42 @@ func TestCuckooFilter(t *testing.T) {
require.Error(t, rdb.Do(ctx, "cf.add", "key", "item1", "item2").Err())
})
+ t.Run("Del wrong number of arguments", func(t *testing.T) {
+ require.Error(t, rdb.Do(ctx, "cf.del").Err())
+ require.Error(t, rdb.Do(ctx, "cf.del", "key_only").Err())
+ require.Error(t, rdb.Do(ctx, "cf.del", "key", "item1", "item2").Err())
+ })
+
+ t.Run("Del missing key", func(t *testing.T) {
+ key := "test_cuckoo_filter_del_missing"
+ require.NoError(t, rdb.Del(ctx, key).Err())
+ require.ErrorContains(t, rdb.Do(ctx, "cf.del", key, "item").Err(), "Not found")
+ })
Review Comment:
RedisBloom CF.DEL returns integer 0 when the key does not exist; it should not return a "Not found" error. This test currently asserts the opposite and will lock in incompatible behavior.
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(CuckooFilter): add cf.del command [kvrocks]
Posted by "nagisa-kunhah (via GitHub)" <gi...@apache.org>.
nagisa-kunhah commented on code in PR #3567:
URL: https://github.com/apache/kvrocks/pull/3567#discussion_r4124942164
##########
tests/gocase/unit/type/bloom/cuckoo_filter_test.go:
##########
@@ -107,6 +107,42 @@ func TestCuckooFilter(t *testing.T) {
require.Error(t, rdb.Do(ctx, "cf.add", "key", "item1", "item2").Err())
})
+ t.Run("Del wrong number of arguments", func(t *testing.T) {
+ require.Error(t, rdb.Do(ctx, "cf.del").Err())
+ require.Error(t, rdb.Do(ctx, "cf.del", "key_only").Err())
+ require.Error(t, rdb.Do(ctx, "cf.del", "key", "item1", "item2").Err())
+ })
+
+ t.Run("Del missing key", func(t *testing.T) {
+ key := "test_cuckoo_filter_del_missing"
+ require.NoError(t, rdb.Del(ctx, key).Err())
+ require.ErrorContains(t, rdb.Do(ctx, "cf.del", key, "item").Err(), "Not found")
+ })
+
+ t.Run("Del wrong type", func(t *testing.T) {
+ key := "test_cuckoo_filter_del_wrong_type"
+ require.NoError(t, rdb.Set(ctx, key, "value", 0).Err())
+ require.ErrorContains(t, rdb.Do(ctx, "cf.del", key, "item").Err(), "WRONGTYPE")
+ })
+
+ t.Run("Del basic", func(t *testing.T) {
Review Comment:
Sure, I have add C++ test `DeleteSpansMultipleSubFilters` and go test `Del duplicates across multiple sub-filters` for this.
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(CuckooFilter): add cf.del command [kvrocks]
Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu commented on PR #3567:
URL: https://github.com/apache/kvrocks/pull/3567#issuecomment-5313223777
Regarding the background task, I think your overall design looks reasonable. I have a few thoughts:
1. I don't think the compaction operation is very urgent. We could add a debounce mechanism, for example, delaying it by 5 minutes, to avoid triggering multiple compactions after several modifications within a short period.
2. I think we should investigate how long the lock will be held during compaction. A short lock is acceptable, but if compaction may hold the lock for a long time, we should consider whether to add some additional fields to the data structure to support the GC process.
3. Regarding the issue of the task being lost after a restart, could we provide an explicit command that allows users to manually trigger the compaction?
PS: We can open a separate discussion or issue to discuss this further.
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(CuckooFilter): add cf.del command [kvrocks]
Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu commented on PR #3567:
URL: https://github.com/apache/kvrocks/pull/3567#issuecomment-5161672354
@nagisa-kunhah Let's leave this out for now. We can implement background compaction in a follow-up PR. Thanks for catching this.
PS: when the key does not exist, RedisBloom returns a `Not found` error, while this PR currently returns success.
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(CuckooFilter): add cf.del command [kvrocks]
Posted by "nagisa-kunhah (via GitHub)" <gi...@apache.org>.
nagisa-kunhah commented on PR #3567:
URL: https://github.com/apache/kvrocks/pull/3567#issuecomment-5306209274
Hi @jihuayu , sorry for the delay — this PR is ready for review now. For the background compaction, I've put some draft thoughts above. I know this might take a bit of your time, but I'd really appreciate your advice on it. Thanks!
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(CuckooFilter): add cf.del command [kvrocks]
Posted by "nagisa-kunhah (via GitHub)" <gi...@apache.org>.
nagisa-kunhah commented on code in PR #3567:
URL: https://github.com/apache/kvrocks/pull/3567#discussion_r4124530168
##########
tests/cppunit/types/cuckoo_filter_test.cc:
##########
@@ -743,3 +783,164 @@ TEST_F(RedisCuckooFilterTest, ExpansionWritesNewFilterIndexPage) {
ASSERT_TRUE(s.ok()) << s.ToString();
EXPECT_EQ(page.size(), expected_page_size);
}
+
+TEST_F(RedisCuckooFilterTest, DeleteMissingKeyReturnsNotFound) {
+ bool deleted = true;
+ auto s = cuckoo_->Delete(*ctx_, key_, "missing", &deleted);
+ EXPECT_TRUE(s.IsNotFound()) << s.ToString();
+ EXPECT_NE(s.ToString().find("Not found"), std::string::npos);
+}
+
+TEST_F(RedisCuckooFilterTest, DeleteBasicClearsOneItem) {
+ reserveAndVerify(key_, 1000, 4, 500, 2);
+ addAndVerify(key_, "item", 1000, 4, 500, 2, 1);
+
+ bool deleted = false;
+ auto s = cuckoo_->Delete(*ctx_, key_, "item", &deleted);
+ ASSERT_TRUE(s.ok()) << s.ToString();
+ EXPECT_TRUE(deleted);
+ verifyMetadata(key_, 1000, 4, 500, 2, 0, 1, 1);
+
+ deleted = true;
+ s = cuckoo_->Delete(*ctx_, key_, "item", &deleted);
+ ASSERT_TRUE(s.ok()) << s.ToString();
+ EXPECT_FALSE(deleted);
+ verifyMetadata(key_, 1000, 4, 500, 2, 0, 1, 1);
+}
+
+TEST_F(RedisCuckooFilterTest, DeleteDuplicateItemsOneAtATime) {
+ reserveAndVerify(key_, 1000, 4, 500, 2);
+ for (int i = 0; i < 3; ++i) {
+ addAndVerify(key_, "duplicate", 1000, 4, 500, 2, i + 1);
+ }
+
+ for (int i = 0; i < 3; ++i) {
+ bool deleted = false;
+ auto s = cuckoo_->Delete(*ctx_, key_, "duplicate", &deleted);
+ ASSERT_TRUE(s.ok()) << s.ToString();
+ EXPECT_TRUE(deleted);
+ verifyMetadata(key_, 1000, 4, 500, 2, 2 - i, 1, i + 1);
+ }
+
+ bool deleted = true;
+ auto s = cuckoo_->Delete(*ctx_, key_, "duplicate", &deleted);
+ ASSERT_TRUE(s.ok()) << s.ToString();
+ EXPECT_FALSE(deleted);
+ verifyMetadata(key_, 1000, 4, 500, 2, 0, 1, 3);
+}
Review Comment:
Thanks for your advice. Yes, these tests duplicate what go test does, so I’ve removed them.
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(CuckooFilter): add cf.del command [kvrocks]
Posted by "nagisa-kunhah (via GitHub)" <gi...@apache.org>.
nagisa-kunhah commented on PR #3567:
URL: https://github.com/apache/kvrocks/pull/3567#issuecomment-5875111657
> ## Pull request overview
>
> Adds RedisBloom-compatible Cuckoo Filter deletion support by introducing a new `CF.DEL` command and the underlying delete path in the Cuckoo filter storage implementation.
>
> **Changes:**
>
> * Add `cf.del` command plumbing and command registration.
>
> * Implement deletion of a single matching fingerprint occurrence within `CuckooChain`/`CuckooSubFilter`.
>
> * Improve page persistence by deleting/omitting fully-empty cuckoo pages, and add Go/C++ tests around delete behavior and page writeback.
>
>
> ### Reviewed changes
>
> Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
> Show a summary per file
>
>
>
>
>
>
>
>
>
>
>
>
> Suppressed comments (1)
>
>
> 💡 [Add a `code-review` agent skill](/apache/kvrocks/new/unstable?filename=.github/skills/code-review/SKILL.md) or configure MCP servers for context-aware, tailored reviews. [Learn more in the docs.](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review#mcp-servers-and-agent-skills)
All the comments from Copilot point to the same issue: it assumes RedisBloom returns `0` when deleting from a non-existent key, while our implementation reports `Not found`. But RedisBloom actually returns a `Not found` error in this case , so our behavior is already compatible. I think there's nothing to solve here.
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(CuckooFilter): add cf.del command [kvrocks]
Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu merged PR #3567:
URL: https://github.com/apache/kvrocks/pull/3567
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(CuckooFilter): add cf.del command [kvrocks]
Posted by "nagisa-kunhah (via GitHub)" <gi...@apache.org>.
nagisa-kunhah commented on PR #3567:
URL: https://github.com/apache/kvrocks/pull/3567#issuecomment-5152182677
Hi @jihuayu, while implementing `CF.DEL`, I found that the automatic compaction path may introduce serious worker-blocking and OOM risks. Currently, it scans all logical buckets of a sub‑filter and loads every page into `CuckooPageCache`, including zero‑filled pages for missing keys. Thus, a large sparse sub‑filter can make a single `CF.DEL` perform work and allocate memory proportional to its logical capacity.
We seek feedback on whether compaction should be part of this PR. Two options:
1. **Land `CF.DEL` without automatic compaction for now.**
Only remove fingerprint and update metadata. Semantics are preserved, but deleted slots and extra sub‑filters remain, causing space and lookup amplification.
2. **Move compaction to bounded, incremental background maintenance.**
Use Kvrocks’ `TaskRunner` (used by `AsyncCompactDB`, `AsyncScanDBSize`, etc.) with cursor‑based scanning. Process a bounded number of actually stored pages per slice, commit a bounded write batch, release cache and locks, and requeue if more work remains. Requires actual‑page iteration, bounded cache/batch, deduplication, synchronization, and crash‑safe progress tracking.
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(CuckooFilter): add cf.del command [kvrocks]
Posted by "nagisa-kunhah (via GitHub)" <gi...@apache.org>.
nagisa-kunhah commented on PR #3567:
URL: https://github.com/apache/kvrocks/pull/3567#issuecomment-5306198245
# CF.DEL Background Compaction
`CF.DEL` must not compact a complete logical sub-filter on the request path. A large sparse filter can have very few RocksDB pages but a huge logical page range, so a full logical scan can block a worker and materialize excessive page-cache memory.
## Compaction
For the current tail `Fn`, compact oldest targets first:
```text
Fn -> F0
remaining Fn -> F1
...
remaining Fn -> F(n - 1)
verify Fn
```
For each non-zero fingerprint in `Fn`, try direct insertion into the two candidate buckets of the current target. If insertion succeeds, write the target fingerprint and clear the source fingerprint in one `WriteBatch`. Do not use Cuckoo kick-out relocation during compaction.
Scan `Fn` through its persisted page-key prefix, so sparse filters do not trigger reads for absent logical pages. Delete a source page key when its page becomes all zero.
One `Fn -> Fi` pass holds the existing logical-key lock. It may flush bounded page batches while keeping that lock. After a pass completes, release the lock, then start the next target pass. If `Fn` is empty after all targets were tried, decrement `n_filters`. If that exposes another tail, continue with it in the same task.
## Task execution and deduplication
A successful `CF.DEL` schedules compact work when the chain has more than one sub-filter and delete debt exceeds the compact threshold. The task carries:
| Field | Description |
|---|---|
| `namespace` and `user_key` | Reconstruct the Cuckoo Filter in the background callback. |
| `ns_key` | Lock key and task-key input. |
| `metadata_version` | Reject a key that was deleted and recreated before the task starts. |
`TaskRunner` should gain a generic keyed API:
```cpp
StatusOr<bool> TryPublishUnique(std::string task_key, Task task);
```
The compact task key is:
```text
cuckoo-compact:<ns_key>:<metadata_version>
```
`TaskRunner` keeps active task keys in memory. The same key is queued only once while it is queued or running. It removes the key when the callback returns, rolls it back if queueing fails, and clears all keys when `Join()` clears the queue.
The callback locks `ns_key`, rereads metadata, and exits if `metadata_version` no longer matches. A restart drops queued work and active task keys. It does not resume compact work. A later qualifying `CF.DEL` can schedule a new best-effort task.
## Trade-offs
- A full `Fn -> Fi` pass can delay foreground writes for that key.
- One tail is scanned once per older target, and target bucket reads can be random.
- `CF.ADD` between target passes can make the current cycle less effective, but cannot make tail removal unsafe because the final empty check is locked.
- `TaskRunner` is shared and single-threaded by default, so long compact tasks can delay other background work.
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(CuckooFilter): add cf.del command [kvrocks]
Posted by "nagisa-kunhah (via GitHub)" <gi...@apache.org>.
nagisa-kunhah commented on code in PR #3567:
URL: https://github.com/apache/kvrocks/pull/3567#discussion_r4124570851
##########
src/types/redis_cuckoo_chain.h:
##########
@@ -62,6 +65,8 @@ class CuckooChain : public Database {
bool *inserted);
rocksdb::Status commitSubFilterAndMetadata(engine::Context &ctx, const Slice &user_key, const std::string &ns_key,
CuckooChainMetadata *metadata, CuckooSubFilter *sub_filter);
+ rocksdb::Status commitDelete(engine::Context &ctx, const Slice &user_key, const std::string &ns_key,
Review Comment:
Thanks for the reminder. I've dropped `commitDelete` and now use `commitSubFilterAndMetadata` for all commits. And I define a constant tag (`kCFLogDataAdd` / `kCFLogDataDel`) to distinguish different operations.
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org