forked from TrueCloudLab/frostfs-node
[#655] storage: Drop ErrorHandler
The only one usage was for logging. Now logging performed by storage anyway. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
137e987a4e
commit
29fe8c41f3
7 changed files with 45 additions and 20 deletions
|
@ -14,10 +14,12 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/compression"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
|
||||
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||
|
@ -25,6 +27,7 @@ import (
|
|||
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type keyLock interface {
|
||||
|
@ -41,6 +44,8 @@ func (l *noopKeyLock) Unlock(string) {}
|
|||
type FSTree struct {
|
||||
Info
|
||||
|
||||
log *logger.Logger
|
||||
|
||||
*compression.Config
|
||||
Depth uint64
|
||||
DirNameLen int
|
||||
|
@ -86,6 +91,7 @@ func New(opts ...Option) *FSTree {
|
|||
metrics: &noopMetrics{},
|
||||
fileGuard: &noopKeyLock{},
|
||||
fileCounter: &noopCounter{},
|
||||
log: &logger.Logger{Logger: zap.L()},
|
||||
}
|
||||
for i := range opts {
|
||||
opts[i](f)
|
||||
|
@ -145,9 +151,13 @@ func (t *FSTree) Iterate(ctx context.Context, prm common.IteratePrm) (common.Ite
|
|||
|
||||
func (t *FSTree) iterate(ctx context.Context, depth uint64, curPath []string, prm common.IteratePrm) error {
|
||||
curName := strings.Join(curPath[1:], "")
|
||||
des, err := os.ReadDir(filepath.Join(curPath...))
|
||||
dirPath := filepath.Join(curPath...)
|
||||
des, err := os.ReadDir(dirPath)
|
||||
if err != nil {
|
||||
if prm.IgnoreErrors {
|
||||
t.log.Warn(logs.BlobstorErrorOccurredDuringTheIteration,
|
||||
zap.String("err", err.Error()),
|
||||
zap.String("directory_path", dirPath))
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
|
@ -182,8 +192,8 @@ func (t *FSTree) iterate(ctx context.Context, depth uint64, curPath []string, pr
|
|||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
data, err := os.ReadFile(filepath.Join(curPath...))
|
||||
path := filepath.Join(curPath...)
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil && os.IsNotExist(err) {
|
||||
continue
|
||||
}
|
||||
|
@ -193,9 +203,10 @@ func (t *FSTree) iterate(ctx context.Context, depth uint64, curPath []string, pr
|
|||
}
|
||||
if err != nil {
|
||||
if prm.IgnoreErrors {
|
||||
if prm.ErrorHandler != nil {
|
||||
return prm.ErrorHandler(addr, err)
|
||||
}
|
||||
t.log.Warn(logs.BlobstorErrorOccurredDuringTheIteration,
|
||||
zap.Stringer("address", addr),
|
||||
zap.String("err", err.Error()),
|
||||
zap.String("path", path))
|
||||
continue
|
||||
}
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue