fncachestore: copy dh directory before the manifest stable
authorAdrian Buehlmann <adrian@cadifra.com>
Fri, 17 Dec 2010 10:40:26 +0100
branchstable
changeset 13169 4c1fbed00224
parent 13168 dbb855bdfe76
child 13170 537df3bfbaad
child 13183 f9d29777b4eb
child 13219 d4393968318f
fncachestore: copy dh directory before the manifest Before this patch, the copy order on clone was: requires 00changelog.i store\data store\00manifest.d store\00manifest.i store\00changelog.d store\00changelog.i store\dh store\fncache Which provides a theoretical non-zero probability of a race during clone where a very early reader might see a repository with missing revlog files if it sees 00changelog.i before all files inside dh have been copied. The dh directory is similar to the data directory -- just for files with long names (which are hashed). The manifest refers to files in data *and* dh, so dh should be copied before the manifest. This patch improves the copy order to: requires 00changelog.i store\data store\dh store\fncache store\00manifest.d store\00manifest.i store\00changelog.d store\00changelog.i I'm putting fncache to before the manifest while I'm at it, since fncache provides a mechanism to enumerate all repository files without visiting the manifest revisions. fncache depends only on data and dh. Note that data must be copied first, since copying data triggers the creation of the repository write lock in the destination repo (see hg.clone).
mercurial/store.py
--- a/mercurial/store.py	Mon Dec 20 12:05:50 2010 -0600
+++ b/mercurial/store.py	Fri Dec 17 10:40:26 2010 +0100
@@ -323,7 +323,8 @@
             self.fncache.rewrite(existing)
 
     def copylist(self):
-        d = _data + ' dh fncache'
+        d = ('data dh fncache'
+             ' 00manifest.d 00manifest.i 00changelog.d 00changelog.i')
         return (['requires', '00changelog.i'] +
                 [self.pathjoiner('store', f) for f in d.split()])