[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: Bert Huijben <bert_at_qqmail.nl>
Date: Sat, 4 Feb 2012 09:06:56 -0800

We could change that for Ev2 but how are you going to change Subversion

Can I borrow your time-machine? ;-)

Md5 is not unique enough to pick a base.

Bert Huijben (Cell phone)
From: Hyrum K Wright
Sent: 4-2-2012 7:46
To: Julian Foad
Cc: Subversion Development
Subject: Re: Why do we check the base checksum so often?
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?"


uberSVN: Apache Subversion Made Easy
Received on 2012-02-04 18:07:33 CET

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