D10233: setdiscovery: add a discovery.grow-sample.dynamic option
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Wed Mar 17 22:17:20 UTC 2021
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
The current discovery dynamically adapt to complex situations. This make is quick
effective, but also harder so study the effect of other improvements in such
complex situation.
So we add a new option to control this too.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D10233
AFFECTED FILES
mercurial/configitems.py
mercurial/debugcommands.py
mercurial/setdiscovery.py
CHANGE DETAILS
diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -429,12 +429,16 @@
# full blown discovery
# if the server has a limit to its arguments size, we can't grow the sample.
- grow_sample = local.ui.configbool(b'devel', b'discovery.grow-sample')
+ configbool = local.ui.configbool
+ grow_sample = configbool(b'devel', b'discovery.grow-sample')
grow_sample = grow_sample and not remote.limitedarguments
+ dynamic_sample = configbool(b'devel', b'discovery.grow-sample.dynamic')
+ hard_limit_sample = not (dynamic_sample or remote.limitedarguments)
+
randomize = ui.configbool(b'devel', b'discovery.randomize')
disco = partialdiscovery(
- local, ownheads, not grow_sample, randomize=randomize
+ local, ownheads, hard_limit_sample, randomize=randomize
)
if initial_head_exchange:
# treat remote heads (and maybe own heads) as a first implicit sample
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1024,6 +1024,12 @@
If False, the sample size used in set discovery will not be increased
through the process
+ * devel.discovery.grow-sample.dynamic=True
+
+ When discovery.grow-sample.dynamic is True, the default, the sample size is
+ adapted to the shape of the undecided set (it is set to the max of:
+ <target-size>, len(roots(undecided)), len(heads(undecided)
+
* devel.discovery.grow-sample.rate=1.05
the rate at which the sample grow
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -737,6 +737,14 @@
b'discovery.grow-sample',
default=True,
)
+# When discovery.grow-sample.dynamic is True, the default, the sample size is
+# adapted to the shape of the undecided set (it is set to the max of:
+# <target-size>, len(roots(undecided)), len(heads(undecided)
+coreconfigitem(
+ b'devel',
+ b'discovery.grow-sample.dynamic',
+ default=True,
+)
# discovery.grow-sample.rate control the rate at which the sample grow
coreconfigitem(
b'devel',
To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list