You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by bb...@apache.org on 2014/10/31 20:53:17 UTC
[02/41] couch-mrview commit: updated refs/heads/master to 28e51f3
couch_mrview: fix changes log
This changes make sure we pass correct keys to remove to the seq and
key_byseq btrees in 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/19be43b6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/19be43b6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/19be43b6
Branch: refs/heads/master
Commit: 19be43b6bea268e02ef2859a9f7e36eb1c186d4d
Parents: deb8139
Author: benoitc <be...@apache.org>
Authored: Mon Jan 27 10:24:25 2014 +0100
Committer: Benjamin Bastian <be...@gmail.com>
Committed: Thu Oct 30 13:38:32 2014 -0700
----------------------------------------------------------------------
src/couch_mrview_updater.erl | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/19be43b6/src/couch_mrview_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_updater.erl b/src/couch_mrview_updater.erl
index 27cf795..f6557cf 100644
--- a/src/couch_mrview_updater.erl
+++ b/src/couch_mrview_updater.erl
@@ -311,13 +311,15 @@ write_kvs(State, UpdateSeq, ViewKVs, DocIdKeys, Log) ->
true ->
SToRem = couch_util:dict_find(ViewId, SeqsToRemove, []),
SToAdd = couch_util:dict_find(ViewId, SeqsToAdd, []),
+ RemSKs = [{Seq, Key} || {Key, Seq, _} <- SToRem],
+ RemKSs = [{[Seq, Key], DocId} || {Key, Seq, DocId} <- SToRem],
SKVs1 = SKVs ++ SToAdd,
{ok, SBt} = couch_btree:add_remove(View#mrview.seq_btree,
- SKVs1, SToRem),
+ SKVs1, RemSKs),
{ok, KSbt} = couch_btree:add_remove(View#mrview.key_byseq_btree,
couch_mrview_util:to_key_seq(SKVs1),
- couch_mrview_util:to_key_seq(SToRem)),
+ RemKSs),
{SBt, KSbt};
_ -> {nil, nil}
end,
@@ -382,8 +384,9 @@ update_log(Btree, Log, UpdatedSeq, _) ->
true ->
%% the log is updated, deleted old
%% record from the view
- DelAcc5 = dict:append(ViewId, {Seq, Key},
- DelAcc4),
+ DelAcc5 = dict:append(ViewId,
+ {Key, Seq, DocId},
+ DelAcc4),
{Log4, AddAcc4, DelAcc5};
false when Op /= del ->
%% an update operation has been
@@ -396,8 +399,9 @@ update_log(Btree, Log, UpdatedSeq, _) ->
{ViewId,
{Key,UpdatedSeq, del}},
Log4),
- DelAcc5 = dict:append(ViewId, {Seq, Key},
- DelAcc4),
+ DelAcc5 = dict:append(ViewId,
+ {Key, Seq, DocId},
+ DelAcc4),
AddAcc5 = dict:append(ViewId,
{{UpdatedSeq, Key},
{DocId, RemValue}},