couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Kocoloski <kocol...@apache.org>
Subject Re: Attachment Replication Problem - Bug Found
Date Fri, 29 May 2009 04:58:09 GMT
Thanks for catching this, Antony.  I did apply your patch correctly,  
but the tail-append merge introduced a regression.  Best,

Adam

On May 29, 2009, at 12:37 AM, Antony Blakey wrote:

> Problem solved! It's actually the original problem - the patch I  
> submitted was misapplied. The problem is in couch_rep - this code:
>
> write_streamed_attachment(Stream, F, LenLeft) ->
>    Bin = F(),
>    ok = couch_stream:write(Stream, check_bin_length(LenLeft, Bin)),
>    write_streamed_attachment(Stream, F, LenLeft - size(Bin)).
>
> needs to be this:
>
> write_streamed_attachment(Stream, F, LenLeft) ->
>    Bin = F(),
>    TruncatedBin = check_bin_length(LenLeft, Bin),
>    ok = couch_stream:write(Stream, TruncatedBin),
>    write_streamed_attachment(Stream, F, LenLeft - size(TruncatedBin)).
>
> The problem is the last parameter to write_streamed_attachment being  
> < 0 when the data is too long.
>
> Antony Blakey
> --------------------------
> CTO, Linkuistics Pty Ltd
> Ph: 0438 840 787
>
> Always have a vision. Why spend your life making other people’s  
> dreams?
> -- Orson Welles (1915-1985)
>


Mime
View raw message