From 90fd883e323ffdafcc4b83fed566304e6df1b39e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 8 Dec 2021 13:50:15 +0300 Subject: [PATCH] [#915] blobovnicza: Use mean bucket size multiplier instead of min For fullness estimation of `Blobovnicza` we use number of object stored in each size bucket. In previous implementation we multiplied the number by the difference in bucket boundaries. This expression rather estimated the minimum volume (and for the smallest bucket, the maximum) of objects in the bucket. Multiply number of objects by mean bucket size. Signed-off-by: Leonard Lyubich --- pkg/local_object_storage/blobovnicza/sizes.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/local_object_storage/blobovnicza/sizes.go b/pkg/local_object_storage/blobovnicza/sizes.go index c6e91bc0..a8859ba6 100644 --- a/pkg/local_object_storage/blobovnicza/sizes.go +++ b/pkg/local_object_storage/blobovnicza/sizes.go @@ -61,7 +61,7 @@ func (b *Blobovnicza) syncFullnessCounter(tx *bbolt.Tx) error { return false, fmt.Errorf("bucket not found %s", stringifyBounds(lower, upper)) } - sz += uint64(buck.Stats().KeyN) * (upper - lower) + sz += uint64(buck.Stats().KeyN) * (upper + lower) / 2 return false, nil }); err != nil { @@ -71,5 +71,4 @@ func (b *Blobovnicza) syncFullnessCounter(tx *bbolt.Tx) error { b.filled.Store(sz) return nil - }