-
Notifications
You must be signed in to change notification settings - Fork 360
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
pageserver: change pitr_interval=0 behavior #7423
Conversation
2772 tests run: 2654 passed, 0 failed, 118 skipped (full report)Code coverage* (full report)
* collected from Rust tests only The comment gets automatically updated with the latest test results
a0e68ce at 2024-04-23T08:55:24.394Z :recycle: |
85f2139
to
a0e68ce
Compare
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.
I think this PR fixes two orthogonal issues in one go.
Please confirm my understanding.
Might be worth pointing out in the commit message for future readers.
Issue 1
Before this PR, we would skip the update_gc_info
for timelines with last_record_lsn() < gc_horizon
.
Let's call such timelines "tiny".
The rationale for that presumably was that we can't GC anything in the tiny timelines, why bother to call update_gc_info()
.
However, synthetic size calculation relies on up-to-date update_gc_info()
data.
Before this PR, tiny timelines would never get an updated GcInfo::pitr_horizon (it remained Lsn(0)).
Even on projects with pitr_interval=0d
.
With this PR, update_gc_info
is always called, hence GcInfo::pitr_horizon is always updated, thereby
providing synthetic size calculation with up-to-data data.
Issue 2
Before this PR, regardless of whether the timeline is "tiny" or not, GcInfo::pitr_horizon was clamped to at least last_record_lsn - gc_horizon
, even if the pitr window in terms of LSN range was shorter (=less than) the gc_horizon.
With this PR, that clamping is removed, so, for pitr_interval=0
, the pitr_horizon = last_record_lsn
.
Thanks, yes - that's all accurate. The "Issue 1" part is mainly just to make tests with small data behave, but it's also a valid change for production if a user has a small WAL. I've copied it into the PR desc. |
Problem
We already made a change in #6407 to make pitr_interval authoritative for synthetic size calculations (do not charge users for data retained due to gc_horizon), but that change didn't cover the case where someone entirely disables time-based retention by setting pitr_interval=0
Relates to: #6374
Summary of changes
When pitr_interval is zero, do not set
pitr_cutoff
based on gc_horizon.gc_horizon is still enforced, but separately (its value is passed separately, there was never a need to claim pitr_cutoff to gc_horizon)
More detail
Issue 1
Before this PR, we would skip the update_gc_info for timelines with last_record_lsn() < gc_horizon.
Let's call such timelines "tiny".
The rationale for that presumably was that we can't GC anything in the tiny timelines, why bother to call update_gc_info().
However, synthetic size calculation relies on up-to-date update_gc_info() data.
Before this PR, tiny timelines would never get an updated GcInfo::pitr_horizon (it remained Lsn(0)).
Even on projects with pitr_interval=0d.
With this PR, update_gc_info is always called, hence GcInfo::pitr_horizon is always updated, thereby
providing synthetic size calculation with up-to-data data.
Issue 2
Before this PR, regardless of whether the timeline is "tiny" or not, GcInfo::pitr_horizon was clamped to at least last_record_lsn - gc_horizon, even if the pitr window in terms of LSN range was shorter (=less than) the gc_horizon.
With this PR, that clamping is removed, so, for pitr_interval=0, the pitr_horizon = last_record_lsn.
Checklist before requesting a review
Checklist before merging