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

SegmentSet.Add allow missing LastOffset #360

Merged
merged 1 commit into from
Jan 23, 2024
Merged

Conversation

psFried
Copy link
Contributor

@psFried psFried commented Jan 23, 2024

Allows adding a "covering" segment to a SegmentSet. Given an non-empty set, this permits adding a segment that completely covers a subset of existing segments and has LastOffset: 0. This is needed in order to reduce backup and primary hints into the same set, which is needed by shards prune in order to prune recovery logs conservatively.

I realized that the other fix is truly not necessary, because the existing behavior of zeroing the final segment of each set of hints is retained, and serves the same purpose.

With this change, I'm able to successfully dry-run pruning all the shards in Estuary's production environment.


This change is Reviewable

Copy link
Contributor

@jgraettinger jgraettinger left a comment

Choose a reason for hiding this comment

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

LGTM, but can we also remove this ?

@psFried
Copy link
Contributor Author

psFried commented Jan 23, 2024

LGTM, but can we also remove this ?

I can update the comment, but my understanding is that the code to zero out the LastOffset is still required. The set prefers to keep a non-zero offset over a zero'd offset in certain cases, as shown by this test case. So I'm thinking we need to keep that code in order to guarantee the behavior that we don't prune any fragments after the greatest LastOffset from the earliest backup hints.

Allows adding a "covering" segment to a `SegmentSet`. Given an non-empty set,
this permits adding a segment that completely covers a subset of existing
segments and has `LastOffset: 0`.  This is needed in order to reduce backup and
primary hints into the same set, which is needed by `shards prune` in order to
prune recovery logs conservatively.
@psFried psFried merged commit e2cace3 into master Jan 23, 2024
1 check passed
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.

2 participants