merge with stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 21 May 2017 14:27:23 +0200
changeset 2461 3c9a74763c20
parent 2457 1ea3065cc570 (current diff)
parent 2460 64cc0b059073 (diff)
child 2463 08c552a5eb37
merge with stable
README
tests/test-discovery-obshashrange.t
--- a/README	Fri May 19 20:52:09 2017 +0200
+++ b/README	Sun May 21 14:27:23 2017 +0200
@@ -120,8 +120,12 @@
 6.2.1 - in progress
 -------------------
 
-- prune: fix a crash related to color handling,
-- next: fix a crash related to color handling,
+ - prune: fix a crash related to color handling,
+ - next: fix a crash related to color handling,
+ - discovery: document the 'obshashrange' experiment,
+ - cache: reduce the warming load in case of reset,
+ - cache: add a 'experimental.obshashcache.warm-cache' option to allow
+   disabling post transaction cache warming.
 
 6.2.0 -- 2017-05-18
 -------------------
--- a/hgext3rd/evolve/__init__.py	Fri May 19 20:52:09 2017 +0200
+++ b/hgext3rd/evolve/__init__.py	Sun May 21 14:27:23 2017 +0200
@@ -44,9 +44,34 @@
     # * abort: abort the push
     auto-publish = ignore
 
+Obsolescence Markers Discovery Experiment
+=========================================
+
+We are experimenting with a new protocol to discover common markers during the
+local and remote repository. This experiment is still at an early stage but is
+already raising better result than the previous version when usable.
+
+Large" repositories (hundreds of thousand) are currently unsupported. Some key
+algorithm has a naive implementation with too agressive caching, creating
+memory consumption issue (this will get fixed).
+
+Medium sized repositories works fine, but be prepared for a noticable initial
+cache filling. for the Mercurial repository, this is around 20 seconds
+
+The following config control the experiment::
+
+  [experimental]
+
+  # enable new discovery protocol
+  # (needed on both client and server)
+  obshashrange = yes
+
+  # avoid cache warming after transaction
+  # (recommended 'off' for developer repositories)
+  # (recommended 'yes' for server (default))
+  obshashrange.warm-cache = no
 """
 
-
 evolutionhelptext = """
 Obsolescence markers make it possible to mark changesets that have been
 deleted or superset in a new version of the changeset.
--- a/hgext3rd/evolve/obsdiscovery.py	Fri May 19 20:52:09 2017 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Sun May 21 14:27:23 2017 +0200
@@ -523,12 +523,17 @@
             con = self._con
             if con is not None:
                 con.execute(_reset)
-            # rewarm the whole cache
+            # rewarm key revisions
+            #
+            # (The current invalidation is too wide, but rewarming every single
+            # revision is quite costly)
+            newrevs = []
             stop = self._cachekey[0] # tiprev
-            if revs:
-                stop = max(revs)
-            if 0 <= stop:
-                revs = repo.changelog.revs(stop=stop)
+            for h in repo.filtered('immutable').changelog.headrevs():
+                if h <= stop:
+                    newrevs.append(h)
+            newrevs.extend(revs)
+            revs = newrevs
 
         # warm the cache for the new revs
         for r in revs:
@@ -672,7 +677,12 @@
                 repo = reporef()
                 if repo is None:
                     return
-                if not repo.ui.configbool('experimental', 'obshashrange', False):
+                hasobshashrange = repo.ui.configbool('experimental',
+                                                     'obshashrange', False)
+                hascachewarm = repo.ui.configbool('experimental',
+                                                  'obshashrange.warm-cache',
+                                                  True)
+                if not (hasobshashrange and hascachewarm):
                     return
                 repo = repo.unfiltered()
                 # As pointed in 'obscache.update', we could have the changelog
--- a/tests/test-discovery-obshashrange.t	Fri May 19 20:52:09 2017 +0200
+++ b/tests/test-discovery-obshashrange.t	Sun May 21 14:27:23 2017 +0200
@@ -62,7 +62,7 @@
   $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(r1)'`
   $ hg debugobsolete bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb `getid 'desc(r2)'`
   $ hg debugobsolete cccccccccccccccccccccccccccccccccccccccc `getid 'desc(r4)'`
-  $ hg debugobsolete dddddddddddddddddddddddddddddddddddddddd `getid 'desc(r5)'`
+  $ hg debugobsolete dddddddddddddddddddddddddddddddddddddddd `getid 'desc(r5)'` --config experimental.obshashrange.warm-cache=0
   $ hg debugobsolete eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee `getid 'desc(r7)'`
   $ hg debugobsolete
   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 66f7d451a68b85ed82ff5fcc254daf50c74144bd 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -95,14 +95,12 @@
   * @0000000000000000000000000000000000000000 (*)> debugobsolete cccccccccccccccccccccccccccccccccccccccc bebd167eb94d257ace0e814aeb98e6972ed2970d exited 0 after *.?? seconds (glob)
   * @0000000000000000000000000000000000000000 (*)> debugobsolete dddddddddddddddddddddddddddddddddddddddd c8d03c1b5e94af74b772900c58259d2e08917735 (glob)
   * @0000000000000000000000000000000000000000 (*)> alias 'debugobsolete' expands to 'debugobsolete -d '0 0'' (glob)
-  * @0000000000000000000000000000000000000000 (*)> obshashcache reset - new markers affect cached ranges (glob)
-  * @0000000000000000000000000000000000000000 (*)> updated evo-ext-obshashrange in *.???? seconds (0r, 1o) (glob)
   * @0000000000000000000000000000000000000000 (*)> updated evo-ext-obscache in *.???? seconds (0r, 1o) (glob)
-  * @0000000000000000000000000000000000000000 (*)> debugobsolete dddddddddddddddddddddddddddddddddddddddd c8d03c1b5e94af74b772900c58259d2e08917735 exited 0 after *.?? seconds (glob)
+  * @0000000000000000000000000000000000000000 (*)> debugobsolete dddddddddddddddddddddddddddddddddddddddd c8d03c1b5e94af74b772900c58259d2e08917735 --config 'experimental.obshashrange.warm-cache=0' exited 0 after *.?? seconds (glob)
   * @0000000000000000000000000000000000000000 (*)> debugobsolete eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee 4de32a90b66cd083ebf3c00b41277aa7abca51dd (glob)
   * @0000000000000000000000000000000000000000 (*)> alias 'debugobsolete' expands to 'debugobsolete -d '0 0'' (glob)
   * @0000000000000000000000000000000000000000 (*)> obshashcache reset - new markers affect cached ranges (glob)
-  * @0000000000000000000000000000000000000000 (*)> updated evo-ext-obshashrange in *.???? seconds (0r, 1o) (glob)
+  * @0000000000000000000000000000000000000000 (*)> updated evo-ext-obshashrange in *.???? seconds (0r, 2o) (glob)
   * @0000000000000000000000000000000000000000 (*)> updated evo-ext-obscache in *.???? seconds (0r, 1o) (glob)
   * @0000000000000000000000000000000000000000 (*)> debugobsolete eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee 4de32a90b66cd083ebf3c00b41277aa7abca51dd exited 0 after *.?? seconds (glob)
   * @0000000000000000000000000000000000000000 (*)> debugobsolete (glob)