From f6afb0c6d17c1e1d3972d64c6690fc02b011fc16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 5 Feb 2018 16:44:45 +0200 Subject: [PATCH] MXS-1643: Make Master and Slave status mutually exclusive The Master status now prevents Slave status from being assigned to a server. In practice this simply means that the master will not have both the Master and Slave status bits. --- server/modules/monitor/mariadbmon/mysql_mon.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/modules/monitor/mariadbmon/mysql_mon.cc b/server/modules/monitor/mariadbmon/mysql_mon.cc index e4dd9c5f2..1e451bcde 100644 --- a/server/modules/monitor/mariadbmon/mysql_mon.cc +++ b/server/modules/monitor/mariadbmon/mysql_mon.cc @@ -2303,9 +2303,10 @@ monitorMain(void *arg) } } - if (root_master) + if (root_master && SERVER_IS_MASTER(root_master->server)) { // Clear slave and stale slave status bits from current master + server_clear_status_nolock(root_master->server, SERVER_SLAVE | SERVER_STALE_SLAVE); monitor_clear_pending_status(root_master, SERVER_SLAVE | SERVER_STALE_SLAVE); /** @@ -2323,6 +2324,10 @@ monitorMain(void *arg) } } + ss_dassert(handle->master == root_master); + ss_dassert((root_master->server->status & (SERVER_SLAVE | SERVER_MASTER)) + != (SERVER_SLAVE | SERVER_MASTER)); + /** * After updating the status of all servers, check if monitor events * need to be launched.