-
Notifications
You must be signed in to change notification settings - Fork 408
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
feat(pageserver): add an optional lease to the get_lsn_by_timestamp API #8104
Conversation
Signed-off-by: Yuchen Liang <yuchen@neon.tech>
Signed-off-by: Yuchen Liang <yuchen@neon.tech>
2922 tests run: 2806 passed, 0 failed, 116 skipped (full report)Code coverage* (full report)
* collected from Rust tests only The comment gets automatically updated with the latest test results
022eecc at 2024-06-24T20:06:24.042Z :recycle: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I also peeked at the lease implementation and was surprised the leases are not persisted to disk anywhere. Are we ok with losing them on restart?
Signed-off-by: Yuchen Liang <yuchen@neon.tech>
Signed-off-by: Yuchen Liang <yuchen@neon.tech>
TODO: Investigate how |
Signed-off-by: Yuchen Liang <yuchen@neon.tech>
…PI (#8104) Part of #7497, closes #8072. ## Problem Currently the `get_lsn_by_timestamp` and branch creation pageserver APIs do not provide a pleasant client experience where the looked-up LSN might be GC-ed between the two API calls. This PR attempts to prevent common races between GC and branch creation by making use of LSN leases provided in #8084. A lease can be optionally granted to a looked-up LSN. With the lease, GC will not touch layers needed to reconstruct all pages at this LSN for the duration of the lease. Signed-off-by: Yuchen Liang <yuchen@neon.tech>
Part of #7497, closes #8072.
Problem
Currently the
get_lsn_by_timestamp
and branch creation pageserver APIs do not provide a pleasant client experience where the looked-up LSN might be GC-ed between the two API calls.This PR attempts to prevent common races between GC and branch creation by making use of LSN leases provided in #8084. A lease can be optionally granted to a looked-up LSN. With the lease, GC will not touch layers needed to reconstruct all pages at this LSN for the duration of the lease.
Caveats: Leases can only prevent the common case. Branch creation at a LSN after lease is expired can still race with GC.
Summary of changes
with_lease
field in the request and an optionalvalid_until
field in the response to optionally grant leases.get_lsn_by_timestamp
.test_lsn_mapping
to parametrize overwith_lease
.Checklist before requesting a review
Checklist before merging