You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2008/07/18 14:57:08 UTC

svn commit: r677892 - in /incubator/couchdb/trunk/src/couchdb: couch_doc.erl couch_rep.erl

Author: damien
Date: Fri Jul 18 05:57:07 2008
New Revision: 677892

URL: http://svn.apache.org/viewvc?rev=677892&view=rev
Log:
Fix for problem when saving bulk documents with invalid ids

Modified:
    incubator/couchdb/trunk/src/couchdb/couch_doc.erl
    incubator/couchdb/trunk/src/couchdb/couch_rep.erl

Modified: incubator/couchdb/trunk/src/couchdb/couch_doc.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_doc.erl?rev=677892&r1=677891&r2=677892&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_doc.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_doc.erl Fri Jul 18 05:57:07 2008
@@ -110,13 +110,18 @@
     Revs0 ->
         Revs0
     end,
-    #doc{
-        id = proplists:get_value("_id", Props, ""),
-        revs = Revs,
-        deleted = proplists:get_value("_deleted", Props, false),
-        body = {obj, [{Key, Value} || {[FirstChar|_]=Key, Value} <- Props, FirstChar /= $_]},
-        attachments = Bins
-        }.
+    case proplists:get_value("_id", Props, "") of
+    Id when is_list(Id) ->
+        #doc{
+            id = Id,
+            revs = Revs,
+            deleted = proplists:get_value("_deleted", Props, false),
+            body = {obj, [{Key, Value} || {[FirstChar|_]=Key, Value} <- Props, FirstChar /= $_]},
+            attachments = Bins
+            };
+    _ ->
+        throw({invalid_document_id, "Document id is not a string"})
+    end.
 
 
 to_doc_info(#full_doc_info{id=Id,update_seq=Seq,rev_tree=Tree}) ->

Modified: incubator/couchdb/trunk/src/couchdb/couch_rep.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_rep.erl?rev=677892&r1=677891&r2=677892&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_rep.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_rep.erl Fri Jul 18 05:57:07 2008
@@ -241,7 +241,7 @@
 
 
 enum_docs_since(DbUrl, StartSeq, InFun, InAcc) when is_list(DbUrl) ->
-    Url = DbUrl ++ "_all_docs_by_seq?count=4&startkey=" ++ integer_to_list(StartSeq),
+    Url = DbUrl ++ "_all_docs_by_seq?count=100&startkey=" ++ integer_to_list(StartSeq),
     {obj, Results} = do_http_request(Url, get),
     DocInfoList=
     lists:map(fun({obj, RowInfoList}) ->