[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Why do we check the base checksum so often?

From: Hyrum K Wright <hyrum.wright_at_wandisco.com>
Date: Sat, 4 Feb 2012 09:46:20 -0600

On Sat, Feb 4, 2012 at 9:36 AM, Julian Foad <julianfoad_at_btopenworld.com> wrote:
> Hyrum K Wright wrote:
>
>> The Ev2 shims get in the way of how text deltas are transmitted, by
>> reconstituting the full text, and then just streaming that to the
>> receiver via svn_txdelta_send_stream().  I've got a patch which
>> actually starts reporting the base checksum---which with the shims
>> will always be the "empty" checksum---and it turns out that such a
>> patch breaks the World.
>>
>> The reason for this breakage is that there are several places in both
>> the FS and the WC that we check the delta editor's reported base
>> checksum against some other value we have on hand which we *think*
>> should be the base.  Until now, these checks have always passed, since
>> there was an implicit understanding about what the delta editor would
>> use as its base.
>>
>> However, I think that these checks are wrong.  They rely upon an
>> implementation detail ("is the delta editor sending a text delta
>> against the base we think it ought to?") rather than the result ("did
>> we end up with the content we expected to end up with?")
>
> When we (the WC update code for example) receive a text delta, we apply it to a text base that we already have, in order to create a new text.  We need to be applying it against the correct base text otherwise the result would be nonsense (or the attempt to process the delta against the wrong base text would fail).  The sender/driver doesn't tell us explicitly what base text we should apply the delta to, but it does tell us the checksum so we can confirm we're using the right one.
>

I understand this principle, but I don't think that's what the API
is/should be doing. The apply_textdelta callback is essentially
saying "apply this delta against the base with this checksum". In the
current regime, we know a priori what that base "should" be, so we
make sure that apply_textdelta spits that information back to us.

But I don't think that's always a valid assumption. If the delta
editor chose some other base to use (in this case, the empty stream),
and indicated that through the apply_textdelta() base checksum
parameter, a receiver should be happy to accomodate that request.
"Why should I use the base you told me to use, when I can use this one
more efficiently?"

-Hyrum

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Received on 2012-02-04 16:46:53 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.