[PATCH 1 of 2] perffncachewrite: load fncache after lock is acquired

Boris Feld boris.feld at octobus.net
Mon Jul 16 07:27:40 UTC 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1531526987 -7200
#      Sat Jul 14 02:09:47 2018 +0200
# Node ID fa319c92bed5fc495d62122697ee32a8fe2be8c4
# Parent  cc76692f401d0063cd5dfaf46f0fca1563a85fae
# EXP-Topic perffncachewrite
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r fa319c92bed5
perffncachewrite: load fncache after lock is acquired

Without this patch, running perffncachewrite on a repository destroy its
fncache.

Lock Acquisition drops various caches, including the fncache one. Then writing
of an non-loaded fncache result into an empty one.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -957,9 +957,10 @@ def perffncacheload(ui, repo, **opts):
 def perffncachewrite(ui, repo, **opts):
     timer, fm = gettimer(ui, opts)
     s = repo.store
+    lock = repo.lock()
     s.fncache._load()
-    lock = repo.lock()
     tr = repo.transaction('perffncachewrite')
+    tr.addbackup('fncache')
     def d():
         s.fncache._dirty = True
         s.fncache.write(tr)
diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t
--- a/tests/test-contrib-perf.t
+++ b/tests/test-contrib-perf.t
@@ -145,7 +145,11 @@ perfstatus
 #if repofncache
   $ hg perffncacheencode
   $ hg perffncacheload
+  $ hg debugrebuildfncache
+  fncache already up to date
   $ hg perffncachewrite
+  $ hg debugrebuildfncache
+  fncache already up to date
 #endif
   $ hg perfheads
   $ hg perfindex


More information about the Mercurial-devel mailing list