#36234 util: avoid redundant rolling Bloom insertions
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #36234 util: avoid redundant rolling Bloom insertions | Ready | 0 | Crickets | 22 + 52 tests | |||
|
|
|
|
| |||
Reviewability: ReadyStalePaused Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs. Size: lines added or modified outside tests, then in tests; greener = smaller. | |||||||
Goal
Skip advancing generation counters and rotating when re-inserting an element already present in the current generation of a CRollingBloomFilter. Computed hash values are cached in a stack array during the membership check so insertion does not recompute them.
Problem: Inserting the same item repeatedly increments the generation entry counter without adding new membership data. This causes the rolling filter to rotate generations prematurely, expiring older, unrelated entries earlier than its configured capacity guarantees.
Evidence of importance:
- PR description: "Re-inserting a value already represented by the current generation advances its entry counter without adding membership information. Repeating one value can therefore expire unrelated entries sooner than the configured capacity implies."
Reviewability
Ready
Nothing known that would invalidate a review now.
Waiting on (from the thread read):
- reviewer: review of author's reply and demonstration 2026-10-22
- reviewer: review of the author's reply and demonstration 2026-10-22
Agreement
Crickets
no substantive comment either way
Thread notes: Recorded instagibbs' question about real-world usage patterns, which was answered by author JeremyRubin with a reproduction script showing filter wiping. / Added instagibbs's question and recorded the author's reply showing a test case demonstrating filter wiping.
Objections, suggestions, and questions:
| Reviewer | Type | Harm, request, or question | Status | Must be | Author replied | Quote |
|---|---|---|---|---|---|---|
| instagibbs (member) | question, usefulness | Whether there are worrying usage patterns seen in practice that this resolves, or if it is a general correctness issue noticed | answered · author replied demonstrating how repeated announcements can wipe the known-tx filter | answered | yes | 2026-09-14: 'Are there any worrying usage patterns that you've seen this resolves, or is this more of a general correctness issue that was noticed?' Status from: 2026-10-22: JeremyRubin: 'Yes, this allows for somewhat trivially wiping the known-tx filter.' |
Participants:
- instagibbs (member, question, 1 statements 2026-09-14 to 2026-09-14): asked whether this resolves worrying usage patterns seen in practice or is a general correctness fix
Files
52 lines under test/bench/ci.
- src/test/bloom_tests.cpp +52/-0
- src/common/bloom.cpp +20/-3
- src/common/bloom.h +2/-0
Card
The short text the ranking pass compares across PRs.
CRollingBloomFilter is modified to detect whether an inserted element is already represented in the current generation, avoiding redundant entry counter increments and filter rotations. Currently, repeatedly inserting the same value advances generations and purges unrelated entries prematurely. Re-inserting elements from older generations continues to consume capacity and refresh their retention.
Data
thread read through 2026-10-22 (2 statements), head 25ce2fa1f6
labels: Utils/log/libs
Categories
Utilities (logging, arguments, libraries)
P3 · bug fix (ranking pass: Moved up: premature rotation breaks the capacity guarantee of a widely used primitive.)
Prevents CRollingBloomFilter from rotating generations prematurely when duplicate items are inserted. As described, 'Re-inserting a value already represented by the current generation advances its entry counter without adding membership information,' causing earlier expiration of unrelated entries than configured.
Membership: Matches the Utils/log/libs label and changes CRollingBloomFilter implementation in src/common/bloom.cpp.
Factors: security/stability 1, bug 1, performance 1, user value 0, leverage 0