Commit Graph

20 Commits

Author SHA1 Message Date
Matt Mackall
3ad28905f6 tests: drop explicit $TESTDIR from executables
$TESTDIR is added to the path, so this is superfluous. Also,
inconsistent use of quotes means we might have broken on tests with
paths containing spaces.
2015-06-08 14:44:30 -05:00
Pierre-Yves David
281365197e progress: get the extremely verbose output out of default debug
When the progress extension is not enabled, each call to 'ui.progress' used to
issue a debug message. This results is a very verbose output and often redundant
in tests. Dropping it makes tests less volatile to factor they do not meant to
test.

We had to alter the sed trick in 'test-rename-merge2.t'. Sed is used to drop all
output from a certain point and hidding the progress output remove its anchor.
So we anchor on something else.
2015-05-09 23:40:40 -07:00
Matt Harbison
9741c43e48 tests: replace uses of 'seq' with portable 'seq.py' 2015-03-17 21:47:47 -04:00
Pierre-Yves David
6ff053fa11 setdiscovery: always add exponential sample to the heads
As explained in a previous changeset, prioritizing heads too much behaves
pathologically when there are more heads than the sample size. To counter this,
we always inject exponential samples before reducing to the sample size limit.

This already show some benefit in the test themselves, but on a real-world example
this moves my discovery for push to pathologically headed repo from 45 rounds to
17 of them.

We should maybe ensure that at least 25% of the result sample is heads, but I
think the random sampling will be fine in practice.
2015-01-07 17:28:51 -08:00
Pierre-Yves David
60a9cd0334 setdiscovery: directly run '_updatesample'
The heads and exponential sample are going to end up in the same set
before any extra processing happens. We simplify the code by directly
updating a set with heads.

Changes in the order the set is built lead to small changes in the random
sampling output. But after double checking, I can confirm the input data to
the random sampling is consistent.
2015-01-07 17:23:21 -08:00
Pierre-Yves David
e3605ecf1f setdiscovery: randomly pick between heads and sample when taking full sample
Before this changeset, the discovery protocol was too heads-centric. Heads of the
undiscovered set were always sent for discovery and any room remaining in the
sample were filled with exponential samples (and random ones if any room
remained).

This behaved extremely poorly when the number of heads exceeded the sample size,
because we keep just asking about the existence of heads, then their direct parent
and so on. As a result, the 'O(log(len(repo)))' discovery turns into a
'O(len(repo))' one. As a solution we take a random sample of the heads plus
exponential samples. This way we ensure some exponential sampling is achieved,
bringing back some logarithmic convergence of the discovery again.

This patch only applies this principle in one place. More places will be updated
in future patches.

One test is impacted because the random sample happen to be different. By
chance, it helps a bit in this case.
2015-01-07 12:09:51 -08:00
Eric Sumner
7be426bb53 incoming: handle phases the same as pull
Now that bundlerepo can move phases safely, 'hg incoming' can share its phase
handling code with pull to better reflect what would actually show up.
2014-12-18 12:33:17 -08:00
Mads Kiilerich
f7f618d52d discovery: test coverage for issue4438 / 475a22a41c55 / a720a37e15a3
The randomness in the discovery protocol made this problem hard to reproduce.
The test mocks random.sample to make sure we hit the problem every time. The
set iteration order also made the output unstable ... but with the issue fixed,
it is stable.
2014-11-06 01:48:29 +01:00
Pierre-Yves David
1b8f2c7e41 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.
2014-11-01 23:52:53 +00:00
Pierre-Yves David
e107a615ed setdiscovery: limit the size of the initial sample (issue4411)
The set discovery start by sending a "known" command with all local heads. When
the number of local heads is massive (eg: using hidden changesets) such request
becomes too large. This lead to 414 error over http, aborting the whole
process.

We limit the size of the sample used by the first query to fix this.

The test are impacted because they do test massive number of heads. But they do
not test it over real world http setup.
2014-10-27 17:52:33 +01:00
Mads Kiilerich
7f9b497a4c incoming: don't request heads that already are common
Pull would send a getbundle command where common heads were sent both as common
and head, even though there is no reason to request a common head.
The request was thus twice as big as necessary and more likely to hit HTTP
header size limits.

Instead, don't request heads that already are common.

This is fixed in bundlerepo.getremotechanges . It could perhaps also have been
fixed in discovery.findcommonincoming but that would have a bigger impact.
2014-08-15 03:24:40 +02:00
Mads Kiilerich
c6b11d841f tests: improve test coverage for discovery and actual parameters for pulling 2014-08-15 03:24:40 +02:00
Mads Kiilerich
d5ef6b65bb debugdiscovery: report heads in sorted order 2012-12-12 02:38:14 +01:00
Mads Kiilerich
fa1c4e5ebe tests: add missing trailing 'cd ..'
Many tests didn't change back from subdirectories at the end of the tests ...
and they don't have to. The missing 'cd ..' could always be added when another
test case is added to the test file.

This change do that tests (99.5%) consistently end up in $TESTDIR where they
started, thus making it simpler to extend them or move them around.
2012-06-11 01:40:51 +02:00
Lee Cantey
c042f32203 test-setdiscovery: allow for leading space in output of wc 2011-09-12 09:20:31 -07:00
Peter Arrenbrecht
83352215f8 setdiscovery: fix hang when #heads>200 (issue2971)
When setting up the next sample, we always add all of the heads, regardless
of the desired max sample size. But if the number of heads exceeds this
size, then we don't add any more nodes from the still undecided set.
(This is debatable per se, and I'll investigate it, but it's how we designed
it at the moment.)

The bug was that we always added the overall heads, not the heads of the
remaining undecided set. Thus, if #heads>200 (desired sample size), we
did not make progress any longer.
2011-08-25 21:25:14 +02:00
Peter Arrenbrecht
bc696e8298 dagutil: fix off-by-one in inverserevlogdag buildup 2011-08-25 17:20:00 +02:00
Mads Kiilerich
2c9adcac85 tests: solaris [ doesn't know -e 2011-06-25 01:55:16 +02:00
Peter Arrenbrecht
9a2d2f747c setdiscovery: batch heads and known(ownheads)
This means that we now discover both subset conditions (local<remote and
remote<local) in a single roundtrip without ever constructing an actual
sample (which takes a bit of client CPU).
2011-06-14 22:58:00 +02:00
Peter Arrenbrecht
75fa0e5ea9 discovery: add new set-based discovery
Adds a new discovery method based on repeatedly sampling the still
undecided subset of the local node graph to determine the set of nodes
common to both the client and the server.

For small differences between client and server, it uses about the same
or slightly fewer roundtrips than the old tree-based discovery. For
larger differences, it typically reduces the number of roundtrips
drastically (from 150 to 4, for instance).

The old discovery code now lives in treediscovery.py, the new code is
in setdiscovery.py.

Still missing is a hook for extensions to contribute nodes to the
initial sample. For instance, Augie's remotebranches could contribute
the last known state of the server's heads.

Credits for the actual sampler and computing common heads instead of
bases go to Benoit Boissinot.
2011-05-02 19:21:30 +02:00