-
Notifications
You must be signed in to change notification settings - Fork 496
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ancestor detach: delete hardlinked layers on error (#10977)
Delete layers that we have hardlinked so far when there is an error in `remote_copy`. This prevents a retry of the ancestor detach from stumbling over already present layer files: the hardlink would fail with an error. If there is a crash, we already clean up during the timeline attach: we loop over all layer files and purge all layers that are not referenced by the `index_part.json`. Make sure to hold the timeline gate to prevent races with detach&attach&read from the layer file. These cleanups aren't completely enough however, as there is code after `prepare` as well. To handle errors there, we add a special case for `AlreadyExists` errors during the hardlink, where we check if the layer is an orphan, and if yes, we delete it from local disk. That is ideally not the case we hit, as it is less clear in that scenario where the layer came from, but it provides good defense in depth. Related #10729 Fixes #10970
- Loading branch information
Showing
1 changed file
with
84 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1434763
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.
7896 tests run: 7507 passed, 0 failed, 389 skipped (full report)
Flaky tests (4)
Postgres 17
test_migration_to_cold_secondary
: release-arm64-with-lfcPostgres 16
test_pageserver_gc_compaction_idempotent[after_restart]
: release-x86-64-with-lfctest_tx_abort_with_many_relations[v2]
: release-x86-64-with-lfcPostgres 15
test_pageserver_gc_compaction_idempotent[after_restart]
: release-arm64-with-lfcCode coverage* (full report)
functions
:32.8% (8636 of 26350 functions)
lines
:48.6% (73097 of 150404 lines)
* collected from Rust tests only
1434763 at 2025-02-26T19:00:15.634Z :recycle: