D6710: branchmap: properly refresh/warm all branchmap caches

spectral (Kyle Lippincott) phabricator at mercurial-scm.org
Fri Aug 2 21:27:14 EDT 2019


spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The comment about 'served' refreshing all the others only applies when served is
  the head of the branchmap cache subsets. This was already no longer the case
  (and is presumably why served.hidden was added) but the comment was not
  adjusted. Currently, the "heads" of the branchmap cache subsets are the three
  specified here: visible, visible-hidden, served.hidden.
  
  Additionally, 'full' claims it will warm all of the caches that are known about,
  but this is not the case - it does not actually warm the branchmap caches for
  subsets that we haven't requested or for subsets that are still considered
  "valid".

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2192,10 +2192,13 @@
             return
 
         if tr is None or tr.changes['origrepolen'] < len(self):
-            # accessing the 'ser ved' branchmap should refresh all the others,
+            # There are three "heads" to the cache hierarchy: visible,
+            # visible-hidden, and served.hidden. Updating any of these three
+            # should cause all of the others (currently: served, immutable,
+            # base) that are stale to be updated.
             self.ui.debug('updating the branch cache\n')
-            self.filtered('served').branchmap()
-            self.filtered('served.hidden').branchmap()
+            for filt in ['visible', 'visible-hidden', 'served.hidden']:
+                self.filtered(filt).branchmap()
 
         if full:
             unfi = self.unfiltered()
@@ -2214,6 +2217,12 @@
             self.tags()
             self.filtered('served').tags()
 
+            # Warm the branchmap caches even for caches we haven't needed yet,
+            # including forcing a write to disk.
+            for filt in repoview.filtertable.keys():
+                filtered = self.filtered(filt)
+                filtered.branchmap().write(filtered)
+
     def invalidatecaches(self):
 
         if r'_tagscache' in vars(self):



To: spectral, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list