Patchwork D8174: nodemap: refresh the persistent data on nodemap creation

login
register
mail settings
Submitter phabricator
Date Feb. 27, 2020, 9:09 a.m.
Message ID <differential-rev-PHID-DREV-aboolanvnxyrm3iicmfn-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45360/
State Superseded
Headers show

Comments

phabricator - Feb. 27, 2020, 9:09 a.m.
marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The logic to read the data and validate the docket are still in python, so we
  need to "help" whatever compiled code live in the index to refresh it.
  
  Otherwise clearing the cache could lead to an expensive full recomputation and
  disk update even when the persisted data are still valid.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8174

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS




To: marmoute, indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -760,7 +760,20 @@ 
         self._chainbasecache.clear()
         self._chunkcache = (0, b'')
         self._pcache = {}
+        self._nodemap_docket = None
         self.index.clearcaches()
+        # The python code is the one responsible for validating the docket, we
+        # end up having to refresh it here.
+        use_nodemap = (
+            not self._inline
+            and self.nodemap_file is not None
+            and util.safehasattr(self.index, 'update_nodemap_data')
+        )
+        if use_nodemap:
+            nodemap_data = nodemaputil.persisted_data(self)
+            if nodemap_data is not None:
+                self._nodemap_docket = nodemap_data[0]
+                self.index.update_nodemap_data(*nodemap_data)
 
     def rev(self, node):
         try: