couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bob Dionne (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-911) Repeating a doc._id in a _bulk_docs request results in erroneous "Document conflict" error
Date Fri, 19 Aug 2011 12:18:28 GMT


Bob Dionne commented on COUCHDB-911:

so actually when there are two docs of the same id in _bulk_docs, it's the second that persists
and the first that generates a conflict in merge_rev_trees, because group_alike_docs[1] reverses
the order of the docs in a bucket. To preserve the order we need another reverse here. If
we fixed this, we could hack the ResultsDict[2], as we're processing the docs, and return
only the second doc as a conflict. But this would only solve the bulk_docs case.

There's also the issue of couch_db_updater:collect_updates [3] that appears to allow more
grouped docs to be added for other clients? This is ugly, perhaps it needs to be disabled
for the bulk_docs case. The alternative would be to add some bits to the handle_info({update_docs....
call to track which docs turn out to have conflicts.

It's not pretty


> Repeating a doc._id in a _bulk_docs request results in erroneous "Document conflict"
> ------------------------------------------------------------------------------------------
>                 Key: COUCHDB-911
>                 URL:
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 1.0
>         Environment: Cloudant BigCouch EC2 node
>            Reporter: Jay Nelson
>            Priority: Minor
>   Original Estimate: 48h
>  Remaining Estimate: 48h
> Repeating an "_id" in a _bulk_docs post data file results in both entries being reported
as document conflict errors.  The first occurrence actual inserts into the database, and only
the second occurrence should report a conflict.
> curl -d '{ "docs": [ {"_id":"foo"}, {"_id","foo"} ] }' -H 'Content-Type:application/json'
> [{"id":"foo","error":"conflict","reason":"Document update conflict."},{"id":"foo","error":"conflict","reason":"Document
update conflict."}]
> But the database shows that one new document was actually inserted.
> Only the second occurrence should report conflict.  The first occurrence should report
the "_rev" property of the newly inserted doc.

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message