diff mercurial/setdiscovery.py @ 23130:ced632394371 stable 3.2

setdiscovery: limit the size of all sample (issue4411) Further digging on this issue show that the limit on the sample size used in discovery never works for heads. Here is a quote from the code itself: desiredlen = size - len(always) if desiredlen <= 0: # This could be bad if there are very many heads, all unknown to the # server. We're counting on long request support here. The long request support never landed and evolution make the "very many heads, all unknown to the server" case quite common. We implement a simple and stupid hard limit of sample size for all query. This should prevent HTTP 414 error with the current state of the code.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sat, 01 Nov 2014 23:52:53 +0000
parents 3ef893520a85
children 86c35b7ae300
line wrap: on
line diff
--- a/mercurial/setdiscovery.py	Sat Nov 01 23:17:50 2014 +0000
+++ b/mercurial/setdiscovery.py	Sat Nov 01 23:52:53 2014 +0000
@@ -203,15 +203,19 @@
         if full:
             ui.note(_("sampling from both directions\n"))
             sample = _takefullsample(dag, undecided, size=fullsamplesize)
+            targetsize = fullsamplesize
         elif common:
             # use cheapish initial sample
             ui.debug("taking initial sample\n")
             sample = _takefullsample(dag, undecided, size=fullsamplesize)
+            targetsize = fullsamplesize
         else:
             # use even cheaper initial sample
             ui.debug("taking quick initial sample\n")
             sample = _takequicksample(dag, undecided, size=initialsamplesize,
                                       initial=True)
+            targetsize = initialsamplesize
+        sample = _limitsample(sample, targetsize)
 
         roundtrips += 1
         ui.progress(_('searching'), roundtrips, unit=_('queries'))