Skip to content

Commit

Permalink
check (archives part): use cached ChunkIndex from check (repository p…
Browse files Browse the repository at this point in the history
…art)
  • Loading branch information
ThomasWaldmann committed Oct 9, 2024
1 parent bc24d01 commit 7288f4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/borg/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions src/borg/archiver/check_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7288f4f

Please sign in to comment.