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 42067E09D for ; Thu, 7 Feb 2013 19:30:13 +0000 (UTC) Received: (qmail 55590 invoked by uid 500); 7 Feb 2013 19:30:13 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 55461 invoked by uid 500); 7 Feb 2013 19:30:12 -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 55449 invoked by uid 99); 7 Feb 2013 19:30:12 -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:12 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 25A8E24D97; Thu, 7 Feb 2013 19:30:12 +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: <20130207193012.25A8E24D97@tyr.zones.apache.org> Date: Thu, 7 Feb 2013 19:30:12 +0000 (UTC) Updated Branches: refs/heads/master da35ed0f0 -> 07571176c 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/07571176 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/07571176 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/07571176 Branch: refs/heads/master Commit: 07571176ca78184ad164e312cf61868844e4420b Parents: da35ed0 Author: Paul J. Davis Authored: Thu Feb 7 13:28:56 2013 -0600 Committer: Paul J. Davis Committed: Thu Feb 7 13:28:56 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/07571176/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/07571176/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,