couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Blakey <antony.bla...@gmail.com>
Subject Re: Attachment Replication Problem - Bug Found
Date Fri, 29 May 2009 04:37:39 GMT
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