mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-15 00:21:56 +00:00
Clean up fds of segments we delete (during compaction)
When we delete a segment, let's close its fd as well. Note as well wasting the fd, this was forcing the filesystem to preserve the deleted file until we exited. I noticed roughly 20 open fds of deleted files when attic saved 10G of data.
This commit is contained in:
parent
2b348104f6
commit
57845c07ed
1 changed files with 3 additions and 0 deletions
3
attic/repository.py
Normal file → Executable file
3
attic/repository.py
Normal file → Executable file
|
@ -478,6 +478,9 @@ class LoggedIO(object):
|
|||
return fd
|
||||
|
||||
def delete_segment(self, segment):
|
||||
fd = self.fds.pop(segment)
|
||||
if fd != None:
|
||||
fd.close()
|
||||
try:
|
||||
os.unlink(self.segment_filename(segment))
|
||||
except OSError:
|
||||
|
|
Loading…
Add table
Reference in a new issue