Skip to content

feat(blockstore): expose BloomCacheStatus and add bloom filter Rebuild#1184

Open
guillaumemichel wants to merge 3 commits into
fix/bloom-incomplete-buildfrom
feat/bloom-cache-status-rebuild
Open

feat(blockstore): expose BloomCacheStatus and add bloom filter Rebuild#1184
guillaumemichel wants to merge 3 commits into
fix/bloom-incomplete-buildfrom
feat/bloom-cache-status-rebuild

Conversation

@guillaumemichel

Copy link
Copy Markdown
Member

Builds on top of #1183, which stops the Bloom filter cache from activating
after an incomplete AllKeysChan enumeration and adds the (unexported)
capability to report a truncated enumeration.

This PR makes that machinery observable and recoverable from outside the
package:

  • Exports the capability as AllKeysChanWithErrer (AllKeysChanWithErr),
    so any Blockstore can report an error that truncated AllKeysChan
    enumeration, and callers can detect it. Forwarded through the same layers as
    in fix(blockstore): don't activate bloom cache if build incomplete #1183 (bloomcache, tqcache, idstore, ValidatingBlockstore); stores that
    don't implement it fall back to today's best-effort behavior.

  • Adds BloomCacheStatus (Wait / BloomActive / Rebuild), implemented
    by the value CachedBlockstore returns when a Bloom filter is configured.
    Wait/BloomActive existed but were unreachable on the unexported cache
    type; they're now part of an exported interface, so callers can wait for and
    observe the async initial build.

  • Adds Rebuild, to retry after a failed initial build (observable via
    Wait) or refresh a healthy filter. The rebuild runs live: the current
    filter stays active and correct throughout, concurrent writes are mirrored
    into the replacement, and the new filter is swapped in atomically only once a
    complete enumeration proves it authoritative. A failed or cancelled rebuild
    leaves the existing filter in place.

No behavior change for existing callers; all additions are opt-in via the new
interfaces.

@guillaumemichel guillaumemichel requested a review from a team as a code owner July 3, 2026 15:37
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.69767% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.75%. Comparing base (bbf07ab) to head (551d074).

Files with missing lines Patch % Lines
blockstore/bloom_cache.go 88.88% 3 Missing and 1 partial ⚠️

Impacted file tree graph

@@                      Coverage Diff                       @@
##           fix/bloom-incomplete-build    #1184      +/-   ##
==============================================================
- Coverage                       63.75%   63.75%   -0.01%     
==============================================================
  Files                             269      269              
  Lines                           27027    27047      +20     
==============================================================
+ Hits                            17232    17243      +11     
- Misses                           8081     8086       +5     
- Partials                         1714     1718       +4     
Files with missing lines Coverage Δ
blockstore/blockstore.go 56.02% <100.00%> (ø)
blockstore/caching.go 100.00% <ø> (ø)
blockstore/idstore.go 68.25% <100.00%> (ø)
blockstore/twoqueue_cache.go 72.46% <100.00%> (ø)
blockstore/validating_blockstore.go 66.66% <100.00%> (ø)
blockstore/bloom_cache.go 73.10% <88.88%> (+3.50%) ⬆️

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gammazero gammazero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything here looks good.

While not necessary for this PR, it would be if bloomcache.active was changed to a atomic.Bool type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants