comparison 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
comparison
equal deleted inserted replaced
23129:eb315418224c 23130:ced632394371
201 break 201 break
202 202
203 if full: 203 if full:
204 ui.note(_("sampling from both directions\n")) 204 ui.note(_("sampling from both directions\n"))
205 sample = _takefullsample(dag, undecided, size=fullsamplesize) 205 sample = _takefullsample(dag, undecided, size=fullsamplesize)
206 targetsize = fullsamplesize
206 elif common: 207 elif common:
207 # use cheapish initial sample 208 # use cheapish initial sample
208 ui.debug("taking initial sample\n") 209 ui.debug("taking initial sample\n")
209 sample = _takefullsample(dag, undecided, size=fullsamplesize) 210 sample = _takefullsample(dag, undecided, size=fullsamplesize)
211 targetsize = fullsamplesize
210 else: 212 else:
211 # use even cheaper initial sample 213 # use even cheaper initial sample
212 ui.debug("taking quick initial sample\n") 214 ui.debug("taking quick initial sample\n")
213 sample = _takequicksample(dag, undecided, size=initialsamplesize, 215 sample = _takequicksample(dag, undecided, size=initialsamplesize,
214 initial=True) 216 initial=True)
217 targetsize = initialsamplesize
218 sample = _limitsample(sample, targetsize)
215 219
216 roundtrips += 1 220 roundtrips += 1
217 ui.progress(_('searching'), roundtrips, unit=_('queries')) 221 ui.progress(_('searching'), roundtrips, unit=_('queries'))
218 ui.debug("query %i; still undecided: %i, sample size is: %i\n" 222 ui.debug("query %i; still undecided: %i, sample size is: %i\n"
219 % (roundtrips, len(undecided), len(sample))) 223 % (roundtrips, len(undecided), len(sample)))