From 36f71b268998829e8d716dc8218282eb4ba20b42 Mon Sep 17 00:00:00 2001 From: suetin Date: Mon, 24 Jun 2024 22:56:10 +0300 Subject: [PATCH] add repl_mon chech in async mode --- internal/app/app.go | 8 +++++--- internal/config/config.go | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/app/app.go b/internal/app/app.go index b71a199b..f5e6f910 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -758,9 +758,11 @@ func (app *App) stateManager() appState { app.logger.Errorf("failed to update active nodes in dcs: %v", err) } - err = app.updateReplMonTS(master) - if err != nil { - app.logger.Errorf("failed to update repl_mon timestamp: %v", err) + if app.config.ReplMon { + err = app.updateReplMonTS(master) + if err != nil { + app.logger.Errorf("failed to update repl_mon timestamp: %v", err) + } } return stateManager diff --git a/internal/config/config.go b/internal/config/config.go index 5fe6b956..23826a6d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -224,5 +224,8 @@ func (cfg *Config) Validate() error { if cfg.SemiSync && cfg.ASync { return fmt.Errorf("can't run in both semisync and async mode") } + if cfg.ASync && !cfg.ReplMon { + return fmt.Errorf("repl mon must be enabled to run mysync in async mode") + } return nil }