1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-29 11:16:43 +00:00

check (archives part): use cached ChunkIndex from check (repository part)

This commit is contained in:
Thomas Waldmann 2024-10-09 01:58:26 +02:00
parent bc24d01928
commit 7288f4f94d
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01
2 changed files with 4 additions and 1 deletions

View file

@ -1649,7 +1649,9 @@ def check(
self.check_all = not any((first, last, match, older, newer, oldest, newest))
self.repair = repair
self.repository = repository
self.chunks = build_chunkindex_from_repo(self.repository, disable_caches=True, cache_immediately=not repair)
# Repository.check already did a full repository-level check and has built and cached a fresh chunkindex -
# we can use that here, so we don't disable the caches (also no need to cache immediately, again):
self.chunks = build_chunkindex_from_repo(self.repository, disable_caches=False, cache_immediately=False)
self.key = self.make_key(repository)
self.repo_objs = RepoObj(self.key)
if verify_data:

View file

@ -41,6 +41,7 @@ def do_check(self, args, repository):
raise CommandError("--undelete-archives requires --repair argument.")
if args.max_duration and not args.repo_only:
# when doing a partial repo check, we can only check xxh64 hashes in repository files.
# archives check requires that a full repo check was done before and has built/cached a ChunkIndex.
# also, there is no max_duration support in the archives check code anyway.
raise CommandError("--repository-only is required for --max-duration support.")
if not args.archives_only: