Преглед изворни кода

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.
Alan Jenkins пре 10 година
родитељ
комит
57845c07ed
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      attic/repository.py

+ 3 - 0
attic/repository.py

@@ -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: