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.
Add a test that ensures the
retain_lsn
functionality works. Right now, there is not a single test that is broken if offloaded or non-offloaded timelines don't get registered at their parents, preventing gc from discarding the ancestor_lsns of the children. This PR fills that gap.The test has four modes:
offloaded
: offload the child timeline, run compaction on the parent timeline, unarchive the child timeline, then try reading from it. hopefully the data is still there.offloaded-corrupted
: offload the child timeline, corrupts the manifest in a way that the pageserver believes the timeline was flattened. This is the closest we can get to pretend theretain_lsn
mechanism doesn't exist for offloaded timelines, so we can avoid adding endpoints to the pageserver that do this manually for tests. The test then checks that indeed data is corrupted and the endpoint can't be started. That way we know that the test is actually working, and actually tests theretain_lsn
mechanism, instead of say the lsn lease mechanism, or one of the many other mechanisms that impede gc.archived
: the child timeline gets archived but doesn't get offloaded. this currently matches theNone
case but we might have refactors in the future that make archived timelines sufficiently different from non-archived ones.None
: the child timeline doesn't even get archived. this tests that normal timelines participate inretain_lsn
. I've made them locally not participate inretain_lsn
(via commenting out the respectiveancestor_children.push
statement in tenant.rs) and ran the testsuite, and not a single test failed. So this test is first of its kind.Part of #8088.