You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up on review feedback for PR #3627, which replaces the Current QMDB's layered bitmap with Arc<SharedBitmap<RwLock<BitMap>>>. This PR addresses two small inefficiencies and a coverage gap surfaced in review, without changing the PR's design.
Changes
1. Cache terminal Arc<SharedBitmap> on BitmapBatchLayer (batch.rs)
Add shared: Arc<SharedBitmap<N>> to BitmapBatchLayer. Collapses:
BitmapBatch::shared() from an O(chain-depth) walk to a 2-arm match.
BitmapBatch::pruned_chunks() from an O(chain-depth) walk to self.shared().pruned_chunks().
Cost: 8 bytes per layer + one Arc::clone at construction. The invariant (cached shared equals the chain terminal) is trivial by construction at both sites (compute_current_layer, trim_committed) — each sets the field via Arc::clone(parent.shared()), and BitmapBatch::Base is already the terminal.
Both callers (trim_committed on every new_batch; pruned_chunks once per build_chunk_overlay) are on the per-batch hot path. The walk was redundant after PR #3627's restructuring and is now gone.
Covers the specific scenario: a live parent batch whose new_batch() is called after the DB has advanced its pruning boundary. The internal trim_committed must observe the advanced boundary on the shared bitmap, and the resulting child must merkleize and apply correctly.
Not covered by the existing test_current_live_batch_safe_across_prune, which tests applying a pre-prune child rather than extending a live parent post-prune.
❌ Patch coverage is 98.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.87%. Comparing base (0fc4391) to head (f6947ad). ⚠️ Report is 14 commits behind head on locked-bitmap.
❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
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
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.
Follow-up on review feedback for PR #3627, which replaces the Current QMDB's layered bitmap with
Arc<SharedBitmap<RwLock<BitMap>>>. This PR addresses two small inefficiencies and a coverage gap surfaced in review, without changing the PR's design.Changes
1. Cache terminal
Arc<SharedBitmap>onBitmapBatchLayer(batch.rs)Add
shared: Arc<SharedBitmap<N>>toBitmapBatchLayer. Collapses:BitmapBatch::shared()from an O(chain-depth) walk to a 2-arm match.BitmapBatch::pruned_chunks()from an O(chain-depth) walk toself.shared().pruned_chunks().Cost: 8 bytes per layer + one
Arc::cloneat construction. The invariant (cachedsharedequals the chain terminal) is trivial by construction at both sites (compute_current_layer,trim_committed) — each sets the field viaArc::clone(parent.shared()), andBitmapBatch::Baseis already the terminal.Both callers (
trim_committedon everynew_batch;pruned_chunksonce perbuild_chunk_overlay) are on the per-batch hot path. The walk was redundant after PR #3627's restructuring and is now gone.2. Add
test_current_live_batch_child_after_prune(mod.rs)Covers the specific scenario: a live parent batch whose
new_batch()is called after the DB has advanced its pruning boundary. The internaltrim_committedmust observe the advanced boundary on the shared bitmap, and the resulting child must merkleize and apply correctly.Not covered by the existing
test_current_live_batch_safe_across_prune, which tests applying a pre-prune child rather than extending a live parent post-prune.