From a9410e622d84c4b6c017d16ea600e9b19e306c59 Mon Sep 17 00:00:00 2001 From: Robert Dionne Date: Tue, 19 Apr 2011 12:06:37 -0400 Subject: 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 --- apps/couch/src/couch_doc.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/couch/src/couch_doc.erl') diff --git a/apps/couch/src/couch_doc.erl b/apps/couch/src/couch_doc.erl index 1c5d797d..9f0dae45 100644 --- a/apps/couch/src/couch_doc.erl +++ b/apps/couch/src/couch_doc.erl @@ -282,7 +282,7 @@ max_seq([#rev_info{seq=Seq}|Rest], Max) -> to_doc_info_path(#full_doc_info{id=Id,rev_tree=Tree}) -> RevInfosAndPath = [{#rev_info{deleted=Del,body_sp=Bp,seq=Seq,rev={Pos,RevId}}, Path} || - {{Del, Bp, Seq},{Pos, [RevId|_]}=Path} <- + {#leaf{deleted=Del, ptr=Bp, seq=Seq},{Pos, [RevId|_]}=Path} <- couch_key_tree:get_all_leafs(Tree)], SortedRevInfosAndPath = lists:sort( fun({#rev_info{deleted=DeletedA,rev=RevA}, _PathA}, -- cgit v1.2.3