nickva commented on issue #5346:
URL: https://github.com/apache/couchdb/issues/5346#issuecomment-2504589928
Maybe this might work better:
```diff
add_sizes(leaf, #leaf{sizes = Sizes, atts = AttSizes}, Acc) ->
% Maybe upgrade from disk_size only
#size_info{
active = ActiveSize,
external = ExternalSize
} = upgrade_sizes(Sizes),
{ASAcc, ESAcc, AttsAcc} = Acc,
NewASAcc = ActiveSize + ASAcc,
NewESAcc = ExternalSize + ESAcc,
{NewASAcc, NewESAcc, add_att_sizes(AttSizes, AttsAcc)};
add_sizes(_, #leaf{atts = AttSizes}, Acc) ->
% For intermediate nodes external and active contribution is 0
{ASAcc, ESAcc, AttsAcc} = Acc,
{ASAcc, ESAcc, add_att_sizes(AttSizes, AttsAcc)}.
add_att_sizes(AttSizes, AttsAcc) when is_list(AttSizes), is_list(AttsAcc) ->
ActiveAttsAcc = lists:filter(fun(A) -> lists:member(A, AttSizes) end,
AttsAcc),
lists:umerge(AttSizes, ActiveAttsAcc).
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]