couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r885542 - in /couchdb/trunk/src/couchdb: couch_db_updater.erl couch_doc.erl couch_stream.erl
Date Mon, 30 Nov 2009 19:10:08 GMT
Author: jan
Date: Mon Nov 30 19:10:08 2009
New Revision: 885542

URL: http://svn.apache.org/viewvc?rev=885542&view=rev
Log:
Fix two issues for databases upgraded from 0.9.x:
 - Compaction would fail.
 - GET /db/doc?attachments=true would generate a 500.

Modified:
    couchdb/trunk/src/couchdb/couch_db_updater.erl
    couchdb/trunk/src/couchdb/couch_doc.erl
    couchdb/trunk/src/couchdb/couch_stream.erl

Modified: couchdb/trunk/src/couchdb/couch_db_updater.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_db_updater.erl?rev=885542&r1=885541&r2=885542&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_db_updater.erl (original)
+++ couchdb/trunk/src/couchdb/couch_db_updater.erl Mon Nov 30 19:10:08 2009
@@ -704,6 +704,10 @@
             % 09 UPGRADE CODE
             {NewBinSp, Len, Md5} = couch_stream:copy_to_new_stream(SrcFd, BinSp, DestFd),
             {Name, Type, NewBinSp, Len, Pos, Md5};
+        ({Name, Type, BinSp, Len, RevPos, <<>>}) when is_tuple(BinSp) orelse
BinSp == null ->
+            % 09 UPGRADE CODE
+            {NewBinSp, Len, Md5} = couch_stream:old_copy_to_new_stream(SrcFd, BinSp, Len,
DestFd),
+            {Name, Type, NewBinSp, Len, Len, Md5};
         ({Name, Type, BinSp, Len, RevPos, Md5}) ->
             {NewBinSp, Len, Md5} = couch_stream:copy_to_new_stream(SrcFd, BinSp, DestFd),
             {Name, Type, NewBinSp, Len, RevPos, Md5}

Modified: couchdb/trunk/src/couchdb/couch_doc.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_doc.erl?rev=885542&r1=885541&r2=885542&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_doc.erl (original)
+++ couchdb/trunk/src/couchdb/couch_doc.erl Mon Nov 30 19:10:08 2009
@@ -285,9 +285,9 @@
     Bin;
 att_to_iolist(#att{data=Iolist}) when is_list(Iolist) ->
     Iolist;
-att_to_iolist(#att{data={Fd,Sp},md5=Md5}) ->
-    lists:reverse(couch_stream:foldl(Fd, Sp, Md5, 
-            fun(Bin,Acc) -> [Bin|Acc] end, []));
+att_to_iolist(#att{data={Fd,Sp}}=Att) ->
+    lists:reverse(att_foldl(Att,
+        fun(Bin,Acc) -> [Bin|Acc] end, []));
 att_to_iolist(#att{data=DataFun, len=Len}) when is_function(DataFun)->
     lists:reverse(fold_streamed_data(DataFun, Len,
             fun(Data, Acc) -> [Data | Acc] end, [])).

Modified: couchdb/trunk/src/couchdb/couch_stream.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_stream.erl?rev=885542&r1=885541&r2=885542&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_stream.erl (original)
+++ couchdb/trunk/src/couchdb/couch_stream.erl Mon Nov 30 19:10:08 2009
@@ -73,7 +73,8 @@
 old_foldl(_Fd, null, 0, _Fun, Acc) ->
     Acc;
 old_foldl(Fd, OldPointer, Len, Fun, Acc) when is_tuple(OldPointer)->
-    old_stream_data(Fd, OldPointer, Len, ?DEFAULT_STREAM_CHUNK, Fun, Acc).
+    {ok, Acc2, _} = old_stream_data(Fd, OldPointer, Len, ?DEFAULT_STREAM_CHUNK, Fun, Acc),
+    Acc2.
 
 foldl(_Fd, [], _Fun, Acc) ->
     Acc;



Mime
View raw message