couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bob Dionne (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-911) Repeating a doc._id in a _bulk_docs request results in erroneous "Document conflict" error
Date Sat, 20 Aug 2011 01:23:27 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13088101#comment-13088101
] 

Bob Dionne commented on COUCHDB-911:
------------------------------------

No it really doesn't matter. One could argue that since the list of buckets is reversed then
the buckets should also be reversed to preserve the order, or neither should.

So here's a solution[1] that works that does depend on update_docs being called with the docs
in the correct order. It needs a bit of refactoring but the idea itself is simple. It removes
the dictionary since dict:from_list throws away the dups, and works thru the list of docs
backwards, looking them up in the results list from the commits. If conflicts are present
they are matched to the correct docs. As they are used they are removed from the commits list.

It's not pretty but I should be able to simplify, the only alternative I could think of involves
passing some additional bits in to the elephant grave yard that is couch_db_updater.


[1] https://github.com/cloudant/bigcouch/commit/3fbb4fd1caa0d998

> Repeating a doc._id in a _bulk_docs request results in erroneous "Document conflict"
error
> ------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-911
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-911
>             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'
-X POST http://appadvice.cloudant.com/foo/_bulk_docs
> [{"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: http://www.atlassian.com/software/jira

        

Mime
View raw message