You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by va...@apache.org on 2021/09/27 19:02:05 UTC

[couchdb-recon] 03/21: Accumulate all block entries in format_blocks

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to tag 2.5.2
in repository https://gitbox.apache.org/repos/asf/couchdb-recon.git

commit d4f3f253bf05a87516e53b04bd0213cbf0ebc1c2
Author: Jose M Perez <jo...@gmail.com>
AuthorDate: Thu Nov 5 14:56:47 2020 +0100

    Accumulate all block entries in format_blocks
---
 src/recon_alloc.erl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/recon_alloc.erl b/src/recon_alloc.erl
index 46d2bd7..99a3d29 100644
--- a/src/recon_alloc.erl
+++ b/src/recon_alloc.erl
@@ -406,7 +406,9 @@ format_blocks(Alloc, Key, [{blocks, L} | List]) when is_list(L) ->
     MergeF = fun(K) ->
         fun({_A, Props}, Acc) ->
             case lists:keyfind(K, 1, Props) of
-                {K,Cur,Last,Max} -> {Cur, Last, Max};
+                {K,Cur,Last,Max} ->
+                    {AccCur, AccLast, AccMax} = Acc,
+                    {AccCur + Cur, AccLast + Last, AccMax + Max};
                 {K,V} -> Acc+V
             end
         end