subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hyrum K Wright <>
Subject Re: Why do we check the base checksum so often?
Date Sat, 04 Feb 2012 15:46:20 GMT
On Sat, Feb 4, 2012 at 9:36 AM, Julian Foad <> 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

View raw message