2
0
Эх сурвалжийг харах

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 жил өмнө
parent
commit
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: