incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Joseph Davis (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-1184) Bulk insert of design documents fails with conflict if the documents contain "_rev" when they do not exist in the database
Date Tue, 07 Jun 2011 21:08:58 GMT

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

Paul Joseph Davis commented on COUCHDB-1184:
--------------------------------------------

When I say rescuing a doc from deletion I was refering to using the non-interactive edits
which is the code path that docs go through when replicating. In retrospect it shouldn't be
part of this conversation and hence we should pretend I never mentioned it.

I think you're quite right in the analysis. If a _rev is present it should be treated as an
update and fail in the cases where those docs don't exist (regardless of PUT, POST, or _bulk_docs).
If a _rev exists and the doc exists the update or fail should already be in place.

I'm not sure what you mean about the "one larger" scenarios. The behaviour you saw is just
a slight difference in how the docs are treated in _bulk_docs vs. single doc updates. Basically,
single doc updates were pretending that _rev didn't exist and creating the new doc. When you
see the _rev depth (the number before the hash) being incremented it just means that the doc
went through the merge logic. There will always be a difference here in some corners of the
API due to how replication works so as long as we get rid of the ignore-_rev-on-update behavior
this will be fine. Plus _rev's are opaque and libraries and users should not rely on their
format or behaviour.

> Bulk insert of design documents fails with conflict if the documents contain "_rev" when
they do not exist in the database
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-1184
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1184
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 0.11
>            Reporter: Nuutti Kotivuori
>
> First a simple example to reproduce:
> $ curl -X PUT http://localhost:5984/repltest
> {"ok":true}
> $ curl -H "Content-type: application/json" -X POST --data '{"docs":[{"_id":"_design/a","_rev":"1-2f4a8d26d103e914167052aea70a5031"}]}'
http://localhost:5984/repltest/_bulk_docs
> [{"id":"_design/a","error":"conflict","reason":"Document update conflict."}]
> So, inserting a previously non-existing design document in to a database via bulk docs
post fails the inserted design document has a "_rev" member.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message