couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pete Vander Giessen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (COUCHDB-1200) _update handler breaks after a conflict is resolved
Date Mon, 20 Jun 2011 18:18:47 GMT

     [ https://issues.apache.org/jira/browse/COUCHDB-1200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Pete Vander Giessen updated COUCHDB-1200:
-----------------------------------------

    Attachment: test_conflict_mine.sh

Script to reproduce the problem. 

> _update handler breaks after a conflict is resolved
> ---------------------------------------------------
>
>                 Key: COUCHDB-1200
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1200
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core, Replication
>    Affects Versions: 1.1
>            Reporter: Pete Vander Giessen
>         Attachments: test_conflict_mine.sh
>
>
> My update handlers break after I've introduced and resolved a conflict. Despite the conflict
being resolve, I get the following error when trying to run an update handler on a once-conflicted
document:
> {"error":"conflict","reason":"Document update conflict."}
> The following script reproduces the issue on 1.1.x. The issue does not appear when run
against a build of trunk:
> #!/bin/bash
> export HOST=http://localhost:5984
> echo "Step 1a -- setup dbs"
> curl -X DELETE $HOST/db0
> curl -X DELETE $HOST/db1
> curl -X PUT $HOST/db0
> curl -X PUT $HOST/db1
> echo "step 1b -- create an update handler "
> curl -X PUT $HOST/db0/_design/foo -d '{"updates":{"bar":"function(doc, req) { doc.foo=1;
return [doc, \"ok\"];}"}}'
> echo "step 2 -- create a doc" 
> curl -X PUT $HOST/db0/doc1 -d '{content}'
> curl -X GET $HOST/db0/doc1
> echo "step 3 -- replicate"
> curl -X POST $HOST/_replicate -d '{"source":"db0","target":"db1"}' -H "Content-Type:application/json"
> echo "step 4 -- a new version of the doc on both dbs"
> curl -X PUT $HOST/db0/doc1 -d '{"_rev":"1-05a05c54cce81cc30df678afeab60f6c","content":"some
content"}'
> curl -X PUT $HOST/db1/doc1 -d '{"_rev":"1-05a05c54cce81cc30df678afeab60f6c","content":"some
different content"}'
> echo "step 5 -- create a conflict "
> curl -X POST $HOST/_replicate -d '{"target":"db0","source":"db1"}' -H "Content-Type:application/json"
> echo "confirm conflict"
> curl -X GET $HOST/db0/doc1?conflicts=true
> echo "step 6 -- resolve the conflict"
> curl -X DELETE $HOST/db0/doc1?rev=2-2efe11aab7e71ce9124a1039129512da
> echo "step 7 -- check to make sure resolved"
> curl "$HOST/db0/doc1?conflicts=true&deleted_conflicts=true"
> echo "step 8 -- attempt to PUT to our update handler: this produces the error"
> curl -X PUT $HOST/db0/_design/foo/_update/bar/doc1?2-3b2f178dbc5e76cbd8df3ddca1963f4b
-d '{}'
> echo "step 9 -- double-check that conflict was resolved"
> curl "$HOST/db0/doc1?conflicts=true&deleted_conflicts=true"
> echo "step 10 -- confirm that we can still do a normal PUT" 
> curl -X PUT $HOST/db0/doc1 -d '{"_id":"doc1","_rev":"2-3b2f178dbc5e76cbd8df3ddca1963f4b","content":"some
content fnord"}'

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

        

Mime
View raw message