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.
This commit is contained in:
Thomas Waldmann 2022-02-12 20:32:50 +01:00 committed by Andrey Bienkowski
parent 2b3217121f
commit 57475f4b72

View file

@ -725,6 +725,7 @@ class Repository:
"""
if not self.compact:
return
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
@ -847,6 +848,8 @@ class Repository:
pi.show()
pi.finish()
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.')
def replay_segments(self, index_transaction_id, segments_transaction_id):