[#661] blobovnicza: Compute size with record size

To get more accurate size of blobovnicza use record
size (lenght of key + lenght of data).

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-10-12 21:35:08 +03:00
parent e54dc3dc7c
commit ad0697adc4
5 changed files with 19 additions and 14 deletions

View file

@ -116,10 +116,11 @@ func (b *Blobovnicza) initializeCounters() error {
}
return b.iterateAllDataBuckets(tx, func(lower, upper uint64, b *bbolt.Bucket) (bool, error) {
keysN := uint64(b.Stats().KeyN)
size += keysN * upper
items += keysN
return false, nil
return false, b.ForEach(func(k, v []byte) error {
size += uint64(len(k) + len(v))
items++
return nil
})
})
})
if err != nil {