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

Klaus Trainer updated COUCHDB-902:
----------------------------------

    Attachment: 0001-Fixes-COUCHDB-902.patch

After some debugging, I found out that the difference between an ordinary 
update and an update with attachment was that in the former case the doc only 
contained the most current rev in #doc.revs, whereas in the latter case, all 
revs were contained in #doc.revs.

This is because in the latter case case, the document is retrieved with 
couch_db:open_doc_revs/4, whereas in the former case, the doc record is 
constructed using couch_httpd_db:couch_doc_from_req/3.

If all revs are included in #doc.revs (instead of only the latest one), the 
merge* functions in couch_key_tree will come to the conclusion that there's a 
conflict. As I didn't see anything wrong with the merge* functions, I assume 
that the flaw lies in including more than the latest rev in #doc.revs.


Attached is a patch that fixes the issue and provides corresponding tests as 
well. Testing with make check and the Futon tests suggests that everything is 
fine with it.

> Attachments that have recovered from conflict do not accept attachments.
> ------------------------------------------------------------------------
>
>                 Key: COUCHDB-902
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-902
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>         Environment: trunk
>            Reporter: Paul Joseph Davis
>            Priority: Critical
>         Attachments: 0001-Fixes-COUCHDB-902.patch, couchdb-902-test-case.py
>
>
> Apparently if a document has been in a conflict, they will reject requests to 
> add an attachment with a conflict error.
> I've tracked this down to couch_db_updater.erl line 501, but I'm not too 
> familiar with this part of the code so I figured I'd fill out a ticket in 
> case anyone else can go through this more quickly than me.
> Sure would be nice if I could attach a file when I create an issue...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to