mirror of https://github.com/borgbackup/borg.git
repository: check_free_space, special case small repos
This commit is contained in:
parent
80b86709ef
commit
00fae3f3e3
|
@ -428,8 +428,18 @@ class Repository:
|
||||||
|
|
||||||
required_free_space += self.additional_free_space
|
required_free_space += self.additional_free_space
|
||||||
if not self.append_only:
|
if not self.append_only:
|
||||||
# Keep one full worst-case segment free in non-append-only mode
|
full_segment_size = self.max_segment_size + MAX_OBJECT_SIZE
|
||||||
required_free_space += 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:
|
try:
|
||||||
st_vfs = os.statvfs(self.path)
|
st_vfs = os.statvfs(self.path)
|
||||||
except OSError as os_error:
|
except OSError as os_error:
|
||||||
|
|
Loading…
Reference in New Issue