Fix reference counting bug in MmapPreciseFile. - #14085
Open
copybara-service[bot] wants to merge 1 commit into
Open
Fix reference counting bug in MmapPreciseFile.#14085copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
test/cl963070876
branch
2 times, most recently
from
August 13, 2026 00:16
57dbd55 to
a36a143
Compare
This change fixes a bug in the reference counting logic of MmapPreciseFile that could lead to an undercount of references. Previously, `MmapPreciseFile.IncRef` used `refsSet.Insert`, which could prematurely merge a newly inserted segment with an adjacent existing segment. This caused the loop cursor to advance too far, skipping the reference increment for the existing segment. `InsertWithoutMerging` ensures the loop correctly processes the inserted segment and properly increments adjacent segments on subsequent iterations. PiperOrigin-RevId: 963070876
copybara-service
Bot
force-pushed
the
test/cl963070876
branch
from
August 13, 2026 00:41
a36a143 to
36fbfe9
Compare
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.
Fix reference counting bug in MmapPreciseFile.
This change fixes a bug in the reference counting logic of MmapPreciseFile
that could lead to an undercount of references. Previously,
MmapPreciseFile.IncRefusedrefsSet.Insert, which could prematurely mergea newly inserted segment with an adjacent existing segment. This caused the
loop cursor to advance too far, skipping the reference increment for the
existing segment.
InsertWithoutMergingensures the loop correctly processes the insertedsegment and properly increments adjacent segments on subsequent iterations.