Skip to content

MB-71041: avoid updating root.bolt with in-memory segment's data#2296

Merged
abhinavdangeti merged 4 commits into
masterfrom
commitProtocol
Mar 31, 2026
Merged

MB-71041: avoid updating root.bolt with in-memory segment's data#2296
abhinavdangeti merged 4 commits into
masterfrom
commitProtocol

Conversation

@Thejas-bhat
Copy link
Copy Markdown
Member

@Thejas-bhat Thejas-bhat commented Mar 18, 2026

In-memory segments are volatile and in scenarios where index is closed and opened back, we must ensure that only data corresponding to the on-disk, persisted segments are loaded and retained.
This PR fixes a bug where the indexSnapshot.internal would potentially end up having data corresponding to the in-memory segments which technically means we've corrupted the index with non-existent data. This also fixes the bug where we would also record the segment's deleted bitmap, stats and updatedFields info in the bolt metadata file, which is incorrect.

@abhinavdangeti abhinavdangeti added this to the v2.6.0 milestone Mar 19, 2026
@abhinavdangeti abhinavdangeti changed the title introduce the concept of a soft and hard commit MB-71041: introduce the concept of a soft and hard commit Mar 19, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 30, 2026

Coverage Status

coverage: 52.534% (+0.03%) from 52.502%
when pulling c781f28 on commitProtocol
into 0d388d7 on master.

@Thejas-bhat Thejas-bhat changed the title MB-71041: introduce the concept of a soft and hard commit MB-71041: ensure that only persisted segment's data is updated in bolt Mar 30, 2026
Comment thread index/scorch/snapshot_segment.go Outdated
Comment thread index/scorch/persister.go Outdated
Copy link
Copy Markdown
Member

@abhinavdangeti abhinavdangeti left a comment

Choose a reason for hiding this comment

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

Some nit-picks, also I believe you'll push up another patch here with a unit test :)

Copy link
Copy Markdown
Member

@abhinavdangeti abhinavdangeti left a comment

Choose a reason for hiding this comment

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

Hope the unit test fails without the fix? :)

Comment thread index/scorch/snapshot_segment.go Outdated
Comment thread index/scorch/persister.go Outdated
@Thejas-bhat Thejas-bhat force-pushed the commitProtocol branch 2 times, most recently from 82b119a to b7025c1 Compare March 31, 2026 00:27
Comment thread index/scorch/persister.go Outdated
Comment thread index/scorch/scorch_test.go
abhinavdangeti
abhinavdangeti previously approved these changes Mar 31, 2026
Copy link
Copy Markdown
Member

@abhinavdangeti abhinavdangeti left a comment

Choose a reason for hiding this comment

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

Thank you @Thejas-bhat 👍🏼

@Thejas-bhat Thejas-bhat changed the title MB-71041: ensure that only persisted segment's data is updated in bolt MB-71041: avoid updating root.bolt with in-memory segment's data Mar 31, 2026
@abhinavdangeti abhinavdangeti merged commit 35391dd into master Mar 31, 2026
10 checks passed
@abhinavdangeti abhinavdangeti deleted the commitProtocol branch March 31, 2026 22:29
Thejas-bhat added a commit that referenced this pull request Mar 31, 2026
…ta (#2296)

In-memory segments are volatile and in scenarios where index is closed
and opened back, we must ensure that only data corresponding to the
on-disk, persisted segments are loaded and retained.
This PR fixes a bug where the `indexSnapshot.internal` would potentially
end up having data corresponding to the in-memory segments which
technically means we've corrupted the index with non-existent data. This
also fixes the bug where we would also record the segment's deleted
bitmap, stats and updatedFields info in the bolt metadata file, which is
incorrect.
ns-codereview pushed a commit to couchbase/cbft that referenced this pull request Apr 1, 2026
This reverts commit c24d0f0 and comes along with the fix blevesearch/bleve#2296

Change-Id: Ia55e0296e83603797a441da32b818407d39df4e4
Reviewed-on: https://review.couchbase.org/c/cbft/+/242697
Reviewed-by: Abhi Dangeti <abhinav@couchbase.com>
Tested-by: <thejas.orkombu@couchbase.com>
Well-Formed: Build Bot <build@couchbase.com>
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.

3 participants