incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Kögl <koeglste...@gmail.com>
Subject Re: Update Conflict for PUT/DELETE in _replicator
Date Fri, 02 Mar 2012 13:11:03 GMT
On Fri, Mar 2, 2012 at 1:39 PM, Jan Lehnardt <jan@apache.org> wrote:
> On Mar 2, 2012, at 13:25 , Stefan Kögl wrote:
>> Again something I noticed during my 1.2.x experiments: It seems I
>> can't update or remove a document from the _replicator database, which
>> I use for pull-replication into my 1.2.x instance.
>>
>> # get current _rev
>> $ curl http://127.0.0.1:5984/_replicator/mygpo
>> {"_id":"mygpo","_rev":"131-57b4da8d3163468cb0bbf4fd30c87832","source":"************************","target":"http://127.0.0.1:5984/mygpo","create_target":false,"continuous":true,"user_ctx":{"name":"stefan","roles":["admin"]},"owner":"stefan","_replication_state":"triggered","_replication_state_time":"2012-03-02T02:56:12+00:00","_replication_id":"f9fc5457b278d3cdb1ba2f1881253b04"}
>>
>> # try to delete
>> $ curl -X DELETE
>> "http://127.0.0.1:5984/_replicator/mygpo?_rev=131-57b4da8d3163468cb0bbf4fd30c87832"
>> {"error":"conflict","reason":"Document update conflict."}
>
> this should be ?rev=... (no underscore)

Of course, I also tried that but it didn't work either... see below.



>> $ curl -X PUT "http://127.0.0.1:5984/_replicator/mygpo" -d @replication.json
>
> Can you try adding the ?rev= in the URL as well?

# get the rev first
$ curl http://127.0.0.1:5984/_replicator/mygpo
{"_id":"mygpo","_rev":"131-57b4da8d3163468cb0bbf4fd30c87832","source":"********************","target":"http://127.0.0.1:5984/mygpo","create_target":false,"continuous":true,"user_ctx":{"name":"stefan","roles":["admin"]},"owner":"stefan","_replication_state":"triggered","_replication_state_time":"2012-03-02T02:56:12+00:00","_replication_id":"f9fc5457b278d3cdb1ba2f1881253b04"}

# delete with rev instead of _rev
$ curl -X DELETE
"http://127.0.0.1:5984/_replicator/mygpo?rev=131-57b4da8d3163468cb0bbf4fd30c87832"
{"error":"conflict","reason":"Document update conflict."}

# now PUT with rev in URL
$ curl -X PUT "http://127.0.0.1:5984/_replicator/mygpo?rev=131-57b4da8d3163468cb0bbf4fd30c87832"
-d @replication.json
{"error":"conflict","reason":"Document update conflict."}

# still the same rev (no other change in between)
$ curl http://127.0.0.1:5984/_replicator/mygpo
{"_id":"mygpo","_rev":"131-57b4da8d3163468cb0bbf4fd30c87832","source":"********************","target":"http://127.0.0.1:5984/mygpo","create_target":false,"continuous":true,"user_ctx":{"name":"stefan","roles":["admin"]},"owner":"stefan","_replication_state":"triggered","_replication_state_time":"2012-03-02T02:56:12+00:00","_replication_id":"f9fc5457b278d3cdb1ba2f1881253b04"}


-- Stefan

Mime
View raw message