Prechádzať zdrojové kódy

recreate: don't rechunkify unless explicitly told so

Marian Beermann 8 rokov pred
rodič
commit
a9395dd8b1
2 zmenil súbory, kde vykonal 8 pridanie a 2 odobranie
  1. 7 1
      src/borg/archive.py
  2. 1 1
      src/borg/archiver.py

+ 7 - 1
src/borg/archive.py

@@ -1417,6 +1417,9 @@ class ArchiveRecreater:
         self.exclude_if_present = exclude_if_present or []
         self.exclude_if_present = exclude_if_present or []
         self.keep_tag_files = keep_tag_files
         self.keep_tag_files = keep_tag_files
 
 
+        self.rechunkify = chunker_params is not None
+        if self.rechunkify:
+            logger.debug('Rechunking archives to %s', chunker_params)
         self.chunker_params = chunker_params or CHUNKER_PARAMS
         self.chunker_params = chunker_params or CHUNKER_PARAMS
         self.recompress = bool(compression)
         self.recompress = bool(compression)
         self.always_recompress = always_recompress
         self.always_recompress = always_recompress
@@ -1587,7 +1590,10 @@ class ArchiveRecreater:
         target_name = target_name or archive.name + '.recreate'
         target_name = target_name or archive.name + '.recreate'
         target = self.create_target_archive(target_name)
         target = self.create_target_archive(target_name)
         # If the archives use the same chunker params, then don't rechunkify
         # If the archives use the same chunker params, then don't rechunkify
-        target.recreate_rechunkify = tuple(archive.metadata.get('chunker_params', [])) != self.chunker_params
+        source_chunker_params = tuple(archive.metadata.get('chunker_params', []))
+        target.recreate_rechunkify = self.rechunkify and source_chunker_params != target.chunker_params
+        if target.recreate_rechunkify:
+            logger.debug('Rechunking archive from %s to %s', source_chunker_params or '(unknown)', target.chunker_params)
         return target
         return target
 
 
     def create_target_archive(self, name):
     def create_target_archive(self, name):

+ 1 - 1
src/borg/archiver.py

@@ -2388,7 +2388,7 @@ class Archiver:
 
 
         When rechunking space usage can be substantial, expect at least the entire
         When rechunking space usage can be substantial, expect at least the entire
         deduplicated size of the archives using the previous chunker params.
         deduplicated size of the archives using the previous chunker params.
-        When recompressing expect approx throughput / checkpoint-interval in space usage,
+        When recompressing expect approx. (throughput / checkpoint-interval) in space usage,
         assuming all chunks are recompressed.
         assuming all chunks are recompressed.
         """)
         """)
         subparser = subparsers.add_parser('recreate', parents=[common_parser], add_help=False,
         subparser = subparsers.add_parser('recreate', parents=[common_parser], add_help=False,