1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 01:37:20 +00:00

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.
This commit is contained in:
Thomas Waldmann 2022-02-12 20:32:50 +01:00
parent 94c3d7eb27
commit e80b5c2272

View file

@ -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):