Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pageserver): skip existing layers for btm-gc-compaction (#8498)
part of #8002 Due to the limitation of the current layer map implementation, we cannot directly replace a layer. It's interpreted as an insert and a deletion, and there will be file exist error when renaming the newly-created layer to replace the old layer. We work around that by changing the end key of the image layer. A long-term fix would involve a refactor around the layer file naming. For delta layers, we simply skip layers with the same key range produced, though it is possible to add an extra key as an alternative solution. * The image layer range for the layers generated from gc-compaction will be Key::MIN..(Key..MAX-1), to avoid being recognized as an L0 delta layer. * Skip existing layers if it turns out that we need to generate a layer with the same persistent key in the same generation. Note that it is possible that the newly-generated layer has different content from the existing layer. For example, when the user drops a retain_lsn, the compaction could have combined or dropped some records, therefore creating a smaller layer than the existing one. We discard the "optimized" layer for now because we cannot deal with such rewrites within the same generation. --------- Signed-off-by: Alex Chi Z <[email protected]> Co-authored-by: Christian Schwarz <[email protected]>
- Loading branch information
f4a668a
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.
2188 tests run: 2106 passed, 3 failed, 79 skipped (full report)
Failures on Postgres 14
test_gc_feedback_with_snapshots[github-actions-selfhosted]
: releasetest_gc_feedback[github-actions-selfhosted]
: releasetest_basebackup_with_high_slru_count[github-actions-selfhosted-10-13-30]
: releaseFlaky tests (1)
Postgres 15
test_subscriber_restart
: releaseCode coverage* (full report)
functions
:32.9% (7125 of 21683 functions)
lines
:50.4% (57357 of 113719 lines)
* collected from Rust tests only
f4a668a at 2024-08-01T17:59:41.850Z :recycle: