Skip to content

Commit

Permalink
pageserver: hold GC while reading from a timeline (#10559)
Browse files Browse the repository at this point in the history
## Problem

If we are GC-ing because a new image layer was added while traversing
the timeline, then it will remove layers that are required for
fulfilling the current get request (read-path cannot "look back" and
notice the new image layer).

## Summary of Changes

Prevent GC from progressing on the current timeline while it is being
visited for a read.

Epic: #9376
  • Loading branch information
VladLazar authored Jan 29, 2025
1 parent 190c19c commit fdfbc7b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pageserver/src/tenant/timeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3468,6 +3468,13 @@ impl Timeline {
let mut completed_keyspace = KeySpace::default();
let mut image_covered_keyspace = KeySpaceRandomAccum::new();

// Prevent GC from progressing while visiting the current timeline.
// If we are GC-ing because a new image layer was added while traversing
// the timeline, then it will remove layers that are required for fulfilling
// the current get request (read-path cannot "look back" and notice the new
// image layer).
let _gc_cutoff_holder = timeline.get_latest_gc_cutoff_lsn();

loop {
if cancel.is_cancelled() {
return Err(GetVectoredError::Cancelled);
Expand Down

1 comment on commit fdfbc7b

@github-actions
Copy link

Choose a reason for hiding this comment

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

7414 tests run: 7062 passed, 1 failed, 351 skipped (full report)


Failures on Postgres 15

# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_compute_migrations_retry[release-pg15]"
Flaky tests (9)

Postgres 17

Postgres 14

Test coverage report is not available

The comment gets automatically updated with the latest test results
fdfbc7b at 2025-01-29T18:36:58.603Z :recycle:

Please sign in to comment.