Patchwork D9799: discovery: add a discovery.grow-sample.rate

login
register
mail settings
Submitter phabricator
Date Jan. 16, 2021, 12:26 a.m.
Message ID <differential-rev-PHID-DREV-ltw4edir3paeolhxsdu5-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48111/
State Superseded
Headers show

Comments

phabricator - Jan. 16, 2021, 12:26 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This allow to control the effect of the growth rate on the discovery process
  while doing analysis.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/setdiscovery.py
  tests/test-setdiscovery.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-setdiscovery.t b/tests/test-setdiscovery.t
--- a/tests/test-setdiscovery.t
+++ b/tests/test-setdiscovery.t
@@ -1412,6 +1412,48 @@ 
       missing:                1040
   common heads: 3ee37d65064a
 
+  $ hg -R a debugdiscovery b --debug --config devel.discovery.randomize=false --config devel.discovery.grow-sample.rate=1.01
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  query 2; still undecided: 1080, sample size is: 100
+  sampling from both directions
+  query 3; still undecided: 980, sample size is: 200
+  sampling from both directions
+  query 4; still undecided: 497, sample size is: 202
+  sampling from both directions
+  query 5; still undecided: 294, sample size is: 204
+  sampling from both directions
+  query 6; still undecided: 90, sample size is: 90
+  6 total queries in *s (glob)
+  elapsed time: * seconds (glob)
+  round-trips:                   6
+  heads summary:
+    total common heads:          1
+      also local heads:          0
+      also remote heads:         0
+      both:                      0
+    local heads:               260
+      common:                    0
+      missing:                 260
+    remote heads:                1
+      common:                    0
+      unknown:                   1
+  local changesets:           1340
+    common:                    300
+      heads:                     1
+      roots:                     1
+    missing:                  1040
+      heads:                   260
+      roots:                   260
+    first undecided set:      1340
+      heads:                   260
+      roots:                     1
+      common:                  300
+      missing:                1040
+  common heads: 3ee37d65064a
+
 Test actual protocol when pulling one new head in addition to common heads
 
   $ hg clone -U b c
diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -290,7 +290,6 @@ 
     fullsamplesize=200,
     abortwhenunrelated=True,
     ancestorsof=None,
-    samplegrowth=1.05,
     audit=None,
 ):
     """Return a tuple (common, anyincoming, remoteheads) used to identify
@@ -300,6 +299,9 @@ 
     will be updated with extra data about the discovery, this is useful for
     debug.
     """
+
+    samplegrowth = float(ui.config(b'devel', b'discovery.grow-sample.rate'))
+
     start = util.timer()
 
     roundtrips = 0
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -707,6 +707,12 @@ 
     b'discovery.grow-sample',
     default=True,
 )
+# discovery.grow-sample.rate control the rate at which the sample grow
+coreconfigitem(
+    b'devel',
+    b'discovery.grow-sample.rate',
+    default=1.05,
+)
 # If discovery.randomize is False, random sampling during discovery are
 # deterministic. It is meant for integration tests.
 coreconfigitem(