Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B7718175E1 for ; Fri, 31 Oct 2014 19:53:16 +0000 (UTC) Received: (qmail 1846 invoked by uid 500); 31 Oct 2014 19:53:16 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 1671 invoked by uid 500); 31 Oct 2014 19:53:16 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 1624 invoked by uid 99); 31 Oct 2014 19:53:16 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Oct 2014 19:53:16 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 4346F927A77; Fri, 31 Oct 2014 19:53:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bbastian@apache.org To: commits@couchdb.apache.org Date: Fri, 31 Oct 2014 19:53:17 -0000 Message-Id: <3f6f0975557a4b39af22fb34f4adcba8@git.apache.org> In-Reply-To: <695c7c23941a44a0938af77efbf99d8b@git.apache.org> References: <695c7c23941a44a0938af77efbf99d8b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Mon Jan 27 10:24:25 2014 +0100 Committer: Benjamin Bastian 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}},