couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r885535 - in /couchdb/branches/0.10.x/src/couchdb: couch_db_updater.erl couch_doc.erl couch_httpd_auth.erl couch_stream.erl
Date Mon, 30 Nov 2009 18:53:36 GMT
Author: jan
Date: Mon Nov 30 18:53:36 2009
New Revision: 885535

URL: http://svn.apache.org/viewvc?rev=885535&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/branches/0.10.x/src/couchdb/couch_db_updater.erl
    couchdb/branches/0.10.x/src/couchdb/couch_doc.erl
    couchdb/branches/0.10.x/src/couchdb/couch_httpd_auth.erl
    couchdb/branches/0.10.x/src/couchdb/couch_stream.erl

Modified: couchdb/branches/0.10.x/src/couchdb/couch_db_updater.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.10.x/src/couchdb/couch_db_updater.erl?rev=885535&r1=885534&r2=885535&view=diff
==============================================================================
--- couchdb/branches/0.10.x/src/couchdb/couch_db_updater.erl (original)
+++ couchdb/branches/0.10.x/src/couchdb/couch_db_updater.erl Mon Nov 30 18:53:36 2009
@@ -641,6 +641,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/branches/0.10.x/src/couchdb/couch_doc.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.10.x/src/couchdb/couch_doc.erl?rev=885535&r1=885534&r2=885535&view=diff
==============================================================================
--- couchdb/branches/0.10.x/src/couchdb/couch_doc.erl (original)
+++ couchdb/branches/0.10.x/src/couchdb/couch_doc.erl Mon Nov 30 18:53:36 2009
@@ -284,8 +284,8 @@
     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, [])).
 
 get_validate_doc_fun(#doc{body={Props}}) ->
     Lang = proplists:get_value(<<"language">>, Props, <<"javascript">>),

Modified: couchdb/branches/0.10.x/src/couchdb/couch_httpd_auth.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.10.x/src/couchdb/couch_httpd_auth.erl?rev=885535&r1=885534&r2=885535&view=diff
==============================================================================
--- couchdb/branches/0.10.x/src/couchdb/couch_httpd_auth.erl (original)
+++ couchdb/branches/0.10.x/src/couchdb/couch_httpd_auth.erl Mon Nov 30 18:53:36 2009
@@ -114,7 +114,6 @@
     % then fall back to querying the db.
     case couch_config:get("admins", ?b2l(UserName)) of
     "-hashed-" ++ HashedPwdAndSalt ->
-        io:format("hashed: '~p'~n", [hashed]),
         [HashedPwd, Salt] = string:tokens(HashedPwdAndSalt, ","),
         [{<<"roles">>, [<<"_admin">>]},
           {<<"salt">>, ?l2b(Salt)},

Modified: couchdb/branches/0.10.x/src/couchdb/couch_stream.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.10.x/src/couchdb/couch_stream.erl?rev=885535&r1=885534&r2=885535&view=diff
==============================================================================
--- couchdb/branches/0.10.x/src/couchdb/couch_stream.erl (original)
+++ couchdb/branches/0.10.x/src/couchdb/couch_stream.erl Mon Nov 30 18:53:36 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