nodemap: only use persistent nodemap for non-inlined revlog
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 15 Jan 2020 15:47:40 +0100
changeset 44310 daad3aace942
parent 44309 6c07480d6659
child 44311 2b72c4ff8ed1
nodemap: only use persistent nodemap for non-inlined revlog Revlog are inlined while they are small (to avoid having too many file to deal with). The persistent nodemap will only provides a significant boost for large enough revlog index. So it does not make sens to add an extra file to store nodemap for small revlog. We could consider inclining the nodemap data inside the revlog itself, but the benefit is unclear so let it be an adventure for another time. Differential Revision: https://phab.mercurial-scm.org/D7837
mercurial/revlog.py
mercurial/revlogutils/nodemap.py
--- a/mercurial/revlog.py	Wed Jan 15 15:47:31 2020 +0100
+++ b/mercurial/revlog.py	Wed Jan 15 15:47:40 2020 +0100
@@ -1965,6 +1965,7 @@
             # manager
 
         tr.replace(self.indexfile, trindex * self._io.size)
+        nodemaputil.setup_persistent_nodemap(tr, self)
         self._chunkclear()
 
     def _nodeduplicatecallback(self, transaction, node):
--- a/mercurial/revlogutils/nodemap.py	Wed Jan 15 15:47:31 2020 +0100
+++ b/mercurial/revlogutils/nodemap.py	Wed Jan 15 15:47:40 2020 +0100
@@ -34,6 +34,8 @@
 
     (only actually persist the nodemap if this is relevant for this revlog)
     """
+    if revlog._inline:
+        return  # inlined revlog are too small for this to be relevant
     if revlog.nodemap_file is None:
         return  # we do not use persistent_nodemap on this revlog
     callback_id = b"revlog-persistent-nodemap-%s" % revlog.nodemap_file