couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject git commit: Unfix view compaction progress reports
Date Thu, 07 Feb 2013 19:30:12 GMT
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 <paul.joseph.davis@gmail.com>
Authored: Thu Feb 7 13:28:56 2013 -0600
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
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,


Mime
View raw message