You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2010/07/17 00:56:55 UTC

svn commit: r964971 - in /couchdb/branches/1.0.x/src/couchdb: couch_db.erl couch_rep_att.erl

Author: fdmanana
Date: Fri Jul 16 22:56:55 2010
New Revision: 964971

URL: http://svn.apache.org/viewvc?rev=964971&view=rev
Log:
Revert revision	964957 (COUCHDB-827) - solution had secondary effects.


Modified:
    couchdb/branches/1.0.x/src/couchdb/couch_db.erl
    couchdb/branches/1.0.x/src/couchdb/couch_rep_att.erl

Modified: couchdb/branches/1.0.x/src/couchdb/couch_db.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/src/couchdb/couch_db.erl?rev=964971&r1=964970&r2=964971&view=diff
==============================================================================
--- couchdb/branches/1.0.x/src/couchdb/couch_db.erl (original)
+++ couchdb/branches/1.0.x/src/couchdb/couch_db.erl Fri Jul 16 22:56:55 2010
@@ -901,20 +901,10 @@ with_stream(Fd, #att{md5=InMd5,type=Type
 
 write_streamed_attachment(_Stream, _F, 0) ->
     ok;
-% LenLeft might be different from the total size of what function F returns.
-% This happens when doing a pull replication of compressed attachments from a
-% 0.11.0 server, where LenLeft will match the uncompressed size but we end up
-% receiving the attachment compressed (therefore a size different from LenLeft).
-% This is because 0.11.0 doesn't understand the query parameter
-% "?att_encoding_info=true" when we do a doc request (GET /somedb/somedoc).
 write_streamed_attachment(Stream, F, LenLeft) ->
-    case F() of
-    Bin when is_binary(Bin) ->
-        ok = couch_stream:write(Stream, Bin),
-        write_streamed_attachment(Stream, F, LenLeft - size(Bin));
-    eof ->
-        ok
-    end.
+    Bin = F(),
+    ok = couch_stream:write(Stream, Bin),
+    write_streamed_attachment(Stream, F, LenLeft - size(Bin)).
 
 enum_docs_since_reduce_to_count(Reds) ->
     couch_btree:final_reduce(

Modified: couchdb/branches/1.0.x/src/couchdb/couch_rep_att.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/src/couchdb/couch_rep_att.erl?rev=964971&r1=964970&r2=964971&view=diff
==============================================================================
--- couchdb/branches/1.0.x/src/couchdb/couch_rep_att.erl (original)
+++ couchdb/branches/1.0.x/src/couchdb/couch_rep_att.erl Fri Jul 16 22:56:55 2010
@@ -81,12 +81,8 @@ receive_data(Ref, ReqId, ContentEncoding
         % ?LOG_DEBUG("got ~p bytes for ~p", [size(Data), ReqId]),
         Data;
     {ibrowse_async_response_end, ReqId} ->
-        % This means ibrowse received all the data it was supposed to.
-        % In case of not receiving the whole data, due to a network link
-        % failure for example, we would have received an error message.
-        % In other words, this message doesn't represent an error - look into
-        % ibrowse_http_client.erl.
-        eof
+        ?LOG_ERROR("streaming att. ended but more data requested ~p", [ReqId]),
+        throw({attachment_request_failed, premature_end})
     after 31000 ->
         throw({attachment_request_failed, timeout})
     end.