caches: no longer warm the cache on strip in "auto" mode stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 11 Oct 2018 13:38:38 +0200
branchstable
changeset 4156 f996596d8ccc
parent 4125 865c33c16508
child 4159 328450f2de56
child 4167 7d455f3d7ebc
caches: no longer warm the cache on strip in "auto" mode Before this patch, a strip would trigger a full and blind cache load that would include the stablerange cache. In repository like Mozilla this was a bit painful. The default "auto" mode now behave has intended.
hgext3rd/evolve/obsdiscovery.py
hgext3rd/evolve/utility.py
tests/test-discovery-obshashrange.t
--- a/hgext3rd/evolve/obsdiscovery.py	Sat Sep 22 13:09:06 2018 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Thu Oct 11 13:38:38 2018 +0200
@@ -696,7 +696,14 @@
         def destroyed(self):
             if 'obsstore' in vars(self):
                 self.obsstore.rangeobshashcache.clear()
-            super(obshashrepo, self).destroyed()
+            toplevel = not util.safehasattr(self, '_destroying')
+            if toplevel:
+                self._destroying = True
+            try:
+                super(obshashrepo, self).destroyed()
+            finally:
+                if toplevel:
+                    del self._destroying
 
         @localrepo.unfilteredmethod
         def updatecaches(self, tr=None, **kwargs):
--- a/hgext3rd/evolve/utility.py	Sat Sep 22 13:09:06 2018 +0200
+++ b/hgext3rd/evolve/utility.py	Thu Oct 11 13:38:38 2018 +0200
@@ -49,7 +49,7 @@
     desc = getattr(tr, 'desc', '')
 
     autocase = False
-    if tr is None:
+    if tr is None and not getattr(repo, '_destroying', False):
         autocase = True
     elif desc.startswith('serve'):
         autocase = True
@@ -63,7 +63,6 @@
     else:
         # note: we should not get to the default case
         warm = configbool('experimental', 'obshashrange.warm-cache', True)
-
     if not configbool('experimental', 'obshashrange', True):
         return False
     if not warm:
--- a/tests/test-discovery-obshashrange.t	Sat Sep 22 13:09:06 2018 +0200
+++ b/tests/test-discovery-obshashrange.t	Thu Oct 11 13:38:38 2018 +0200
@@ -1068,16 +1068,6 @@
   * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-obscache cache reset (glob)
   * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-obscache in *.???? seconds (5r, 11o) (glob)
   * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-obscache in *.???? seconds (3r, 0o) (glob)
-  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-firstmerge cache reset (glob)
-  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-firstmerge in *.???? seconds (8r) (glob)
-  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-depthcache cache reset (glob)
-  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-depthcache in *.???? seconds (8r) (glob)
-  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-stablesort cache reset (glob)
-  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-stablesort in *.???? seconds (8r) (glob)
-  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-stablerange-mergepoint cache reset (glob)
-  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-stablerange-mergepoint in *.???? seconds (8r) (glob)
-  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-obshashrange cache reset (glob)
-  1970/01/01 00:00:00 * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-obshashrange in *.???? seconds (8r, 11o) (glob)
   * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated base branch cache in *.???? seconds (glob)
   * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> wrote base branch cache with 1 labels and 1 nodes (glob)
   * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> 3 incoming changes - new heads: 4de32a90b66c (glob)
@@ -1086,6 +1076,16 @@
   * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> writing .hg/cache/tags2-visible with 0 tags (glob)
   * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> log -G exited 0 after *.?? seconds (glob)
   * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> pull (glob)
+  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-stablerange-mergepoint cache reset (glob)
+  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-depthcache cache reset (glob)
+  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-depthcache in *.???? seconds (8r) (glob)
+  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-stablerange-mergepoint in *.???? seconds (8r) (glob)
+  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-obshashrange cache reset (glob)
+  1970/01/01 00:00:00 * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-obshashrange in *.???? seconds (8r, 11o) (glob)
+  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-stablesort cache reset (glob)
+  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-stablesort in *.???? seconds (8r) (glob)
+  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-firstmerge cache reset (glob)
+  * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-firstmerge in *.???? seconds (8r) (glob)
   * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> obsdiscovery, 1/8 mismatch - 1 obshashrange queries in *.???? seconds (glob)
   1970/01/01 00:00:00 * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated base branch cache in *.???? seconds (glob)
   1970/01/01 00:00:00 * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> wrote base branch cache with 1 labels and 2 nodes (glob)
@@ -1146,3 +1146,11 @@
   .hg/cache/evoext-stablesortcache-00: size=100
   .hg/cache/evoext_obshashrange_v2.sqlite: size=??* (glob)
   .hg/cache/evoext_stablerange_v2.sqlite: size=??* (glob)
+
+  $ rm -f .hg/cache/evoext*
+  $ ls -1 .hg/cache/ | grep evoext
+  [1]
+  $ hg strip -r 5 --config extensions.strip=
+  saved backup bundle to $TESTTMP/client/.hg/strip-backup/c8d03c1b5e94-b257442b-backup.hg
+  $ f -s .hg/cache/evoext*
+  .hg/cache/evoext-obscache-00: size=70