diff --git a/cmd/frostfs-node/morph.go b/cmd/frostfs-node/morph.go index 6c09ae022..4ab2eacad 100644 --- a/cmd/frostfs-node/morph.go +++ b/cmd/frostfs-node/morph.go @@ -117,6 +117,14 @@ func makeAndWaitNotaryDeposit(c *cfg) { tx, err := makeNotaryDeposit(c) fatalOnErr(err) + if tx.Equals(util.Uint256{}) { + // non-error deposit with an empty TX hash means + // that the deposit has already been made; no + // need to wait it. + c.log.Info("notary deposit has already been made") + return + } + err = waitNotaryDeposit(c, tx) fatalOnErr(err) } diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 200a20179..1c2d797ef 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -13,7 +13,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/audit" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/balance" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/container" - frostfs "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/frostfs" + "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/frostfs" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/governance" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/netmap" nodevalidator "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/netmap/nodevalidation" @@ -411,8 +411,7 @@ func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan } } - server.mainNotaryConfig, server.sideNotaryConfig = parseNotaryConfigs( - cfg, + server.mainNotaryConfig, server.sideNotaryConfig = notaryConfigs( server.morphClient.ProbeNotary(), !server.withoutMainNet && server.mainnetClient.ProbeNotary(), // if mainnet disabled then notary flag must be disabled too ) diff --git a/pkg/innerring/notary.go b/pkg/innerring/notary.go index 8680066e9..50353b574 100644 --- a/pkg/innerring/notary.go +++ b/pkg/innerring/notary.go @@ -7,7 +7,6 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event" "github.com/nspcc-dev/neo-go/pkg/util" - "github.com/spf13/viper" "go.uber.org/zap" ) @@ -79,6 +78,14 @@ func (s *Server) initNotary(ctx context.Context, deposit depositor, await awaite return err } + if tx.Equals(util.Uint256{}) { + // non-error deposit with an empty TX hash means + // that the deposit has already been made; no + // need to wait it. + s.log.Info("notary deposit has already been made") + return nil + } + s.log.Info(msg) return await(ctx, tx) @@ -88,7 +95,7 @@ func awaitNotaryDepositInClient(ctx context.Context, cli *client.Client, txHash for i := 0; i < notaryDepositTimeout; i++ { select { case <-ctx.Done(): - return nil + return ctx.Err() default: } @@ -107,7 +114,7 @@ func awaitNotaryDepositInClient(ctx context.Context, cli *client.Client, txHash return errDepositTimeout } -func parseNotaryConfigs(cfg *viper.Viper, withSideNotary, withMainNotary bool) (main, side *notaryConfig) { +func notaryConfigs(withSideNotary, withMainNotary bool) (main, side *notaryConfig) { main = new(notaryConfig) side = new(notaryConfig) diff --git a/pkg/local_object_storage/engine/inhume.go b/pkg/local_object_storage/engine/inhume.go index 151820ab2..007e51d89 100644 --- a/pkg/local_object_storage/engine/inhume.go +++ b/pkg/local_object_storage/engine/inhume.go @@ -222,7 +222,7 @@ func (e *StorageEngine) processExpiredLocks(ctx context.Context, lockers []oid.A select { case <-ctx.Done(): - e.log.Info("interrupt processing the expired locks by context") + e.log.Info("interrupt processing the expired locks", zap.Error(ctx.Err())) return true default: return false @@ -236,7 +236,7 @@ func (e *StorageEngine) processDeletedLocks(ctx context.Context, lockers []oid.A select { case <-ctx.Done(): - e.log.Info("interrupt processing the deleted locks by context") + e.log.Info("interrupt processing the deleted locks", zap.Error(ctx.Err())) return true default: return false diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index 80682886e..b93c5f75f 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -340,7 +340,7 @@ func (c *Client) Wait(ctx context.Context, n uint32) error { for { select { case <-ctx.Done(): - return nil + return ctx.Err() default: } diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index 307a989fa..464d76d2a 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -202,7 +202,7 @@ func (c *Client) depositNotary(amount fixedn.Fixed8, till int64) (res util.Uint2 // Transaction is already in mempool waiting to be processed. // This is an expected situation if we restart the service. - c.logger.Debug("notary deposit has already been made", + c.logger.Info("notary deposit has already been made", zap.Int64("amount", int64(amount)), zap.Int64("expire_at", till), zap.Uint32("vub", vub), @@ -210,7 +210,7 @@ func (c *Client) depositNotary(amount fixedn.Fixed8, till int64) (res util.Uint2 return util.Uint256{}, nil } - c.logger.Debug("notary deposit invoke", + c.logger.Info("notary deposit invoke", zap.Int64("amount", int64(amount)), zap.Int64("expire_at", till), zap.Uint32("vub", vub),