incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CGS <>
Subject _bulk_docs vs. single document insertion
Date Wed, 09 Nov 2011 15:13:58 GMT

I wonder if others found the following difference and if it still exists 
in CouchDB version 1.1.1. Maybe it's me who doesn't operate correctly 
with the bulk.

Insertion scenarios:

1. Using _bulk_docs (I deleted here the part with user:password@ because 
it's not the source of the difference in behavior - true or false in 
all_or_nothing changes nothing):

bash$ curl -s -X POST -d 

-H 'Content-Type: application/json' && curl -s -X GET

a) first time ok, returning the list of docs id's and rev's + test1 
b) the second time not quite ok, returning the same id's and rev's + the 
same test1 document (step discarded by bulk, getting the first bulk 
operation result instead of incrementing the revision or reporting 
c) deleting all those documents and sending the same command returns the 
same id's and rev's as when I sent for the first time that request 
(Futon reports no document and I tried also compact operation after 
deleting and before sending again the same command) + 
{"error":"not_found","reason":"deleted"} (normal error for the GET 

2. Using single document insertion:

bash$ curl -s -X POST -d 
'{"_id":"test1","test":"1"}' -H 'Content-Type: application/json'

a) deleting and posting the same document, the revision increases (as 

Now, comparing 1.c and 2.a, one can easily see that the behavior is 
different. Is that normal or I am missing something? Because, if I am 
not missing anything, this behavior slows down a lot data insertion 
design, triggering  possible loss of data in the case of high rate of data.


PS: Sorry if this post is a little bit messy as I tried to shorten it. 
If anyone needs more details, let me know. Thank you for your time in 
reading this post.

View raw message