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 1BE59E09F for ; Thu, 7 Feb 2013 19:30:38 +0000 (UTC) Received: (qmail 56865 invoked by uid 500); 7 Feb 2013 19:30:38 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 56829 invoked by uid 500); 7 Feb 2013 19:30:38 -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 56822 invoked by uid 99); 7 Feb 2013 19:30:38 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Feb 2013 19:30:37 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A66F424DA1; Thu, 7 Feb 2013 19:30:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davisp@apache.org To: commits@couchdb.apache.org X-Mailer: ASF-Git Admin Mailer Subject: git commit: Unfix view compaction progress reports Message-Id: <20130207193037.A66F424DA1@tyr.zones.apache.org> Date: Thu, 7 Feb 2013 19:30:37 +0000 (UTC) Updated Branches: refs/heads/1.3.x 73195d31f -> 168a663bb Unfix view compaction progress reports This reverts the compaction task status progress back to what exists on 1.2.x. The issue is that we use the number of documents in the database instead of the number of docids in the union of all views (the number of rows in the view's id btree). In this particular case the desire to have seamless view upgrades outweighs fixing the relatively minor UI bug. Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/168a663b Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/168a663b Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/168a663b Branch: refs/heads/1.3.x Commit: 168a663bb9742e9854ce756925598aba938f2386 Parents: 73195d3 Author: Paul J. Davis Authored: Thu Feb 7 13:28:56 2013 -0600 Committer: Paul J. Davis Committed: Thu Feb 7 13:30:29 2013 -0600 ---------------------------------------------------------------------- src/couch_mrview/src/couch_mrview_compactor.erl | 12 ++++++++---- src/couch_mrview/src/couch_mrview_util.erl | 7 +------ 2 files changed, 9 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/168a663b/src/couch_mrview/src/couch_mrview_compactor.erl ---------------------------------------------------------------------- diff --git a/src/couch_mrview/src/couch_mrview_compactor.erl b/src/couch_mrview/src/couch_mrview_compactor.erl index b500ce3..fe718ca 100644 --- a/src/couch_mrview/src/couch_mrview_compactor.erl +++ b/src/couch_mrview/src/couch_mrview_compactor.erl @@ -43,10 +43,15 @@ compact(State) -> views=Views } = State, - EmptyState = couch_util:with_db(DbName, fun(Db) -> + {EmptyState, NumDocIds} = couch_util:with_db(DbName, fun(Db) -> CompactFName = couch_mrview_util:compaction_file(DbName, Sig), {ok, Fd} = couch_mrview_util:open_file(CompactFName), - couch_mrview_util:reset_index(Db, Fd, State) + ESt = couch_mrview_util:reset_index(Db, Fd, State), + + {ok, DbReduce} = couch_btree:full_reduce(Db#db.fulldocinfo_by_id_btree), + Count = element(1, DbReduce), + + {ESt, Count} end), #mrst{ @@ -54,13 +59,12 @@ compact(State) -> views = EmptyViews } = EmptyState, - {ok, Count} = couch_btree:full_reduce(IdBtree), TotalChanges = lists:foldl( fun(View, Acc) -> {ok, Kvs} = couch_mrview_util:get_row_count(View), Acc + Kvs end, - Count, Views), + NumDocIds, Views), couch_task_status:add_task([ {type, view_compaction}, {database, DbName}, http://git-wip-us.apache.org/repos/asf/couchdb/blob/168a663b/src/couch_mrview/src/couch_mrview_util.erl ---------------------------------------------------------------------- diff --git a/src/couch_mrview/src/couch_mrview_util.erl b/src/couch_mrview/src/couch_mrview_util.erl index 092ae3d..18185af 100644 --- a/src/couch_mrview/src/couch_mrview_util.erl +++ b/src/couch_mrview/src/couch_mrview_util.erl @@ -197,12 +197,7 @@ init_state(Db, Fd, State, Header) -> end, ViewStates2 = lists:map(StateUpdate, ViewStates), - IdReduce = fun - (reduce, KVs) -> length(KVs); - (rereduce, Reds) -> lists:sum(Reds) - end, - - IdBtOpts = [{reduce, IdReduce}, {compression, couch_db:compression(Db)}], + IdBtOpts = [{compression, couch_db:compression(Db)}], {ok, IdBtree} = couch_btree:open(IdBtreeState, Fd, IdBtOpts), OpenViewFun = fun(St, View) -> open_view(Db, Fd, Lang, St, View) end,