cache: sentinel to invalidate the chunk index during fragment deletion#9908
Draft
mr-raj12 wants to merge 1 commit into
Draft
cache: sentinel to invalidate the chunk index during fragment deletion#9908mr-raj12 wants to merge 1 commit into
mr-raj12 wants to merge 1 commit into
Conversation
…ex fragments (borgbackup#9904) An interrupted fragment deletion could leave a subset that build_chunkindex_from_repo trusts as a complete index; the sentinel now forces a rebuild from packs instead.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9908 +/- ##
==========================================
+ Coverage 85.13% 85.25% +0.12%
==========================================
Files 93 93
Lines 15899 15936 +37
Branches 2428 2436 +8
==========================================
+ Hits 13535 13587 +52
+ Misses 1654 1638 -16
- Partials 710 711 +1 ☔ View full report in Codecov by Harness. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Deleting chunk index fragments is not crash safe: if the delete is interrupted partway, the leftover fragments look like a complete index and borg trusts them, so the index ends up missing entries or keeping stale ones.
This writes an "index invalidated" sentinel before the first fragment delete and removes it after the last. While the sentinel is present, the index is rebuilt from packs.
The sentinel only guards non-superset rewrites (full replacements and the invalidate-all path). Repack does not need it, since the fragments it writes already contain the entries it deletes.
Closes #9904