Turn server status macros to functions
This commit is contained in:
@ -382,7 +382,7 @@ MXS_MONITORED_SERVER *GaleraMonitor::get_candidate_master()
|
||||
/* set min_id to the lowest value of moitor_servers->server->node_id */
|
||||
while (moitor_servers)
|
||||
{
|
||||
if (!SERVER_IN_MAINT(moitor_servers->server) &&
|
||||
if (!server_is_in_maint(moitor_servers->server) &&
|
||||
(moitor_servers->pending_status & SERVER_JOINED))
|
||||
{
|
||||
|
||||
@ -463,7 +463,7 @@ static MXS_MONITORED_SERVER *set_cluster_master(MXS_MONITORED_SERVER *current_ma
|
||||
*
|
||||
*/
|
||||
if ((current_master->pending_status & SERVER_JOINED) &&
|
||||
(!SERVER_IN_MAINT(current_master->server)))
|
||||
(!server_is_in_maint(current_master->server)))
|
||||
{
|
||||
return current_master;
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ bool MariaDBMonitor::switchover_demote_master(MariaDBServer* current_master, jso
|
||||
MYSQL* conn = current_master->m_server_base->con;
|
||||
const char* query = ""; // The next query to execute. Used also for error printing.
|
||||
// The presence of an external master changes several things.
|
||||
const bool external_master = SERVER_IS_SLAVE_OF_EXT_MASTER(current_master->m_server_base->server);
|
||||
const bool external_master = server_is_slave_of_ext_master(current_master->m_server_base->server);
|
||||
|
||||
if (external_master)
|
||||
{
|
||||
@ -1178,8 +1178,8 @@ bool MariaDBMonitor::is_candidate_better(const MariaDBServer* current_best, cons
|
||||
// If both have log_slave_updates on ...
|
||||
else if (cand_updates && curr_updates)
|
||||
{
|
||||
bool cand_disk_ok = !SERVER_IS_DISK_SPACE_EXHAUSTED(candidate->m_server_base->server);
|
||||
bool curr_disk_ok = !SERVER_IS_DISK_SPACE_EXHAUSTED(current_best->m_server_base->server);
|
||||
bool cand_disk_ok = !server_is_disk_space_exhausted(candidate->m_server_base->server);
|
||||
bool curr_disk_ok = !server_is_disk_space_exhausted(current_best->m_server_base->server);
|
||||
// ... prefer a slave without disk space issues.
|
||||
if (cand_disk_ok && !curr_disk_ok)
|
||||
{
|
||||
@ -1215,7 +1215,7 @@ bool MariaDBMonitor::switchover_check_current(const MXS_MONITORED_SERVER* sugges
|
||||
mon_serv != NULL && extra_master == NULL;
|
||||
mon_serv = mon_serv->next)
|
||||
{
|
||||
if (SRV_MASTER_STATUS(mon_serv->pending_status))
|
||||
if (srv_master_status(mon_serv->pending_status))
|
||||
{
|
||||
if (mon_serv == suggested_curr_master)
|
||||
{
|
||||
|
@ -606,7 +606,7 @@ void MariaDBMonitor::update_gtid_domain()
|
||||
|
||||
void MariaDBMonitor::update_external_master()
|
||||
{
|
||||
if (SERVER_IS_SLAVE_OF_EXT_MASTER(m_master->m_server_base->server))
|
||||
if (server_is_slave_of_ext_master(m_master->m_server_base->server))
|
||||
{
|
||||
ss_dassert(!m_master->m_slave_status.empty());
|
||||
if (m_master->m_slave_status[0].master_host != m_external_master_host ||
|
||||
|
@ -436,7 +436,7 @@ bool MariaDBServer::wait_until_gtid(const GtidList& target, int timeout, json_t*
|
||||
bool MariaDBServer::is_master() const
|
||||
{
|
||||
// Similar to macro SERVER_IS_MASTER
|
||||
return SRV_MASTER_STATUS(m_server_base->pending_status);
|
||||
return srv_master_status(m_server_base->pending_status);
|
||||
}
|
||||
|
||||
bool MariaDBServer::is_slave() const
|
||||
|
@ -321,7 +321,7 @@ void MMMonitor::post_tick()
|
||||
|
||||
for(MXS_MONITORED_SERVER *ptr = m_monitor->monitored_servers; ptr; ptr = ptr->next)
|
||||
{
|
||||
if (!SERVER_IN_MAINT(ptr->server))
|
||||
if (!server_is_in_maint(ptr->server))
|
||||
{
|
||||
/* If "detect_stale_master" option is On, let's use the previus master */
|
||||
if (m_detectStaleMaster && root_master &&
|
||||
@ -369,7 +369,7 @@ MXS_MONITORED_SERVER *MMMonitor::get_current_master()
|
||||
* that means SERVER_IS_RUNNING returns 0
|
||||
* Let's check only for SERVER_IS_DOWN: server is not running
|
||||
*/
|
||||
if (SERVER_IS_DOWN(ptr->server))
|
||||
if (server_is_down(ptr->server))
|
||||
{
|
||||
ptr = ptr->next;
|
||||
continue;
|
||||
@ -391,7 +391,7 @@ MXS_MONITORED_SERVER *MMMonitor::get_current_master()
|
||||
if (m_master != NULL)
|
||||
{
|
||||
/* If the root master is in MAINT, return NULL */
|
||||
if (SERVER_IN_MAINT(m_master->server))
|
||||
if (server_is_in_maint(m_master->server))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user