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

Klaus Trainer commented on COUCHDB-902:
---------------------------------------

Thanks Adam for bringing this issue back to my attention.

My "point" on open_doc_revs/4 and open_doc/2 was pointless, as open_doc/2 isn't 
used for neither doc nor doc attachment updates.

The point that I actually wanted to make, however, is that 
couch_db:update_docs/4 gets a #doc{} with only the latest rev in #doc.revs when 
there's a doc update without attachment, but it gets a #doc{} with the full rev 
list in #doc.revs when there's an update with attachment.

To conclude that, doc updates with attachments are (AFAIK) the only situation 
where pruning the older revisions would be necessary. My patch would basically 
solve the problem, but I agree that it's better to not require that "#doc.revs 
must only include the latest rev".


Also, I've tried to identify what's wrong in the conflict resolution logic, 
i.e., why there's a spurious conflict when the revs list > 1.

Here are the results that I've gained so far:

I can tell for sure that the problem is somewhere behind the 
couch_key_tree:merge function. It returns {_NewTree, conflict} to the 
couch_db_updater:merge_rev_trees function.

I terminated my debugging session in couch_key_tree:merge_simple/2 (line 108): 
the second element of the tuple {[ATree | MTree], true} represents the 
conflicts flag. The code here is a bit tricky; I can't tell what exactly I can 
change to eliminate that spurious conflict without breaking anything. Maybe we 
should grab the guy who wrote that piece of code in order to solve this issue ;)

> 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