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:
Alan Jenkins 2015-08-10 16:48:19 +01:00
parent 2b348104f6
commit 57845c07ed
1 changed files with 3 additions and 0 deletions

3
attic/repository.py Normal file → Executable file
View 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: