forked from TrueCloudLab/frostfs-node
[#1905] shard: Don't log read-only errors of write-cache
There is no need to log `writecache.ErrReadOnly` errors in `Delete` method of the `Shard`. Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
This commit is contained in:
parent
b1fa084756
commit
e8c5f03c30
2 changed files with 10 additions and 1 deletions
|
@ -1,8 +1,11 @@
|
||||||
package shard
|
package shard
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/common"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/common"
|
||||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||||
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache"
|
||||||
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
@ -39,7 +42,7 @@ func (s *Shard) Delete(prm DeletePrm) (DeleteRes, error) {
|
||||||
for i := range prm.addr {
|
for i := range prm.addr {
|
||||||
if s.hasWriteCache() {
|
if s.hasWriteCache() {
|
||||||
err := s.writeCache.Delete(prm.addr[i])
|
err := s.writeCache.Delete(prm.addr[i])
|
||||||
if err != nil && !IsErrNotFound(err) {
|
if err != nil && !IsErrNotFound(err) && !errors.Is(err, writecache.ErrReadOnly) {
|
||||||
s.log.Warn("can't delete object from write cache", zap.String("error", err.Error()))
|
s.log.Warn("can't delete object from write cache", zap.String("error", err.Error()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,12 @@ type Info struct {
|
||||||
type Cache interface {
|
type Cache interface {
|
||||||
Get(address oid.Address) (*object.Object, error)
|
Get(address oid.Address) (*object.Object, error)
|
||||||
Head(oid.Address) (*object.Object, error)
|
Head(oid.Address) (*object.Object, error)
|
||||||
|
// Delete removes object referenced by the given oid.Address from the
|
||||||
|
// Cache. Returns any error encountered that prevented the object to be
|
||||||
|
// removed.
|
||||||
|
//
|
||||||
|
// Returns apistatus.ObjectNotFound if object is missing in the Cache.
|
||||||
|
// Returns ErrReadOnly if the Cache is currently in the read-only mode.
|
||||||
Delete(oid.Address) error
|
Delete(oid.Address) error
|
||||||
Iterate(IterationPrm) error
|
Iterate(IterationPrm) error
|
||||||
Put(common.PutPrm) (common.PutRes, error)
|
Put(common.PutPrm) (common.PutRes, error)
|
||||||
|
|
Loading…
Reference in a new issue