1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 09:47:58 +00:00

repository: check_free_space, special case small repos

This commit is contained in:
Marian Beermann 2016-11-12 14:42:11 +01:00
parent 80b86709ef
commit 00fae3f3e3
No known key found for this signature in database
GPG key ID: 9B8450B91D1362C1

View file

@ -428,8 +428,18 @@ def check_free_space(self):
required_free_space += self.additional_free_space
if not self.append_only:
# Keep one full worst-case segment free in non-append-only mode
required_free_space += self.max_segment_size + MAX_OBJECT_SIZE
full_segment_size = self.max_segment_size + MAX_OBJECT_SIZE
if len(self.compact) < 10:
# This is mostly for the test suite to avoid overestimated free space needs. This can be annoying
# if TMP is a small-ish tmpfs.
compact_working_space = sum(self.io.segment_size(segment) - free for segment, free in self.compact.items())
logger.debug('check_free_space: few segments, not requiring a full free segment')
compact_working_space = min(compact_working_space, full_segment_size)
logger.debug('check_free_space: calculated working space for compact as %d bytes', compact_working_space)
required_free_space += compact_working_space
else:
# Keep one full worst-case segment free in non-append-only mode
required_free_space += full_segment_size
try:
st_vfs = os.statvfs(self.path)
except OSError as os_error: