From 7a4b6057cebb85ac93cd5b2f0bd60563c229db9b Mon Sep 17 00:00:00 2001 From: aarifullin Date: Wed, 13 Mar 2024 11:53:59 +0300 Subject: [PATCH] Revert "[#963] node: Go on initialization even deposit notary is hung" This reverts commit b4cb54e7ed83c1595129aa29e89db2d003707567. Signed-off-by: aarifullin --- cmd/frostfs-node/config.go | 6 ------ cmd/frostfs-node/main.go | 16 ++-------------- cmd/frostfs-node/morph.go | 2 -- internal/logs/logs.go | 2 -- 4 files changed, 2 insertions(+), 24 deletions(-) diff --git a/cmd/frostfs-node/config.go b/cmd/frostfs-node/config.go index 40fa34a95..48b76ac0f 100644 --- a/cmd/frostfs-node/config.go +++ b/cmd/frostfs-node/config.go @@ -352,12 +352,6 @@ type internals struct { log *logger.Logger - // Some methods that initialize node components may launch an asynchronous job, - // appending it to workers. That means despite application is already running, - // not all components completely initialized yet. - // initAppWG is used to control this situation. - initAppWG sync.WaitGroup - wg sync.WaitGroup workers []worker closers []closer diff --git a/cmd/frostfs-node/main.go b/cmd/frostfs-node/main.go index f82b2f171..e1eeb6861 100644 --- a/cmd/frostfs-node/main.go +++ b/cmd/frostfs-node/main.go @@ -67,10 +67,7 @@ func main() { bootUp(ctx, c) - go func() { - c.initAppWG.Wait() - c.compareAndSwapHealthStatus(control.HealthStatus_STARTING, control.HealthStatus_READY) - }() + c.compareAndSwapHealthStatus(control.HealthStatus_STARTING, control.HealthStatus_READY) wait(c) } @@ -147,16 +144,7 @@ func stopAndLog(c *cfg, name string, stopper func() error) { func bootUp(ctx context.Context, c *cfg) { runAndLog(ctx, c, "NATS", true, connectNats) runAndLog(ctx, c, "gRPC", false, func(_ context.Context, c *cfg) { serveGRPC(c) }) - - // It may happen that boot-up waits for the execution of a notary deposit transaction - // and waiting loop may hang for an indefinite time. In this case, we need to let - // frostfs-node go on initialization, although its functionality will be available partially. - // That's why makeAndWaitNotaryDeposit is run asynchroniosly. - c.initAppWG.Add(1) - c.workers = append(c.workers, newWorkerFromFunc(func(ctx context.Context) { - defer c.initAppWG.Done() - runAndLog(ctx, c, "notary", true, makeAndWaitNotaryDeposit) - })) + runAndLog(ctx, c, "notary", true, makeAndWaitNotaryDeposit) bootstrapNode(c) startWorkers(ctx, c) diff --git a/cmd/frostfs-node/morph.go b/cmd/frostfs-node/morph.go index 1b148095b..698fb3b83 100644 --- a/cmd/frostfs-node/morph.go +++ b/cmd/frostfs-node/morph.go @@ -158,7 +158,6 @@ var ( func waitNotaryDeposit(ctx context.Context, c *cfg, tx util.Uint256) error { for i := 0; i < notaryDepositRetriesAmount; i++ { - c.log.Debug(logs.ClientAttemptToWaitForNotaryDepositTransactionToGetPersisted) select { case <-ctx.Done(): return ctx.Err() @@ -168,7 +167,6 @@ func waitNotaryDeposit(ctx context.Context, c *cfg, tx util.Uint256) error { ok, err := c.cfgMorph.client.TxHalt(tx) if err == nil { if ok { - c.log.Info(logs.ClientNotaryDepositTransactionWasSuccessfullyPersisted) return nil } diff --git a/internal/logs/logs.go b/internal/logs/logs.go index bd8b8ed01..6b48940b7 100644 --- a/internal/logs/logs.go +++ b/internal/logs/logs.go @@ -158,8 +158,6 @@ const ( ClientNotaryDepositInvoke = "notary deposit invoke" ClientNotaryRequestWithPreparedMainTXInvoked = "notary request with prepared main TX invoked" ClientNotaryRequestInvoked = "notary request invoked" - ClientNotaryDepositTransactionWasSuccessfullyPersisted = "notary deposit transaction was successfully persisted" - ClientAttemptToWaitForNotaryDepositTransactionToGetPersisted = "attempt to wait for notary deposit transaction to get persisted" ClientNeoClientInvoke = "neo client invoke" ClientNativeGasTransferInvoke = "native gas transfer invoke" ClientBatchGasTransferInvoke = "batch gas transfer invoke"