Patchwork [2,of,2,stable] discovery: indices between sample and yesno must match (issue4438)

login
register
mail settings
Submitter Mads Kiilerich
Date Nov. 5, 2014, 12:06 p.m.
Message ID <c6c7123f623ca707b4b8.1415189211@ssl.google-analytics.com>
Download mbox | patch
Permalink /patch/6573/
State Superseded
Commit 73cfaa34865061744250a63ed01e970ad7a4bf3d
Headers show

Comments

Mads Kiilerich - Nov. 5, 2014, 12:06 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1415189132 -3600
#      Wed Nov 05 13:05:32 2014 +0100
# Branch stable
# Node ID c6c7123f623ca707b4b8382c82178e5eded22c3a
# Parent  2396965a3523fce4059beba5c6c8ff9873000afd
discovery: indices between sample and yesno must match (issue4438)

3ef893520a85 changed 'sample' from a list to a set. The iteration order is thus
undefined and the yesno indices are not stable.

To solve this, repeat the listification and comment from elsewhere in the code.

Note: the randomness in the discovery protocol can make this problem hard to
reproduce.
Pierre-Yves David - Nov. 5, 2014, 12:54 p.m.
On 11/05/2014 12:06 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1415189132 -3600
> #      Wed Nov 05 13:05:32 2014 +0100
> # Branch stable
> # Node ID c6c7123f623ca707b4b8382c82178e5eded22c3a
> # Parent  2396965a3523fce4059beba5c6c8ff9873000afd
> discovery: indices between sample and yesno must match (issue4438)

This series lack test to avoid regression. I'll give a shot at building 
some.
Pierre-Yves David - Nov. 5, 2014, 2:34 p.m.
On 11/05/2014 12:54 PM, Pierre-Yves David wrote:
>
>
> On 11/05/2014 12:06 PM, Mads Kiilerich wrote:
>> # HG changeset patch
>> # User Mads Kiilerich <madski@unity3d.com>
>> # Date 1415189132 -3600
>> #      Wed Nov 05 13:05:32 2014 +0100
>> # Branch stable
>> # Node ID c6c7123f623ca707b4b8382c82178e5eded22c3a
>> # Parent  2396965a3523fce4059beba5c6c8ff9873000afd
>> discovery: indices between sample and yesno must match (issue4438)
>
> This series lack test to avoid regression. I'll give a shot at building
> some.

I've been unable to build a repro so far. I need more information.
Matt Mackall - Nov. 5, 2014, 4:46 p.m.
On Wed, 2014-11-05 at 13:06 +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1415189132 -3600
> #      Wed Nov 05 13:05:32 2014 +0100
> # Branch stable
> # Node ID c6c7123f623ca707b4b8382c82178e5eded22c3a
> # Parent  2396965a3523fce4059beba5c6c8ff9873000afd
> discovery: indices between sample and yesno must match (issue4438)

Looks good, queued for stable.

Do we have a way to test the discovery algorithm by itself without
building a repo?

Patch

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -134,6 +134,8 @@  def findcommonheads(ui, local, remote,
     roundtrips += 1
     ownheads = dag.heads()
     sample = _limitsample(ownheads, initialsamplesize)
+    # indices between sample and externalized version must match
+    sample = list(sample)
     if remote.local():
         # stopgap until we have a proper localpeer that supports batch()
         srvheadhashes = remote.heads()