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/12/29 21:54:55 UTC

svn commit: r1053731 - /couchdb/trunk/src/couchdb/couch_db_updater.erl

Author: fdmanana
Date: Wed Dec 29 20:54:55 2010
New Revision: 1053731

URL: http://svn.apache.org/viewvc?rev=1053731&view=rev
Log:
Two cleanups in couch_db_updater

It also seems to add a little performance gain:

http://graphs.mikeal.couchone.com/#/graph/8bf31813eef7c0b7e37d1ea259020a0

Closes COUCHDB-1000

Modified:
    couchdb/trunk/src/couchdb/couch_db_updater.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=1053731&r1=1053730&r2=1053731&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_db_updater.erl (original)
+++ couchdb/trunk/src/couchdb/couch_db_updater.erl Wed Dec 29 20:54:55 2010
@@ -618,16 +618,19 @@ update_docs_int(Db, DocsList, NonRepDocs
 
     % Check if we just updated any design documents, and update the validation
     % funs if we did.
-    case [1 || <<"_design/",_/binary>> <- Ids] of
-    [] ->
+    case lists:any(
+        fun(<<"_design/", _/binary>>) -> true; (_) -> false end, Ids) of
+    false ->
         Db4 = Db3;
-    _ ->
+    true ->
         Db4 = refresh_validate_doc_funs(Db3)
     end,
 
     {ok, commit_data(Db4, not FullCommit)}.
 
 
+update_local_docs(Db, []) ->
+    {ok, Db};
 update_local_docs(#db{local_docs_btree=Btree}=Db, Docs) ->
     Ids = [Id || {_Client, #doc{id=Id}} <- Docs],
     OldDocLookups = couch_btree:lookup(Btree, Ids),