diff options
author | Paul J. Davis <paul.joseph.davis@gmail.com> | 2013-02-07 13:28:56 -0600 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2013-02-07 13:28:56 -0600 |
commit | 07571176ca78184ad164e312cf61868844e4420b (patch) | |
tree | 469d4aae85714e27873d767fa09bdf505e7acc68 | |
parent | da35ed0f012c265d35a71cc12e3683bdaad9e6d3 (diff) | |
download | couchdb-07571176ca78184ad164e312cf61868844e4420b.tar.gz |
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.
-rw-r--r-- | src/couch_mrview/src/couch_mrview_compactor.erl | 12 | ||||
-rw-r--r-- | src/couch_mrview/src/couch_mrview_util.erl | 7 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/couch_mrview/src/couch_mrview_compactor.erl b/src/couch_mrview/src/couch_mrview_compactor.erl index b500ce39d..fe718ca30 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}, diff --git a/src/couch_mrview/src/couch_mrview_util.erl b/src/couch_mrview/src/couch_mrview_util.erl index 092ae3d5e..18185af20 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, |