davisp commented on a change in pull request #849: Fix external size bug when
seq btree exists
URL: https://github.com/apache/couchdb/pull/849#discussion_r141885773
##########
File path: src/couch_mrview/src/couch_mrview_util.erl
##########
@@ -800,7 +800,10 @@ reduced_external_size(Tree) ->
case couch_btree:full_reduce(Tree) of
{ok, {_, _, Size}} -> Size;
% return 0 for versions of the reduce function without Size
- {ok, {_, _}} -> 0
+ {ok, {_, _}} -> 0;
+ % This is for the case when seq_btree or key_byseq_btree is not
+ % null. Reduces will return an integer.
+ {ok, Size} when is_integer(Size) -> Size
Review comment:
Depends on what you want the size of. couch_btree:size gives you the number
of bytes to store the btree. Depending on how you're storing KV pairs you may
have to have a custom reduce to include that info. For instance, in the id_tree
we have a custom reduce that includes size information for the document bodies
(since they aren't part of the KV structure of the btree) but for the seq_tree
there's nothing written beyond what's in the KVs so we don't need a custom
reduce.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services