local_object_storage: ignore pilorama errors

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-06-29 18:20:36 +03:00
parent 61ae8b0a2c
commit 85aa30e89c
2 changed files with 15 additions and 16 deletions

View file

@ -6,7 +6,6 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/pilorama" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/pilorama"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
cidSDK "github.com/nspcc-dev/neofs-sdk-go/container/id" cidSDK "github.com/nspcc-dev/neofs-sdk-go/container/id"
"go.uber.org/zap"
) )
var _ pilorama.Forest = (*StorageEngine)(nil) var _ pilorama.Forest = (*StorageEngine)(nil)
@ -21,9 +20,9 @@ func (e *StorageEngine) TreeMove(d pilorama.CIDDescriptor, treeID string, m *pil
if errors.Is(err, shard.ErrReadOnlyMode) { if errors.Is(err, shard.ErrReadOnlyMode) {
return nil, err return nil, err
} }
e.reportShardError(sh, sh.writeErrorCount, "can't perform `TreeMove`", err, //e.reportShardError(sh, sh.writeErrorCount, "can't perform `TreeMove`", err,
zap.Stringer("cid", d.CID), // zap.Stringer("cid", d.CID),
zap.String("tree", treeID)) // zap.String("tree", treeID))
continue continue
} }
return lm, nil return lm, nil
@ -41,9 +40,9 @@ func (e *StorageEngine) TreeAddByPath(d pilorama.CIDDescriptor, treeID string, a
if errors.Is(err, shard.ErrReadOnlyMode) { if errors.Is(err, shard.ErrReadOnlyMode) {
return nil, err return nil, err
} }
e.reportShardError(sh, sh.writeErrorCount, "can't perform `TreeAddByPath`", err, //e.reportShardError(sh, sh.writeErrorCount, "can't perform `TreeAddByPath`", err,
zap.Stringer("cid", d.CID), // zap.Stringer("cid", d.CID),
zap.String("tree", treeID)) // zap.String("tree", treeID))
continue continue
} }
return lm, nil return lm, nil
@ -60,9 +59,9 @@ func (e *StorageEngine) TreeApply(d pilorama.CIDDescriptor, treeID string, m *pi
if errors.Is(err, shard.ErrReadOnlyMode) { if errors.Is(err, shard.ErrReadOnlyMode) {
return err return err
} }
e.reportShardError(sh, sh.writeErrorCount, "can't perform `TreeApply`", err, //e.reportShardError(sh, sh.writeErrorCount, "can't perform `TreeApply`", err,
zap.Stringer("cid", d.CID), // zap.Stringer("cid", d.CID),
zap.String("tree", treeID)) // zap.String("tree", treeID))
continue continue
} }
return nil return nil
@ -99,9 +98,9 @@ func (e *StorageEngine) TreeGetMeta(cid cidSDK.ID, treeID string, nodeID piloram
m, p, err = sh.TreeGetMeta(cid, treeID, nodeID) m, p, err = sh.TreeGetMeta(cid, treeID, nodeID)
if err != nil { if err != nil {
if !errors.Is(err, pilorama.ErrTreeNotFound) { if !errors.Is(err, pilorama.ErrTreeNotFound) {
e.reportShardError(sh, sh.writeErrorCount, "can't perform `TreeGetMeta`", err, //e.reportShardError(sh, sh.writeErrorCount, "can't perform `TreeGetMeta`", err,
zap.Stringer("cid", cid), // zap.Stringer("cid", cid),
zap.String("tree", treeID)) // zap.String("tree", treeID))
} }
continue continue
} }

View file

@ -9,7 +9,7 @@ var _ pilorama.Forest = (*Shard)(nil)
// TreeMove implements the pilorama.Forest interface. // TreeMove implements the pilorama.Forest interface.
func (s *Shard) TreeMove(d pilorama.CIDDescriptor, treeID string, m *pilorama.Move) (*pilorama.LogMove, error) { func (s *Shard) TreeMove(d pilorama.CIDDescriptor, treeID string, m *pilorama.Move) (*pilorama.LogMove, error) {
if s.GetMode() != ModeReadWrite { if s.GetMode() == ModeReadOnly {
return nil, ErrReadOnlyMode return nil, ErrReadOnlyMode
} }
return s.pilorama.TreeMove(d, treeID, m) return s.pilorama.TreeMove(d, treeID, m)
@ -17,7 +17,7 @@ func (s *Shard) TreeMove(d pilorama.CIDDescriptor, treeID string, m *pilorama.Mo
// TreeAddByPath implements the pilorama.Forest interface. // TreeAddByPath implements the pilorama.Forest interface.
func (s *Shard) TreeAddByPath(d pilorama.CIDDescriptor, treeID string, attr string, path []string, meta []pilorama.KeyValue) ([]pilorama.LogMove, error) { func (s *Shard) TreeAddByPath(d pilorama.CIDDescriptor, treeID string, attr string, path []string, meta []pilorama.KeyValue) ([]pilorama.LogMove, error) {
if s.GetMode() != ModeReadWrite { if s.GetMode() == ModeReadOnly {
return nil, ErrReadOnlyMode return nil, ErrReadOnlyMode
} }
return s.pilorama.TreeAddByPath(d, treeID, attr, path, meta) return s.pilorama.TreeAddByPath(d, treeID, attr, path, meta)
@ -25,7 +25,7 @@ func (s *Shard) TreeAddByPath(d pilorama.CIDDescriptor, treeID string, attr stri
// TreeApply implements the pilorama.Forest interface. // TreeApply implements the pilorama.Forest interface.
func (s *Shard) TreeApply(d pilorama.CIDDescriptor, treeID string, m *pilorama.Move) error { func (s *Shard) TreeApply(d pilorama.CIDDescriptor, treeID string, m *pilorama.Move) error {
if s.GetMode() != ModeReadWrite { if s.GetMode() == ModeReadOnly {
return ErrReadOnlyMode return ErrReadOnlyMode
} }
return s.pilorama.TreeApply(d, treeID, m) return s.pilorama.TreeApply(d, treeID, m)