##// END OF EJS Templates
discovery: add a devel.discovery.exchange-heads...
marmoute -
r47034:6ee9bd69 default
parent child Browse files
Show More
@@ -702,6 +702,13 b' coreconfigitem('
702 b'debug.peer-request',
702 b'debug.peer-request',
703 default=False,
703 default=False,
704 )
704 )
705 # If discovery.exchange-heads is False, the discovery will not start with
706 # remote head fetching and local head querying.
707 coreconfigitem(
708 b'devel',
709 b'discovery.exchange-heads',
710 default=True,
711 )
705 # If discovery.grow-sample is False, the sample size used in set discovery will
712 # If discovery.grow-sample is False, the sample size used in set discovery will
706 # not be increased through the process
713 # not be increased through the process
707 coreconfigitem(
714 coreconfigitem(
@@ -314,6 +314,8 b' def findcommonheads('
314 else:
314 else:
315 ownheads = [rev for rev in cl.headrevs() if rev != nullrev]
315 ownheads = [rev for rev in cl.headrevs() if rev != nullrev]
316
316
317 initial_head_exchange = ui.configbool(b'devel', b'discovery.exchange-heads')
318
317 # We also ask remote about all the local heads. That set can be arbitrarily
319 # We also ask remote about all the local heads. That set can be arbitrarily
318 # large, so we used to limit it size to `initialsamplesize`. We no longer
320 # large, so we used to limit it size to `initialsamplesize`. We no longer
319 # do as it proved counter productive. The skipped heads could lead to a
321 # do as it proved counter productive. The skipped heads could lead to a
@@ -365,6 +367,7 b' def findcommonheads('
365 # graph (with many heads) attached to, but very independant to a the
367 # graph (with many heads) attached to, but very independant to a the
366 # "simple" graph on the server. This is a fairly usual case and have
368 # "simple" graph on the server. This is a fairly usual case and have
367 # not been met in the wild so far.
369 # not been met in the wild so far.
370 if initial_head_exchange:
368 if remote.limitedarguments:
371 if remote.limitedarguments:
369 sample = _limitsample(ownheads, initialsamplesize)
372 sample = _limitsample(ownheads, initialsamplesize)
370 # indices between sample and externalized version must match
373 # indices between sample and externalized version must match
@@ -392,6 +395,11 b' def findcommonheads('
392 if srvheadhashes != [nullid]:
395 if srvheadhashes != [nullid]:
393 return [nullid], True, srvheadhashes
396 return [nullid], True, srvheadhashes
394 return [nullid], False, []
397 return [nullid], False, []
398 else:
399 # we still need the remote head for the function return
400 with remote.commandexecutor() as e:
401 fheads = e.callcommand(b'heads', {})
402 srvheadhashes = fheads.result()
395
403
396 # start actual discovery (we note this before the next "if" for
404 # start actual discovery (we note this before the next "if" for
397 # compatibility reasons)
405 # compatibility reasons)
@@ -408,6 +416,7 b' def findcommonheads('
408 except error.LookupError:
416 except error.LookupError:
409 continue
417 continue
410
418
419 if initial_head_exchange:
411 # early exit if we know all the specified remote heads already
420 # early exit if we know all the specified remote heads already
412 if len(knownsrvheads) == len(srvheadhashes):
421 if len(knownsrvheads) == len(srvheadhashes):
413 ui.debug(b"all remote heads known locally\n")
422 ui.debug(b"all remote heads known locally\n")
@@ -429,12 +438,13 b' def findcommonheads('
429 disco = partialdiscovery(
438 disco = partialdiscovery(
430 local, ownheads, hard_limit_sample, randomize=randomize
439 local, ownheads, hard_limit_sample, randomize=randomize
431 )
440 )
441 if initial_head_exchange:
432 # treat remote heads (and maybe own heads) as a first implicit sample
442 # treat remote heads (and maybe own heads) as a first implicit sample
433 # response
443 # response
434 disco.addcommons(knownsrvheads)
444 disco.addcommons(knownsrvheads)
435 disco.addinfo(zip(sample, yesno))
445 disco.addinfo(zip(sample, yesno))
436
446
437 full = False
447 full = not initial_head_exchange
438 progress = ui.makeprogress(_(b'searching'), unit=_(b'queries'))
448 progress = ui.makeprogress(_(b'searching'), unit=_(b'queries'))
439 while not disco.iscomplete():
449 while not disco.iscomplete():
440
450
@@ -1412,23 +1412,22 b' One with >200 heads. We now switch to se'
1412 missing: 1040
1412 missing: 1040
1413 common heads: 3ee37d65064a
1413 common heads: 3ee37d65064a
1414
1414
1415 $ hg -R a debugdiscovery b --debug --config devel.discovery.randomize=false --config devel.discovery.grow-sample.rate=1.01
1415 $ hg -R a debugdiscovery b --debug --config devel.discovery.exchange-heads=false --config devel.discovery.randomize=false --config devel.discovery.grow-sample.rate=1.01
1416 comparing with b
1416 comparing with b
1417 query 1; heads
1418 searching for changes
1417 searching for changes
1419 taking quick initial sample
1420 query 2; still undecided: 1080, sample size is: 100
1421 sampling from both directions
1418 sampling from both directions
1422 query 3; still undecided: 980, sample size is: 200
1419 query 1; still undecided: 1340, sample size is: 200
1420 sampling from both directions
1421 query 2; still undecided: 795, sample size is: 202
1423 sampling from both directions
1422 sampling from both directions
1424 query 4; still undecided: 497, sample size is: 202
1423 query 3; still undecided: 525, sample size is: 204
1425 sampling from both directions
1424 sampling from both directions
1426 query 5; still undecided: 294, sample size is: 204
1425 query 4; still undecided: 252, sample size is: 206
1427 sampling from both directions
1426 sampling from both directions
1428 query 6; still undecided: 90, sample size is: 90
1427 query 5; still undecided: 44, sample size is: 44
1429 6 total queries in *s (glob)
1428 5 total queries in *s (glob)
1430 elapsed time: * seconds (glob)
1429 elapsed time: * seconds (glob)
1431 round-trips: 6
1430 round-trips: 5
1432 heads summary:
1431 heads summary:
1433 total common heads: 1
1432 total common heads: 1
1434 also local heads: 0
1433 also local heads: 0
General Comments 0
You need to be logged in to leave comments. Login now