You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
check --repair: a full check rebuilds a corrupt chunks index from all packs twice #10434
With a corrupt chunks index and no pack errors, a full borg check --repair rebuilds the index from all packs twice:
Repository.check() rebuilds the index from every pack and stores it
(repository.py:1700, slow_rebuild=True, write_immediately=True).
ArchiveChecker.check() then invalidates that index and rebuilds it from every pack again
(archive.py:2324, slow_rebuild=repair), and finish() stores it again.
Both walks validate every object (metadata slot read + decryption per object), so the packs are read and
decrypted twice and the index is written twice.
Proposal
In a full check, leave the rebuild to the archives phase: Repository.check() already gets repo_only
from check_cmd.py, so it can rebuild the index only if repo_only is set.
This is simpler than letting the archives phase reuse the index the repository check built: with --repair, the archives phase rebuilds from the packs even if the stored index is intact, so reusing it
would need an extra "index was just rebuilt" signal between the two phases.
Consequences:
In a full check, the "Repository index was corrupted and has been rebuilt from the packs." message and the
count of skipped byte ranges move to the archives phase (note_dropped_objects).
If the archives phase gets interrupted, the index stays corrupt and is rebuilt on next use, as with
today's "rebuild interrupted" path.
Related question
If some packs are corrupt, Repository.check() does not rebuild the index (refs #8572), but in a full --repair the archives phase rebuilds it from all packs anyway (objects failing validation are left out).
So that guard only has an effect for --repository-only --repair. Decide whether that is intended.
Activity
check: a full --repair rebuilds a corrupt index once, in the archives…
mr-raj12 commentedon Sep 27, 2026
I'm working on this: #10445 (merge after #10443).
check: test a full --repair with a corrupt index and a corrupt pack, …
check: do not depend on archive1 surviving the corrupt pack in the in…
Merge pull request #10445 from mr-raj12/check-repair-single-rebuild-1…
check: a full --repair rebuilds a corrupt index once, in the archives…