engine: Do not increase error counter on meta mismatch #686

Merged
fyrchik merged 1 commits from fyrchik/frostfs-node:fix-logic-error into master 2023-09-14 08:09:36 +00:00
4 changed files with 13 additions and 7 deletions

View File

@ -258,6 +258,7 @@ const (
ShardMetaObjectCounterRead = "meta: object counter read"
ShardMetaCantReadContainerList = "meta: can't read container list"
ShardMetaCantReadContainerSize = "meta: can't read container size"
ShardMetaInfoPresentButObjectNotFound = "meta info was present, but the object is missing"
ShardMetabaseFailureSwitchingMode = "metabase failure, switching mode"
ShardCantMoveShardToReadonlySwitchMode = "can't move shard to readonly, switch mode"
ShardCouldNotUnmarshalObject = "could not unmarshal object"

View File

@ -217,7 +217,7 @@ func TestBlobstorFailback(t *testing.T) {
require.True(t, shard.IsErrOutOfRange(err))
}
checkShardState(t, te.ng, te.shards[0].id, 2, mode.ReadOnly)
checkShardState(t, te.ng, te.shards[0].id, 0, mode.ReadWrite)
checkShardState(t, te.ng, te.shards[1].id, 0, mode.ReadWrite)
}

View File

@ -4,6 +4,7 @@ import (
"context"
"errors"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr"
@ -100,9 +101,11 @@ func (e *StorageEngine) get(ctx context.Context, prm GetPrm) (GetRes, error) {
if it.Object == nil {
return GetRes{}, it.OutError
}
if it.ShardWithMeta.Shard != nil {
e.reportShardError(it.ShardWithMeta, "meta info was present, but object is missing",
it.MetaError, zap.Stringer("address", prm.addr))
if it.ShardWithMeta.Shard != nil && it.MetaError != nil {
e.log.Warn(logs.ShardMetaInfoPresentButObjectNotFound,
zap.Stringer("shard_id", it.ShardWithMeta.ID()),
zap.String("error", it.MetaError.Error()),
zap.Stringer("address", prm.addr))
}
}

View File

@ -5,6 +5,7 @@ import (
"errors"
"strconv"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr"
@ -113,9 +114,10 @@ func (e *StorageEngine) getRange(ctx context.Context, prm RngPrm) (RngRes, error
if it.Object == nil {
return RngRes{}, it.OutError
}
if it.ShardWithMeta.Shard != nil {
e.reportShardError(it.ShardWithMeta, "meta info was present, but object is missing",
it.MetaError,
if it.ShardWithMeta.Shard != nil && it.MetaError != nil {
e.log.Warn(logs.ShardMetaInfoPresentButObjectNotFound,
zap.Stringer("shard_id", it.ShardWithMeta.ID()),
zap.String("error", it.MetaError.Error()),
zap.Stringer("address", prm.addr))
}
}