浏览代码

add debug logging for repository cleanup

so we can know whether it did a cleanup and if so,
which and how many segments were cleaned up.
Thomas Waldmann 7 年之前
父节点
当前提交
57f808e4bb
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/borg/repository.py

+ 4 - 0
src/borg/repository.py

@@ -1172,11 +1172,15 @@ class LoggedIO:
         """Delete segment files left by aborted transactions
         """Delete segment files left by aborted transactions
         """
         """
         self.segment = transaction_id + 1
         self.segment = transaction_id + 1
+        count = 0
         for segment, filename in self.segment_iterator(reverse=True):
         for segment, filename in self.segment_iterator(reverse=True):
             if segment > transaction_id:
             if segment > transaction_id:
                 truncate_and_unlink(filename)
                 truncate_and_unlink(filename)
+                count += 1
             else:
             else:
                 break
                 break
+        logger.debug('Cleaned up %d uncommitted segment files (== everything after segment %d).',
+                     count, transaction_id)
 
 
     def is_committed_segment(self, segment):
     def is_committed_segment(self, segment):
         """Check if segment ends with a COMMIT_TAG tag
         """Check if segment ends with a COMMIT_TAG tag