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.
This commit is contained in:
Markus Mäkelä 2018-02-05 16:44:45 +02:00
parent 9f7189a9a4
commit f6afb0c6d1
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -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.