瀏覽代碼

compact: derive freed space from quota use before/after, fixes #5679

due to the way quota accounting is done, this is likely not
100% precise, but much better than selling the hints as the truth.

Backport notes: 1.1 did not report how much space was freed so
I have added the message.
Thomas Waldmann 3 年之前
父節點
當前提交
57475f4b72
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/borg/repository.py

+ 3 - 0
src/borg/repository.py

@@ -725,6 +725,7 @@ class Repository:
         """
         """
         if not self.compact:
         if not self.compact:
             return
             return
+        quota_use_before = self.storage_quota_use
         index_transaction_id = self.get_index_transaction_id()
         index_transaction_id = self.get_index_transaction_id()
         segments = self.segments
         segments = self.segments
         unused = []  # list of segments, that are not used anymore
         unused = []  # list of segments, that are not used anymore
@@ -847,6 +848,8 @@ class Repository:
             pi.show()
             pi.show()
         pi.finish()
         pi.finish()
         complete_xfer(intermediate=False)
         complete_xfer(intermediate=False)
+        quota_use_after = self.storage_quota_use
+        logger.info('compaction freed about %s repository space.', format_file_size(quota_use_before - quota_use_after))
         logger.debug('compaction completed.')
         logger.debug('compaction completed.')
 
 
     def replay_segments(self, index_transaction_id, segments_transaction_id):
     def replay_segments(self, index_transaction_id, segments_transaction_id):