From 409455a31b976020cba49c6ce8d413eca0480dea Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Tue, 18 Jan 2011 00:44:51 +0000 Subject: Avoid bug in rev tree logic during attachment uploads This is a workaround for a bug in couch_key_tree, described in COUCHDB-902, which would cause uploads to fail with spurious conflicts. A patch for the key tree itself will be landing on trunk. Thanks Bob Dionne, Klaus Trainer. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1060150 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd_db.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/couchdb/couch_httpd_db.erl') diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl index ddc0cc6d..a051402b 100644 --- a/src/couchdb/couch_httpd_db.erl +++ b/src/couchdb/couch_httpd_db.erl @@ -1059,8 +1059,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 = {Pos, case Revs of [] -> []; [Hd|_] -> [Hd] end}, atts = NewAtt ++ [A || A <- Atts, A#att.name /= FileName] }, {ok, UpdatedRev} = couch_db:update_doc(Db, DocEdited, []), -- cgit v1.2.3