From 9304230212d098bf7da4ae9042a0a1496f85b8f6 Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Wed, 2 Sep 2020 12:25:16 +0300 Subject: [PATCH] MXS-3149 Properly remove master-status from server during demotion Removing it from the pending status field has not effect as the pending changes have all ready been written to real status. --- server/modules/monitor/mariadbmon/mariadbmon.cc | 2 -- server/modules/monitor/mariadbmon/mariadbserver.cc | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/server/modules/monitor/mariadbmon/mariadbmon.cc b/server/modules/monitor/mariadbmon/mariadbmon.cc index 95526a73c..6f12744d9 100644 --- a/server/modules/monitor/mariadbmon/mariadbmon.cc +++ b/server/modules/monitor/mariadbmon/mariadbmon.cc @@ -514,8 +514,6 @@ void MariaDBMonitor::tick() } log_master_changes(); - - flush_server_status(); process_state_changes(); hangup_failed_servers(); store_server_journal(m_master ? m_master->m_server_base : nullptr); diff --git a/server/modules/monitor/mariadbmon/mariadbserver.cc b/server/modules/monitor/mariadbmon/mariadbserver.cc index b63c67ed4..3d46bcc4d 100644 --- a/server/modules/monitor/mariadbmon/mariadbserver.cc +++ b/server/modules/monitor/mariadbmon/mariadbserver.cc @@ -1596,7 +1596,8 @@ bool MariaDBServer::demote(GeneralOpData& general, ServerOperation& demotion, Op // Step 2a: Remove [Master] from this server. This prevents compatible routers (RWS) // from routing writes to this server. Writes in flight will go through, at least until // read_only is set. - clear_status(SERVER_MASTER); + m_server_base->server->clear_status(SERVER_MASTER); + // Step 2b: If other users with SUPER privileges are on, kick them out now since // read_only doesn't stop them from doing writes. This does not stop them from immediately // logging back in but it's better than nothing. This also stops super-user writes going