From e80b5c2272d41dace70d7e40a3380c2935d02cac Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 12 Feb 2022 20:32:50 +0100 Subject: [PATCH] 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. --- src/borg/repository.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/borg/repository.py b/src/borg/repository.py index 8ff687319..34a1691f7 100644 --- a/src/borg/repository.py +++ b/src/borg/repository.py @@ -738,7 +738,7 @@ def compact_segments(self, threshold): if not self.compact: logger.debug('nothing to do: compact empty') return - freed_space = 0 + quota_use_before = self.storage_quota_use index_transaction_id = self.get_index_transaction_id() segments = self.segments unused = [] # list of segments, that are not used anymore @@ -778,7 +778,6 @@ def complete_xfer(intermediate=True): segment, freeable_ratio * 100.0, freeable_space) pi.show() continue - freed_space += freeable_space # this is what we THINK we can free segments.setdefault(segment, 0) logger.debug('compacting segment %d with usage count %d (freeable: %2.2f%% [%d bytes])', segment, segments[segment], freeable_ratio * 100.0, freeable_space) @@ -867,7 +866,8 @@ def complete_xfer(intermediate=True): pi.show() pi.finish() complete_xfer(intermediate=False) - logger.info('compaction freed about %s repository space.', format_file_size(freed_space)) + 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.') def replay_segments(self, index_transaction_id, segments_transaction_id):