2
0
Эх сурвалжийг харах

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

Thomas Waldmann 8 сар өмнө
parent
commit
7288f4f94d

+ 3 - 1
src/borg/archive.py

@@ -1649,7 +1649,9 @@ class ArchiveChecker:
         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:

+ 1 - 0
src/borg/archiver/check_cmd.py

@@ -41,6 +41,7 @@ class CheckMixIn:
             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: