Skip to content

Commit

Permalink
feat(pageserver): gc-compaction split over LSN (#9900)
Browse files Browse the repository at this point in the history
## Problem

part of #9114, stacked PR
over #9897, partially
refactored to help with
#10031

## Summary of changes

* gc-compaction takes `above_lsn` parameter. We only compact the layers
above this LSN, and all data below the LSN are treated as if they are on
the ancestor branch.
* refactored gc-compaction to take `GcCompactJob` that describes the
rectangular range to be compacted.
* Added unit test for this case.

---------

Signed-off-by: Alex Chi Z <[email protected]>
Co-authored-by: Christian Schwarz <[email protected]>
  • Loading branch information
skyzh and problame authored Dec 12, 2024
1 parent a93e3d3 commit 5ff4b99
Show file tree
Hide file tree
Showing 5 changed files with 878 additions and 102 deletions.
13 changes: 10 additions & 3 deletions pageserver/src/http/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2081,13 +2081,20 @@ async fn timeline_compact_handler(
.as_ref()
.map(|r| r.sub_compaction)
.unwrap_or(false);
let sub_compaction_max_job_size_mb = compact_request
.as_ref()
.and_then(|r| r.sub_compaction_max_job_size_mb);

let options = CompactOptions {
compact_range: compact_request
compact_key_range: compact_request
.as_ref()
.and_then(|r| r.compact_key_range.clone()),
compact_lsn_range: compact_request
.as_ref()
.and_then(|r| r.compact_range.clone()),
compact_below_lsn: compact_request.as_ref().and_then(|r| r.compact_below_lsn),
.and_then(|r| r.compact_lsn_range.clone()),
flags,
sub_compaction,
sub_compaction_max_job_size_mb,
};

let scheduled = compact_request
Expand Down
Loading

1 comment on commit 5ff4b99

@github-actions
Copy link

Choose a reason for hiding this comment

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

7740 tests run: 7408 passed, 1 failed, 331 skipped (full report)


Failures on Postgres 17

  • test_pageserver_small_inmemory_layers[False]: debug-x86-64
# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_pageserver_small_inmemory_layers[debug-pg17-False]"
Flaky tests (5)

Postgres 17

Postgres 16

  • test_pgdata_import_smoke[None-1024-RelBlockSize.MULTIPLE_RELATION_SEGMENTS]: release-arm64

Postgres 14

  • test_pgdata_import_smoke[None-1024-RelBlockSize.MULTIPLE_RELATION_SEGMENTS]: release-arm64
  • test_lr_with_slow_safekeeper: release-arm64

Test coverage report is not available

The comment gets automatically updated with the latest test results
5ff4b99 at 2024-12-12T21:23:05.243Z :recycle:

Please sign in to comment.