couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bbast...@apache.org
Subject [32/41] couch-mrview commit: updated refs/heads/master to 28e51f3
Date Fri, 31 Oct 2014 19:53:47 GMT
Fix process_doc for temp views


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/5eab8107
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/5eab8107
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/5eab8107

Branch: refs/heads/master
Commit: 5eab8107b6671bc8a102bbb262ebb49ca442d7f0
Parents: fa7a888
Author: Benjamin Bastian <benjamin.bastian@gmail.com>
Authored: Tue Sep 9 09:34:21 2014 -0700
Committer: Benjamin Bastian <benjamin.bastian@gmail.com>
Committed: Thu Oct 30 13:40:32 2014 -0700

----------------------------------------------------------------------
 src/couch_mrview_updater.erl | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/5eab8107/src/couch_mrview_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_updater.erl b/src/couch_mrview_updater.erl
index 2dcce06..1cfa9c0 100644
--- a/src/couch_mrview_updater.erl
+++ b/src/couch_mrview_updater.erl
@@ -138,12 +138,16 @@ process_doc(Doc, Seq, #mrst{doc_acc=Acc}=State) when length(Acc) >
100 ->
 process_doc(nil, Seq, #mrst{doc_acc=Acc}=State) ->
     {ok, State#mrst{doc_acc=[{nil, Seq, nil, nil} | Acc]}};
 process_doc(#doc{id=Id, deleted=true}=Doc, Seq, #mrst{doc_acc=Acc}=State) ->
-    {RevPos, [Rev | _]} = Doc#doc.revs,
-    {ok, State#mrst{doc_acc=[{Id, Seq, {RevPos, Rev}, deleted} | Acc]}};
+    Rev= extract_rev(Doc#doc.revs),
+    {ok, State#mrst{doc_acc=[{Id, Seq, Rev, deleted} | Acc]}};
 process_doc(#doc{id=Id}=Doc, Seq, #mrst{doc_acc=Acc}=State) ->
-    {RevPos, [Rev | _]} = Doc#doc.revs,
-    {ok, State#mrst{doc_acc=[{Id, Seq, {RevPos, Rev}, Doc} | Acc]}}.
+    Rev = extract_rev(Doc#doc.revs),
+    {ok, State#mrst{doc_acc=[{Id, Seq, Rev, Doc} | Acc]}}.
 
+extract_rev({0, []}) ->
+    {0, []};
+extract_rev({RevPos, [Rev | _]}) ->
+    {RevPos, Rev}.
 
 finish_update(#mrst{doc_acc=Acc}=State) ->
     if Acc /= [] ->


Mime
View raw message