From 81b8eb1dd886b89a29ff53ff959ecd2c6f2d1ac9 Mon Sep 17 00:00:00 2001 From: Benjamin Bastian Date: Thu, 11 Sep 2014 13:37:13 -0700 Subject: [PATCH] Set proper rev for processed deleted doc View changes needs to return the "winning" rev to the client. With default style, it does this by looking up the rev in the seq tree. Prior to this commit, when a document was being deleted, the default rev (ie. {0, []}) would be added to the seq tree. This commit fixes the problem by manually setting the proper rev in the deleted #doc record before it's processed. --- src/couch_index_updater.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/couch_index_updater.erl b/src/couch_index_updater.erl index ad48f40..ec700ae 100644 --- a/src/couch_index_updater.erl +++ b/src/couch_index_updater.erl @@ -159,7 +159,9 @@ update(Idx, Mod, IdxState) -> {false, <<"_design/", _/binary>>} -> {nil, Seq}; _ when Deleted -> - {#doc{id=DocId, deleted=true}, Seq}; + [RI|_] = DocInfo#doc_info.revs, + {Pos, Rev} = RI#rev_info.rev, + {#doc{id=DocId, revs={Pos, [Rev]}, deleted=true}, Seq}; _ -> {ok, Doc} = couch_db:open_doc_int(Db, DocInfo, DocOpts), {Doc, Seq}