diff options
author | Robert Dionne <bob@cloudant.com> | 2011-04-19 12:06:37 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2011-04-19 13:09:18 -0400 |
commit | a9410e622d84c4b6c017d16ea600e9b19e306c59 (patch) | |
tree | 6d5ff8a1a10fef103594072b50d55990ccc43607 /apps/couch/src/couch_btree.erl | |
parent | 663d04f907ba0f8e23bab0eb2492c431246974fa (diff) |
Track and report size of live data in DBs and views
The #full_doc_info record is extended to include the summed size of
leaf revision document bodies and their attachments. Document sizes
are computed on update; accurate sizes of existing databases and
view groups are only available after compaction.
The document size is defined to be the size of the binary
representation of #doc.body. The att_len field is used for
attachments; attachments that are shared by multiple revisions of a
document are only counted once. The size of a view index is defined as
the size of all keys, values, and reductions accessible from the current
root of the tree.
BugzID: 9995
Diffstat (limited to 'apps/couch/src/couch_btree.erl')
-rw-r--r-- | apps/couch/src/couch_btree.erl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/couch/src/couch_btree.erl b/apps/couch/src/couch_btree.erl index 5b950dc1..2fcc8ae7 100644 --- a/apps/couch/src/couch_btree.erl +++ b/apps/couch/src/couch_btree.erl @@ -65,8 +65,8 @@ final_reduce(#btree{reduce=Reduce}, Val) -> final_reduce(Reduce, Val); final_reduce(Reduce, {[], []}) -> Reduce(reduce, []); -final_reduce(_Bt, {[], [Red]}) -> - Red; +final_reduce(Reduce, {[], [Red]}) -> + Reduce(rereduce, [Red]); final_reduce(Reduce, {[], Reductions}) -> Reduce(rereduce, Reductions); final_reduce(Reduce, {KVs, Reductions}) -> @@ -104,8 +104,8 @@ fold_reduce(#btree{root=Root}=Bt, Fun, Acc, Options) -> full_reduce(#btree{root=nil,reduce=Reduce}) -> {ok, Reduce(reduce, [])}; -full_reduce(#btree{root={_P, Red}}) -> - {ok, Red}. +full_reduce(#btree{root={_P, Red}, reduce=Reduce}) -> + {ok, Reduce(rereduce, [Red])}. % wraps a 2 arity function with the proper 3 arity function convert_fun_arity(Fun) when is_function(Fun, 2) -> |