[#655] storage: Drop ErrorHandler
All checks were successful
DCO action / DCO (pull_request) Successful in 1m42s
Build / Build Components (1.21) (pull_request) Successful in 3m23s
Vulncheck / Vulncheck (pull_request) Successful in 3m25s
Build / Build Components (1.20) (pull_request) Successful in 4m16s
Tests and linters / Staticcheck (pull_request) Successful in 4m24s
Tests and linters / Lint (pull_request) Successful in 5m2s
Tests and linters / Tests (1.20) (pull_request) Successful in 5m36s
Tests and linters / Tests (1.21) (pull_request) Successful in 6m42s
Tests and linters / Tests with -race (pull_request) Successful in 7m18s

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:
Dmitrii Stepanov 2023-11-15 14:18:03 +03:00
parent 137e987a4e
commit 29fe8c41f3
7 changed files with 45 additions and 20 deletions

View file

@ -6,6 +6,7 @@ import (
"path/filepath"
"time"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobovnicza"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
@ -13,6 +14,7 @@ import (
"git.frostfs.info/TrueCloudLab/hrw"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
"go.uber.org/zap"
)
// Iterate iterates over all objects in b.
@ -38,9 +40,11 @@ func (b *Blobovniczas) Iterate(ctx context.Context, prm common.IteratePrm) (comm
data, err := b.compression.Decompress(elem.ObjectData())
if err != nil {
if prm.IgnoreErrors {
if prm.ErrorHandler != nil {
return prm.ErrorHandler(elem.Address(), err)
}
b.log.Warn(logs.BlobstorErrorOccurredDuringTheIteration,
zap.Stringer("address", elem.Address()),
zap.String("err", err.Error()),
zap.String("storage_id", p),
zap.String("root_path", b.rootPath))
return nil
}
return fmt.Errorf("could not decompress object data: %w", err)
@ -70,6 +74,10 @@ func (b *Blobovniczas) iterateBlobovniczas(ctx context.Context, ignoreErrors boo
blz, err := shBlz.Open()
if err != nil {
if ignoreErrors {
b.log.Warn(logs.BlobstorErrorOccurredDuringTheIteration,
zap.String("err", err.Error()),
zap.String("storage_id", p),
zap.String("root_path", b.rootPath))
return false, nil
}
return false, fmt.Errorf("could not open blobovnicza %s: %w", p, err)