diff --git a/cmd/frostfs-node/netmap.go b/cmd/frostfs-node/netmap.go index b0acac032..e7d3271b1 100644 --- a/cmd/frostfs-node/netmap.go +++ b/cmd/frostfs-node/netmap.go @@ -333,7 +333,7 @@ func (c *cfg) netmapInitLocalNodeState(epoch uint64) (*netmapSDK.NodeInfo, bool, if nmState != candidateState { // This happens when the node was switched to maintenance without epoch tick. // We expect it to continue staying in maintenance. - c.log.Info("candidate status is different from the netmap status, the former takes priority", + c.log.Info(logs.CandidateStatusPriority, zap.String("netmap", nmState), zap.String("candidate", candidateState)) } diff --git a/internal/logs/logs.go b/internal/logs/logs.go index ad4003bed..68914d6a3 100644 --- a/internal/logs/logs.go +++ b/internal/logs/logs.go @@ -495,6 +495,22 @@ const ( FrostFSNodeNodeIsUnderMaintenanceSkipInitialBootstrap = "the node is under maintenance, skip initial bootstrap" EngineCouldNotChangeShardModeToDisabled = "could not change shard mode to disabled" NetmapNodeAlreadyInCandidateListOnlineSkipInitialBootstrap = "the node is already in candidate list with online state, skip initial bootstrap" + RPConnectionLost = "RPC connection lost, attempting reconnect" + RPCNodeSwitchFailure = "can't switch RPC node" + FSTreeCantReadFile = "can't read a file" + FSTreeCantUnmarshalObject = "can't unmarshal an object" + FSTreeCantFushObjectBlobstor = "can't flush an object to blobstor" + FSTreeCantUpdateID = "can't update object storage ID" + FSTreeCantDecodeDBObjectAddress = "can't decode object address from the DB" + PutSingleRedirectFailure = "failed to redirect PutSingle request" + StorageIDRetrievalFailure = "can't get storage ID from metabase" + ObjectRemovalFailureBlobStor = "can't remove object from blobStor" + CandidateStatusPriority = "candidate status is different from the netmap status, the former takes priority" + TombstoneExpirationParseFailure = "tombstone getter: could not parse tombstone expiration epoch" + FrostFSNodeCantUpdateObjectStorageID = "can't update object storage ID" + FrostFSNodeCantFlushObjectToBlobstor = "can't flush an object to blobstor" + FrostFSNodeCantDecodeObjectAddressFromDB = "can't decode object address from the DB" // Error in ../node/cmd/frostfs-node/morph.go + FrostFSNodeCantUnmarshalObjectFromDB = "can't unmarshal an object from the DB" // Error in ../node/cmd/frostfs-node/morph.go RuntimeSoftMemoryLimitUpdated = "soft runtime memory limit value updated" RuntimeSoftMemoryDefinedWithGOMEMLIMIT = "soft runtime memory defined with GOMEMLIMIT environment variable, config value skipped" ) diff --git a/pkg/local_object_storage/shard/delete.go b/pkg/local_object_storage/shard/delete.go index c683d65a8..662c0835a 100644 --- a/pkg/local_object_storage/shard/delete.go +++ b/pkg/local_object_storage/shard/delete.go @@ -92,7 +92,7 @@ func (s *Shard) deleteFromBlobstorSafe(ctx context.Context, addr oid.Address) { res, err := s.metaBase.StorageID(ctx, sPrm) if err != nil { - s.log.Debug("can't get storage ID from metabase", + s.log.Debug(logs.StorageIDRetrievalFailure, zap.Stringer("object", addr), zap.String("error", err.Error())) } @@ -104,7 +104,7 @@ func (s *Shard) deleteFromBlobstorSafe(ctx context.Context, addr oid.Address) { _, err = s.blobStor.Delete(ctx, delPrm) if err != nil { - s.log.Debug("can't remove object from blobStor", + s.log.Debug(logs.ObjectRemovalFailureBlobStor, zap.Stringer("object_address", addr), zap.String("error", err.Error())) } diff --git a/pkg/local_object_storage/writecache/writecachebadger/flush.go b/pkg/local_object_storage/writecache/writecachebadger/flush.go index d8bdddb56..fec6ecf88 100644 --- a/pkg/local_object_storage/writecache/writecachebadger/flush.go +++ b/pkg/local_object_storage/writecache/writecachebadger/flush.go @@ -188,7 +188,7 @@ func (c *cache) flushObject(ctx context.Context, obj *objectSDK.Object, data []b if err != nil { if !errors.Is(err, common.ErrNoSpace) && !errors.Is(err, common.ErrReadOnly) && !errors.Is(err, blobstor.ErrNoPlaceFound) { - c.reportFlushError("can't flush an object to blobstor", + c.reportFlushError(logs.FrostFSNodeCantFlushObjectToBlobstor, addr.EncodeToString(), err) } return err @@ -200,7 +200,7 @@ func (c *cache) flushObject(ctx context.Context, obj *objectSDK.Object, data []b _, err = c.metabase.UpdateStorageID(updPrm) if err != nil { - c.reportFlushError("can't update object storage ID", + c.reportFlushError(logs.FrostFSNodeCantUpdateObjectStorageID, addr.EncodeToString(), err) } return err @@ -230,7 +230,7 @@ func (c *cache) flush(ctx context.Context, ignoreErrors bool) error { for it.Rewind(); it.Valid(); it.Next() { if got, want := int(it.Item().KeySize()), len(key); got != want { err := fmt.Errorf("invalid db key len: got %d, want %d", got, want) - c.reportFlushError("can't decode object address from the DB", hex.EncodeToString(it.Item().Key()), metaerr.Wrap(err)) + c.reportFlushError(logs.FrostFSNodeCantDecodeObjectAddressFromDB, hex.EncodeToString(it.Item().Key()), metaerr.Wrap(err)) if ignoreErrors { continue } @@ -240,7 +240,7 @@ func (c *cache) flush(ctx context.Context, ignoreErrors bool) error { var obj objectSDK.Object if err := obj.Unmarshal(data); err != nil { copy(key[:], it.Item().Key()) - c.reportFlushError("can't unmarshal an object from the DB", key.address().EncodeToString(), metaerr.Wrap(err)) + c.reportFlushError(logs.FrostFSNodeCantUnmarshalObjectFromDB, key.address().EncodeToString(), metaerr.Wrap(err)) if ignoreErrors { return nil } diff --git a/pkg/local_object_storage/writecache/writecachebbolt/flush.go b/pkg/local_object_storage/writecache/writecachebbolt/flush.go index 4c1fb60e3..c3b0f89bb 100644 --- a/pkg/local_object_storage/writecache/writecachebbolt/flush.go +++ b/pkg/local_object_storage/writecache/writecachebbolt/flush.go @@ -194,7 +194,7 @@ func (c *cache) flushFSTree(ctx context.Context, ignoreErrors bool) error { data, err := f() if err != nil { - c.reportFlushError("can't read a file", sAddr, metaerr.Wrap(err)) + c.reportFlushError(logs.FSTreeCantReadFile, sAddr, metaerr.Wrap(err)) if ignoreErrors { return nil } @@ -204,7 +204,7 @@ func (c *cache) flushFSTree(ctx context.Context, ignoreErrors bool) error { var obj objectSDK.Object err = obj.Unmarshal(data) if err != nil { - c.reportFlushError("can't unmarshal an object", sAddr, metaerr.Wrap(err)) + c.reportFlushError(logs.FSTreeCantUnmarshalObject, sAddr, metaerr.Wrap(err)) if ignoreErrors { return nil } @@ -268,7 +268,7 @@ func (c *cache) flushObject(ctx context.Context, obj *objectSDK.Object, data []b if err != nil { if !errors.Is(err, common.ErrNoSpace) && !errors.Is(err, common.ErrReadOnly) && !errors.Is(err, blobstor.ErrNoPlaceFound) { - c.reportFlushError("can't flush an object to blobstor", + c.reportFlushError(logs.FSTreeCantFushObjectBlobstor, addr.EncodeToString(), err) } return err @@ -280,7 +280,7 @@ func (c *cache) flushObject(ctx context.Context, obj *objectSDK.Object, data []b _, err = c.metabase.UpdateStorageID(updPrm) if err != nil { - c.reportFlushError("can't update object storage ID", + c.reportFlushError(logs.FSTreeCantUpdateID, addr.EncodeToString(), err) } return err @@ -315,7 +315,7 @@ func (c *cache) flush(ctx context.Context, ignoreErrors bool) error { for k, data := cs.Seek(nil); k != nil; k, data = cs.Next() { sa := string(k) if err := addr.DecodeString(sa); err != nil { - c.reportFlushError("can't decode object address from the DB", sa, metaerr.Wrap(err)) + c.reportFlushError(logs.FSTreeCantDecodeDBObjectAddress, sa, metaerr.Wrap(err)) if ignoreErrors { continue } @@ -324,7 +324,7 @@ func (c *cache) flush(ctx context.Context, ignoreErrors bool) error { var obj objectSDK.Object if err := obj.Unmarshal(data); err != nil { - c.reportFlushError("can't unmarshal an object from the DB", sa, metaerr.Wrap(err)) + c.reportFlushError(logs.FSTreeCantDecodeDBObjectAddress, sa, metaerr.Wrap(err)) if ignoreErrors { continue } diff --git a/pkg/morph/subscriber/subscriber.go b/pkg/morph/subscriber/subscriber.go index 4076111f0..c2d8494fa 100644 --- a/pkg/morph/subscriber/subscriber.go +++ b/pkg/morph/subscriber/subscriber.go @@ -250,9 +250,9 @@ routeloop: } func (s *subscriber) switchEndpoint(ctx context.Context, finishCh chan<- bool) (bool, <-chan rpcclient.Notification) { - s.log.Info("RPC connection lost, attempting reconnect") + s.log.Info(logs.RPConnectionLost) if !s.client.SwitchRPC(ctx) { - s.log.Error("can't switch RPC node") + s.log.Error(logs.RPCNodeSwitchFailure) return false, nil } diff --git a/pkg/services/object/put/single.go b/pkg/services/object/put/single.go index 7c7955c87..eb18f0f46 100644 --- a/pkg/services/object/put/single.go +++ b/pkg/services/object/put/single.go @@ -343,7 +343,7 @@ func (s *Service) redirectPutSingleRequest(ctx context.Context, if err != nil { objID, _ := obj.ID() cnrID, _ := obj.ContainerID() - s.log.Warn("failed to redirect PutSingle request", + s.log.Warn(logs.PutSingleRedirectFailure, zap.Error(err), zap.Stringer("address", addr), zap.Stringer("object_id", objID), diff --git a/pkg/services/object_manager/tombstone/checker.go b/pkg/services/object_manager/tombstone/checker.go index 66a0ec7d3..c3c810001 100644 --- a/pkg/services/object_manager/tombstone/checker.go +++ b/pkg/services/object_manager/tombstone/checker.go @@ -78,7 +78,7 @@ func (g *ExpirationChecker) handleTS(addr string, ts *objectSDK.Object, reqEpoch epoch, err := strconv.ParseUint(atr.Value(), 10, 64) if err != nil { g.log.Warn( - "tombstone getter: could not parse tombstone expiration epoch", + logs.TombstoneExpirationParseFailure, zap.Error(err), )