[#1461] shard: Add a separate ErrLockObjectRemoval
Do not return `meta.ErrLockObjectRemoval` from shard's methods, add shard's own error for that. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
558cc1193a
commit
cb0bb7207c
2 changed files with 10 additions and 1 deletions
|
@ -158,7 +158,7 @@ func (e *StorageEngine) inhumeAddr(addr oid.Address, prm shard.InhumePrm, checkE
|
||||||
case errors.As(err, &errLocked):
|
case errors.As(err, &errLocked):
|
||||||
status = 1
|
status = 1
|
||||||
return true
|
return true
|
||||||
case errors.Is(err, meta.ErrLockObjectRemoval):
|
case errors.Is(err, shard.ErrLockObjectRemoval):
|
||||||
status = 2
|
status = 2
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package shard
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||||
|
@ -50,6 +51,10 @@ func (p *InhumePrm) ForceRemoval() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ErrLockObjectRemoval is returned when inhume operation is being
|
||||||
|
// performed on lock object, and it is not a forced object removal.
|
||||||
|
var ErrLockObjectRemoval = meta.ErrLockObjectRemoval
|
||||||
|
|
||||||
// Inhume calls metabase. Inhume method to mark object as removed. It won't be
|
// Inhume calls metabase. Inhume method to mark object as removed. It won't be
|
||||||
// removed physically from blobStor and metabase until `Delete` operation.
|
// removed physically from blobStor and metabase until `Delete` operation.
|
||||||
//
|
//
|
||||||
|
@ -84,6 +89,10 @@ func (s *Shard) Inhume(prm InhumePrm) (InhumeRes, error) {
|
||||||
|
|
||||||
res, err := s.metaBase.Inhume(metaPrm)
|
res, err := s.metaBase.Inhume(metaPrm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if errors.Is(err, meta.ErrLockObjectRemoval) {
|
||||||
|
return InhumeRes{}, ErrLockObjectRemoval
|
||||||
|
}
|
||||||
|
|
||||||
s.log.Debug("could not mark object to delete in metabase",
|
s.log.Debug("could not mark object to delete in metabase",
|
||||||
zap.String("error", err.Error()),
|
zap.String("error", err.Error()),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue