Skip to content

Harden binary fuse filter - #5202

Merged
SirTyson merged 3 commits into
stellar:masterfrom
SirTyson:harden-binary-fuse-filter
Apr 15, 2026
Merged

SirTyson merged 3 commits into
stellar:masterfrom
SirTyson:harden-binary-fuse-filter

Conversation

@SirTyson

@SirTyson SirTyson commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Description

This fixes a bug in the binary fuse filter, where very occasionally we would corrupt a value in the index. Specifically, the last element in reverseOrder is a sentinel value that should never be reset, even in the case of underflow error. However, when underflow error occurred, we would reset the entire vector, including the sentinel.

The first commit fixes this issue. The 2nd commit adds code coverage support (shamelessly stolen from @graydon #5012) and uses it to add more comprehensive unit tests for edge cases, including the sentinel issue.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

Copilot AI 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.

Pull request overview

This PR hardens the Binary Fuse filter population/retry logic (fixing a sentinel-reset corruption case) and adds a lightweight “coverage mark” mechanism plus targeted unit tests to exercise rare retry paths deterministically.

Changes:

  • Fix reverseOrder reset behavior to avoid clearing the sentinel during retry/reset paths.
  • Introduce CovMark infrastructure (COVMARK_HIT / COVMARK_CHECK_HIT_IN_CURR_SCOPE) to assert execution of rare internal paths from tests.
  • Add BinaryFuseFilter unit tests covering error retry, peeling failure retry, and duplicate-removal paths; remove DiskIndex’s legacy retry workaround.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/util/test/BinaryFuseTests.cpp Adds tests that force rare BinaryFuseFilter populate/retry paths and assert they were hit.
src/test/CovMark.h Defines the coverage-mark API, counters, and RAII guard used by tests.
src/test/CovMark.cpp Defines the global coverage counter storage for test builds.
src/bucket/DiskIndex.cpp Removes the previous retry-on-out_of_range workaround when constructing the filter.
lib/binaryfusefilter.h Implements sentinel-safe reset, adds test forcing hooks, and emits coverage marks in retry/duplicate paths.

Comment thread src/util/test/BinaryFuseTests.cpp Resolved
Comment thread src/test/CovMark.h Resolved
Comment thread lib/binaryfusefilter.h Resolved
Comment thread lib/binaryfusefilter.h Resolved
Comment thread src/util/test/BinaryFuseTests.cpp Resolved
Comment thread src/util/test/BinaryFuseTests.cpp Resolved
@SirTyson
SirTyson force-pushed the harden-binary-fuse-filter branch from bc7795f to 2fdc666 Compare April 2, 2026 21:41
Comment thread src/util/test/BinaryFuseTests.cpp Resolved
@SirTyson
SirTyson force-pushed the harden-binary-fuse-filter branch from 2fdc666 to 246acdc Compare April 3, 2026 17:48
@SirTyson
SirTyson requested a review from graydon April 15, 2026 21:23
@SirTyson
SirTyson force-pushed the harden-binary-fuse-filter branch from b603724 to ee9270c Compare April 15, 2026 21:48
@SirTyson
SirTyson added this pull request to the merge queue Apr 15, 2026
Merged via the queue into stellar:master with commit 17a3c5f Apr 15, 2026
49 of 52 checks passed
@SirTyson
SirTyson deleted the harden-binary-fuse-filter branch April 15, 2026 23:29
@SirTyson SirTyson mentioned this pull request Apr 16, 2026
5 of 6 tasks
github-merge-queue Bot pushed a commit that referenced this pull request Apr 16, 2026
# Description

Fixes build issue from #5202

# Checklist
- [x] Reviewed the
[contributing](https://github.com/stellar/stellar-core/blob/master/CONTRIBUTING.md#submitting-changes)
document
- [x] Rebased on top of master (no merge commits)
- [x] Ran `clang-format` v8.0.0 (via `make format` or the Visual Studio
extension)
- [x] Compiles
- [x] Ran all tests
- [ ] If change impacts performance, include supporting evidence per the
[performance
document](https://github.com/stellar/stellar-core/blob/master/performance-eval/performance-eval.md)
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.

4 participants