Skip to content

check: make the pre-check index/key rebuild phases interruptible (remaining work for #7893) #10042

Description

@mr-raj12

#9966 makes borg check respond to Ctrl-C during the repository pack loop and between archives in the archive check. Two earlier phases still ignore the signal, so on a large --repair the first Ctrl-C can look like it did nothing until those phases finish. This is the remaining work to fully close #7893.

Two spots don't poll sig_int:

  1. build_chunkindex_from_repo(..., slow_rebuild=True) (cache.py) rebuilds the chunk index by reading every pack's object headers, in the loop over repository.store_list("packs") at cache.py:876. --repair always takes this slow path, and on a repo with many packs it runs for a long time before any check code is reached.

  2. ArchiveChecker.make_key() (archive.py:1951) falls back to reading up to 999 chunks to recover the key when the manifest is unreadable (archive.py:1967).

Unlike the pack loop, a half-built chunk index can't be saved and resumed: it would be missing chunks and report them as lost. So these phases must raise on interrupt rather than stop and persist.

Secondary, same area: ArchiveChecker.rebuild_archives() only breaks between archives. That's correct for --repair, which rewrites each archive as a whole, but a read-only check could break inside the item loop for faster response on a single very large archive. Worth branching on repair.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions