Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v23.2.x] segment_meta_cstore: handle gaps and overlaps #14954

Conversation

vbotbuildovich
Copy link
Collaborator

Backport of PR #14856

Vlad Lazar and others added 3 commits November 14, 2023 04:38
There were two issues with the `insert_entries` method
1. It could not handle insertions in a previously created gap. This is
   because it used the `find` method, which requires an exact match with
   an existing segment, in order to determine if the insert should go
   somewhere in the middle of the cstore or at the end.
2. It did the merging in terms of the committed offset. This could
   result in the merge having out of order base offsets, which, in turn,
   causes the encoder to assert out.

Fixes are as follows:
1. Instead of using `find`, use lower_bound with the incoming base_offset,
   to handle gaps in the pre-existing store.
2. Use base offset comparison when doing the merge, to allow for
   overlaps.

(cherry picked from commit 0c2bee3)
this is mostly to make the code easier to navigate with the ide

(cherry picked from commit 25da8e9)
like insert_entries, update the logic to erase replaced segments to
allow for overlaps. before, the code would search of the first segment
completely after the range covered by the new segment. now it searches
for the first segment that ends after the range covered by the new
segment.

(cherry picked from commit 98899a9)
@vbotbuildovich vbotbuildovich added this to the v23.2.x-next milestone Nov 14, 2023
@vbotbuildovich vbotbuildovich added the kind/backport PRs targeting a stable branch label Nov 14, 2023
@piyushredpanda piyushredpanda marked this pull request as ready for review November 14, 2023 08:22
@piyushredpanda piyushredpanda modified the milestones: v23.2.x-next, v23.2.16 Nov 14, 2023
@piyushredpanda piyushredpanda merged commit 8d33fbc into redpanda-data:v23.2.x Nov 14, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/redpanda kind/backport PRs targeting a stable branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants