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

pageserver: exclude gc_horizon from synthetic size calculation #6407

Merged
merged 4 commits into from Mar 15, 2024

Conversation

jcsp
Copy link
Contributor

@jcsp jcsp commented Jan 19, 2024

Problem

See:

Summary of changes

Whereas previously we calculated synthetic size from the gc_horizon or the pitr_interval (whichever is the lower LSN), now we ignore gc_horizon and exclusively start from the pitr_interval. This is a more generous calculation for billing, where we do not charge users for data retained due to gc_horizon.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • Do we need to implement analytics? if so did you add the relevant metrics to the dashboard?
  • If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section.

Checklist before merging

  • Do not forget to reformat commit message to not include the above checklist

@jcsp jcsp added t/bug Issue Type: Bug c/storage/pageserver Component: storage: pageserver labels Jan 19, 2024
@jcsp jcsp marked this pull request as ready for review January 19, 2024 17:35
@jcsp jcsp requested a review from a team as a code owner January 19, 2024 17:35
@jcsp jcsp requested review from koivunej and removed request for a team January 19, 2024 17:35
Copy link

github-actions bot commented Jan 19, 2024

2706 tests run: 2582 passed, 0 failed, 124 skipped (full report)


Flaky tests (2)

Postgres 16

  • test_timeline_deletion_with_files_stuck_in_upload_queue: debug
  • test_pageserver_recovery: debug

Code coverage* (full report)

  • functions: 28.3% (7032 of 24812 functions)
  • lines: 47.0% (43469 of 92423 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
2e938fa at 2024-03-15T13:44:38.948Z :recycle:

@jcsp jcsp force-pushed the jcsp/synthetic-size-drops branch from bce0c61 to 2e938fa Compare March 15, 2024 12:06
@jcsp jcsp merged commit bc1efa8 into main Mar 15, 2024
54 checks passed
@jcsp jcsp deleted the jcsp/synthetic-size-drops branch March 15, 2024 16:07
jcsp added a commit that referenced this pull request Apr 23, 2024
## 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/storage/pageserver Component: storage: pageserver t/bug Issue Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants