Repository navigation
MOD-16050 - CF.LOADCHUNK: replicate data chunks (fix silent CF data loss on failover) - #1014
Merged
Merged
Conversation
…oss on failover) CFLoadChunk_RedisCommand only replicated the header chunk (pos == 1). The data chunks were applied on the primary but never propagated to replicas / AOF, so a replica of a CF.LOADCHUNK-restored cuckoo filter ended up with correct metadata (CF.INFO reports the full item count) but empty buckets. The divergence was silent - master_link_status:up, equal replication offsets and matching CF.INFO - until a failover promoted the replica, at which point every CF.EXISTS missed (a cuckoo filter has no false negatives, so this is real data loss). Add RedisModule_ReplicateVerbatim to the data-chunk branch, mirroring BFLoadChunk_RedisCommand. The RDB/DUMP/RESTORE path was already correct, so a full resync heals an affected replica; this fix closes the incremental replication gap. Includes a replication regression test that builds a filter via CF.LOADCHUNK on the primary and asserts all members are present on the replica. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
gabsow
force-pushed
the
tom.gabsow/MOD-16050-cf-loadchunk-replicate
branch
from
June 3, 2026 08:24
3da635f to
a8d0991
Compare
|
This was referenced Jun 3, 2026
AvivDavid23
approved these changes
Jun 3, 2026
4 tasks
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Problem
CF.LOADCHUNKonly replicates the header chunk (pos == 1). The subsequent data chunks are applied on the primary but never propagated to replicas / AOF.A replica of a cuckoo filter that was restored via
CF.SCANDUMP/CF.LOADCHUNKtherefore ends up with correct metadata (CF.INFOreports the fullNumber of items inserted) but empty buckets. The divergence is silent —master_link_status:up, equalmaster_repl_offset/slave_repl_offset, and matchingCF.INFOall look healthy — until a failover promotes the replica, at which point everyCF.EXISTSmisses. A cuckoo filter has no false negatives, so this is real, total data loss for that key.BFLoadChunk_RedisCommand(Bloom) already replicates its data chunks;CFLoadChunk_RedisCommand(Cuckoo) was missing the call.Fix
Add
RedisModule_ReplicateVerbatim(ctx)to the data-chunk branch ofCFLoadChunk_RedisCommand, mirroring the Bloom path.The RDB /
DUMP/RESTORE/ full-sync path was already correct (so a full resync heals an affected replica); this closes the incremental replication gap.Reproduction (stock OSS Redis, primary + replica)
Build one filter via
CF.ADD(control) and one viaCF.LOADCHUNKon the primary,WAIT 1, then read both on the replica:CF.ADD-built key -> 0 missing.CF.LOADCHUNK-built key -> 100% missing, while replicaCF.INFOstill reports the full inserted count.Also reproduced on a 3-node Redis Enterprise cluster (promoted replica serves an empty filter). Verified the fix: with the change, the
CF.LOADCHUNK-built key replicates fully.Test
Adds
test_cf_loadchunk_replicates_to_replica(replicated env): builds a multi-sub-filter CF viaCF.LOADCHUNKon the primary,WAITs, and asserts every member is present on the replica. Verified the test fails on the unpatched build (2000/2000 missing) and passes with the fix. Fulltest_cuckoo.pysuite green (31/31) with--enable-debug-command.Jira: MOD-16050
Note
High Risk
Fixes silent total data loss on replica failover for CF.LOADCHUNK-restored keys; change is a one-line replication call aligned with Bloom, but the failure mode was security/data-critical.
Overview
CF.LOADCHUNKnow callsRedisModule_ReplicateVerbatimafter each successful data chunk load (pos != 1), matchingBF.LOADCHUNKand the existing header-chunk path. Without this, replicas could show correctCF.INFOcounts but empty buckets after incremental restore, causing total membership loss after failover.A new master/replica test builds a multi-chunk filter via
CF.SCANDUMP/CF.LOADCHUNK, waits for replication, and asserts every member exists on the replica withCF.EXISTS.Reviewed by Cursor Bugbot for commit a8d0991. Bugbot is set up for automated code reviews on this repo. Configure here.