Skip to content

Fix reference counting bug in MmapPreciseFile. - #14085

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test/cl963070876
Open

Fix reference counting bug in MmapPreciseFile.#14085
copybara-service[bot] wants to merge 1 commit into
masterfrom
test/cl963070876

Conversation

@copybara-service

Copy link
Copy Markdown

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

@copybara-service copybara-service Bot added the exported Issue was exported automatically label Aug 12, 2026
@copybara-service
copybara-service Bot force-pushed the test/cl963070876 branch 2 times, most recently from 57dbd55 to a36a143 Compare August 13, 2026 00:16
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant