]> arthur.barton.de Git - bup.git/commitdiff
gc: restart catpipe after each new pack
authorRob Browning <rlb@defaultvalue.org>
Sat, 10 Dec 2016 17:57:05 +0000 (11:57 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sat, 17 Dec 2016 17:03:31 +0000 (11:03 -0600)
Without this, the space taken by the stale packfiles that gc removes
won't be available to the filesystem until the entire gc run ends (or
the catpipe is otherwise reset).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/gc.py
lib/bup/git.py

index 446092f9cd70aef8912ef12279a4194f491795dd..c0a1c0e1df489197d66cb58b92229d6d980cf26c 100644 (file)
@@ -138,6 +138,8 @@ def sweep(live_objects, existing_count, cat_pipe, threshold, compression,
             if verbosity:
                 log('removing ' + basename(p) + '\n')
             os.unlink(p)
+        if ns.stale_files:  # So git cat-pipe will close them
+            cat_pipe.restart()
         ns.stale_files = []
 
     writer = git.PackWriter(objcache_maker=None,
index 0f701a5d623cb3090d36631595dbda33feb1bc4c..fc9eb39cb2c35ec8b9d0cc67c4f8b1cdd0b84e24 100644 (file)
@@ -1131,7 +1131,7 @@ class CatPipe:
         self.p = None
         self.inprogress = None
 
-    def _restart(self):
+    def restart(self):
         self._abort()
         self.p = subprocess.Popen(['git', 'cat-file', '--batch'],
                                   stdin=subprocess.PIPE,
@@ -1142,7 +1142,7 @@ class CatPipe:
 
     def _fast_get(self, id):
         if not self.p or self.p.poll() != None:
-            self._restart()
+            self.restart()
         assert(self.p)
         poll_result = self.p.poll()
         assert(poll_result == None)