Patchwork [remotefilelog-ext] fileserverclient: make iterbatch() case work with new store

login
register
mail settings
Submitter via Mercurial-devel
Date May 19, 2016, 5:58 a.m.
Message ID <e1d21752505c55a83509.1463637512@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/15173/
State Superseded
Headers show

Comments

via Mercurial-devel - May 19, 2016, 5:58 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1463636360 25200
#      Wed May 18 22:39:20 2016 -0700
# Node ID e1d21752505c55a83509685159d6ed8d4b50d6ae
# Parent  3df8af03df789dee35c6026fce5ec1a59b43cca0
fileserverclient: make iterbatch() case work with new store

The iterbatch() handling added in 08ca5042a8a1 (fileserverclient: use
new iterbatch() method, 2016-03-22) was broken by 06d5f64ccb7c (store:
change fileserviceclient to write via new store, 2016-04-04). Fix it
by copying the pattern introduced elsewhere in that change.
Durham Goode - May 20, 2016, 4:21 p.m.
Do no tests execute this code path?  Can we add a test if not?  That way I don’t break you guys when doing future refactors.

On 5/19/16, 1:58 AM, "Martin von Zweigbergk" <martinvonz@google.com> wrote:

># HG changeset patch

># User Martin von Zweigbergk <martinvonz@google.com>

># Date 1463636360 25200

>#      Wed May 18 22:39:20 2016 -0700

># Node ID e1d21752505c55a83509685159d6ed8d4b50d6ae

># Parent  3df8af03df789dee35c6026fce5ec1a59b43cca0

>fileserverclient: make iterbatch() case work with new store

>

>The iterbatch() handling added in 08ca5042a8a1 (fileserverclient: use

>new iterbatch() method, 2016-03-22) was broken by 06d5f64ccb7c (store:

>change fileserviceclient to write via new store, 2016-04-04). Fix it

>by copying the pattern introduced elsewhere in that change.

>

>diff -r 3df8af03df78 -r e1d21752505c remotefilelog/fileserverclient.py

>--- a/remotefilelog/fileserverclient.py	Mon Jan 04 21:32:21 2016 -0800

>+++ b/remotefilelog/fileserverclient.py	Wed May 18 22:39:20 2016 -0700

>@@ -146,7 +146,9 @@

>             b.getfile(file_, node)

>         b.submit()

>         for m, r in itertools.izip(missed, b.results()):

>-            receivemissing(io.BytesIO('%d\n%s' % (len(r), r)), m)

>+            file_ = idmap[m]

>+            node = m[-40:]

>+            receivemissing(io.BytesIO('%d\n%s' % (len(r), r)), file_, node)

>             progresstick()

>         return

>     while missed:
via Mercurial-devel - May 20, 2016, 8:10 p.m.
On Fri, May 20, 2016 at 9:21 AM, Durham Goode <durham@fb.com> wrote:
> Do no tests execute this code path?  Can we add a test if not?  That way I don’t break you guys when doing future refactors.

After spending some time to figure out how it worked, it turned out to
be relatively simple. v2 coming up.

>
> On 5/19/16, 1:58 AM, "Martin von Zweigbergk" <martinvonz@google.com> wrote:
>
>># HG changeset patch
>># User Martin von Zweigbergk <martinvonz@google.com>
>># Date 1463636360 25200
>>#      Wed May 18 22:39:20 2016 -0700
>># Node ID e1d21752505c55a83509685159d6ed8d4b50d6ae
>># Parent  3df8af03df789dee35c6026fce5ec1a59b43cca0
>>fileserverclient: make iterbatch() case work with new store
>>
>>The iterbatch() handling added in 08ca5042a8a1 (fileserverclient: use
>>new iterbatch() method, 2016-03-22) was broken by 06d5f64ccb7c (store:
>>change fileserviceclient to write via new store, 2016-04-04). Fix it
>>by copying the pattern introduced elsewhere in that change.
>>
>>diff -r 3df8af03df78 -r e1d21752505c remotefilelog/fileserverclient.py
>>--- a/remotefilelog/fileserverclient.py        Mon Jan 04 21:32:21 2016 -0800
>>+++ b/remotefilelog/fileserverclient.py        Wed May 18 22:39:20 2016 -0700
>>@@ -146,7 +146,9 @@
>>             b.getfile(file_, node)
>>         b.submit()
>>         for m, r in itertools.izip(missed, b.results()):
>>-            receivemissing(io.BytesIO('%d\n%s' % (len(r), r)), m)
>>+            file_ = idmap[m]
>>+            node = m[-40:]
>>+            receivemissing(io.BytesIO('%d\n%s' % (len(r), r)), file_, node)
>>             progresstick()
>>         return
>>     while missed:
>

Patch

diff -r 3df8af03df78 -r e1d21752505c remotefilelog/fileserverclient.py
--- a/remotefilelog/fileserverclient.py	Mon Jan 04 21:32:21 2016 -0800
+++ b/remotefilelog/fileserverclient.py	Wed May 18 22:39:20 2016 -0700
@@ -146,7 +146,9 @@ 
             b.getfile(file_, node)
         b.submit()
         for m, r in itertools.izip(missed, b.results()):
-            receivemissing(io.BytesIO('%d\n%s' % (len(r), r)), m)
+            file_ = idmap[m]
+            node = m[-40:]
+            receivemissing(io.BytesIO('%d\n%s' % (len(r), r)), file_, node)
             progresstick()
         return
     while missed: