forked from TrueCloudLab/frostfs-node
[#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:
parent
e54dc3dc7c
commit
ad0697adc4
5 changed files with 19 additions and 14 deletions
|
@ -56,8 +56,9 @@ func (b *Blobovnicza) Put(ctx context.Context, prm PutPrm) (PutRes, error) {
|
|||
defer span.End()
|
||||
|
||||
sz := uint64(len(prm.objData))
|
||||
bucketName, upperBound := bucketForSize(sz)
|
||||
bucketName := bucketForSize(sz)
|
||||
key := addressKey(prm.addr)
|
||||
recordSize := sz + uint64(len(key))
|
||||
|
||||
err := b.boltDB.Batch(func(tx *bbolt.Tx) error {
|
||||
buck := tx.Bucket(bucketName)
|
||||
|
@ -74,11 +75,11 @@ func (b *Blobovnicza) Put(ctx context.Context, prm PutPrm) (PutRes, error) {
|
|||
}
|
||||
|
||||
return updateMeta(tx, func(count, size uint64) (uint64, uint64) {
|
||||
return count + 1, size + upperBound
|
||||
return count + 1, size + recordSize
|
||||
})
|
||||
})
|
||||
if err == nil {
|
||||
b.itemAdded(upperBound)
|
||||
b.itemAdded(recordSize)
|
||||
}
|
||||
|
||||
return PutRes{}, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue