forked from TrueCloudLab/frostfs-node
[#373] blobovnizca: Add missed/fix tracing spans
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
028d4a8058
commit
a8526d45e9
10 changed files with 58 additions and 20 deletions
|
@ -38,13 +38,14 @@ func (p *DeletePrm) SetAddress(addr oid.Address) {
|
|||
func (b *Blobovnicza) Delete(ctx context.Context, prm DeletePrm) (DeleteRes, error) {
|
||||
_, span := tracing.StartSpanFromContext(ctx, "Blobovnicza.Delete",
|
||||
trace.WithAttributes(
|
||||
attribute.String("path", b.path),
|
||||
attribute.String("address", prm.addr.EncodeToString()),
|
||||
))
|
||||
defer span.End()
|
||||
|
||||
addrKey := addressKey(prm.addr)
|
||||
|
||||
removed := false
|
||||
found := false
|
||||
|
||||
err := b.boltDB.Update(func(tx *bbolt.Tx) error {
|
||||
return b.iterateBuckets(tx, func(lower, upper uint64, buck *bbolt.Bucket) (bool, error) {
|
||||
|
@ -56,9 +57,6 @@ func (b *Blobovnicza) Delete(ctx context.Context, prm DeletePrm) (DeleteRes, err
|
|||
|
||||
sz := uint64(len(objData))
|
||||
|
||||
// decrease fullness counter
|
||||
b.decSize(sz)
|
||||
|
||||
// remove object from the bucket
|
||||
err := buck.Delete(addrKey)
|
||||
|
||||
|
@ -67,16 +65,18 @@ func (b *Blobovnicza) Delete(ctx context.Context, prm DeletePrm) (DeleteRes, err
|
|||
zap.String("binary size", stringifyByteSize(sz)),
|
||||
zap.String("range", stringifyBounds(lower, upper)),
|
||||
)
|
||||
// decrease fullness counter
|
||||
b.decSize(sz)
|
||||
}
|
||||
|
||||
removed = true
|
||||
found = true
|
||||
|
||||
// stop iteration
|
||||
return true, err
|
||||
})
|
||||
})
|
||||
|
||||
if err == nil && !removed {
|
||||
if err == nil && !found {
|
||||
var errNotFound apistatus.ObjectNotFound
|
||||
|
||||
return DeleteRes{}, errNotFound
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue