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

Adam Kocoloski commented on COUCHDB-902:
----------------------------------------

The patch I'm proposing to couch_httpd_db is pretty simple:


diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index 1767d9c..02e1aa4 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -1020,8 +1020,10 @@ 
db_attachment_req(#httpd{method=Method,mochi_req=MochiReq}=Req, Db, DocId, FileN
             end
     end,
 
-    #doc{atts=Atts} = Doc,
+    #doc{atts=Atts, revs = {Pos, Revs}} = Doc,
     DocEdited = Doc#doc{
+        % prune revision list as a workaround for key tree bug (COUCHDB-902)
+        revs = case Revs of [] -> {Pos, []}; _ -> {Pos, [hd(Revs)]} end,
         atts = NewAtt ++ [A || A <- Atts, A#att.name /= FileName]
     },
     {ok, UpdatedRev} = couch_db:update_doc(Db, DocEdited, []),


However, my current stumbling block is that I cannot get 
attachment_conflicts.js to fail on a stock 1.0.x build.  I haven't looked into 
it further yet.  Will look again in a couple of hours.

> 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
>             Fix For: 1.0.2, 1.1
>
>         Attachments: 0001-Fix-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