From 34f61bc4f2864a99e03f30e26f64038d3e7f7db6 Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Mon, 2 Jul 2018 19:10:43 +0300 Subject: [PATCH] Close connections before starting loop The connections should be closed after the check queries. --- .../modules/monitor/mariadbmon/mariadbmon.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/server/modules/monitor/mariadbmon/mariadbmon.cc b/server/modules/monitor/mariadbmon/mariadbmon.cc index 0f7f7dcdf..a7ba2575a 100644 --- a/server/modules/monitor/mariadbmon/mariadbmon.cc +++ b/server/modules/monitor/mariadbmon/mariadbmon.cc @@ -360,10 +360,15 @@ void MariaDBMonitor::pre_loop() // MonitorInstance read the journal and has the last known master in its m_master member variable. // Write the corresponding MariaDBServer into the class-specific m_master variable. m_master = MonitorInstance::m_master ? get_server_info(MonitorInstance::m_master) : NULL; + m_log_no_master = true; - /* It's possible (e.g. after switchover) that the MXS_MONITORED_SERVER-objects have live connections - * from last time the monitor was active. These should be closed to avoid confusing the monitor and - * making it clear this is a new start. This can be removed once monitor pause/resume is implemented. */ + if (m_detect_replication_lag) + { + check_maxscale_schema_replication(); + } + + /* This loop can be removed if/once the replication check code is inside tick. It's required so that + * the monitor makes new connections when starting. */ for (MariaDBServer* server : m_servers) { if (server->m_server_base->con) @@ -372,13 +377,6 @@ void MariaDBMonitor::pre_loop() server->m_server_base->con = NULL; } } - - if (m_detect_replication_lag) - { - check_maxscale_schema_replication(); - } - - m_log_no_master = true; } void MariaDBMonitor::tick()