[PATCH 1 of 7 V2] fncache: remove the rewriting logic

Durham Goode durham at fb.com
Mon Mar 31 23:19:43 UTC 2014


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1395700307 25200
#      Mon Mar 24 15:31:47 2014 -0700
# Node ID cd7ea0745bf650f066486280fe51053d37be6260
# Parent  8a6a86c9a5b58ccc020de1ff0429e72dfa5599fc
fncache: remove the rewriting logic

The fncache could rewrite itself during a read operation if it noticed any
entries that were no longer on disk. This was problematic because it caused
Mercurial to perform write operations outside the scope of a lock or
transaction, which could interefere with any other pending writes.

This will be replaced in a future patch by logic that cleans up the fncache
as files are deleted during strips.

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -409,10 +409,6 @@
         fp.close()
         self._dirty = False
 
-    def rewrite(self, files):
-        self._write(files, False)
-        self.entries = set(files)
-
     def write(self):
         if self._dirty:
             self._write(self.entries, True)
@@ -476,7 +472,6 @@
         return self.rawvfs.stat(path).st_size
 
     def datafiles(self):
-        rewrite = False
         existing = []
         for f in sorted(self.fncache):
             ef = self.encode(f)
@@ -486,12 +481,6 @@
             except OSError, err:
                 if err.errno != errno.ENOENT:
                     raise
-                # nonexistent entry
-                rewrite = True
-        if rewrite:
-            # rewrite fncache to remove nonexistent entries
-            # (may be caused by rollback / strip)
-            self.fncache.rewrite(existing)
 
     def copylist(self):
         d = ('data dh fncache phaseroots obsstore'


More information about the Mercurial-devel mailing list