Remove old "detect_standalone_master"-feature, update documentation
The auto_failover is a more reliable solution and should be used instead. Several unused parameters were removed, although they can still be defined in the config file. Updated documentation on the relevant parts.
This commit is contained in:
@ -463,78 +463,6 @@ static bool check_replicate_wild_ignore_table(MXS_MONITORED_SERVER* database)
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check whether standalone master conditions have been met
|
||||
*
|
||||
* This function checks whether all the conditions to use a standalone master are met. For this to happen,
|
||||
* only one server must be available and other servers must have passed the configured tolerance level of
|
||||
* failures.
|
||||
*
|
||||
* @return True if standalone master should be used
|
||||
*/
|
||||
bool MariaDBMonitor::standalone_master_required()
|
||||
{
|
||||
int candidates = 0;
|
||||
for (auto iter = m_servers.begin(); iter != m_servers.end(); iter++)
|
||||
{
|
||||
MariaDBServer* server = *iter;
|
||||
if (server->is_running())
|
||||
{
|
||||
candidates++;
|
||||
if (server->m_read_only || !server->m_slave_status.empty() || candidates > 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (server->m_server_base->mon_err_count < m_failcount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return candidates == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Use standalone master
|
||||
*
|
||||
* This function assigns the last remaining server the master status and sets all other servers into
|
||||
* maintenance mode. By setting the servers into maintenance mode, we prevent any possible conflicts when
|
||||
* the failed servers come back up.
|
||||
*
|
||||
* @return True if standalone master was set
|
||||
*/
|
||||
bool MariaDBMonitor::set_standalone_master()
|
||||
{
|
||||
bool rval = false;
|
||||
for (auto iter = m_servers.begin(); iter != m_servers.end(); iter++)
|
||||
{
|
||||
MariaDBServer* server = *iter;
|
||||
auto mon_server = server->m_server_base;
|
||||
if (server->is_running())
|
||||
{
|
||||
if (!server->is_master() && m_warn_set_standalone_master)
|
||||
{
|
||||
MXS_WARNING("Setting standalone master, server '%s' is now the master.%s",
|
||||
server->name(), m_allow_cluster_recovery ? "" :
|
||||
" All other servers are set into maintenance mode.");
|
||||
m_warn_set_standalone_master = false;
|
||||
}
|
||||
|
||||
monitor_set_pending_status(mon_server, SERVER_MASTER | SERVER_WAS_MASTER);
|
||||
monitor_clear_pending_status(mon_server, SERVER_SLAVE);
|
||||
m_master = server;
|
||||
rval = true;
|
||||
}
|
||||
else if (!m_allow_cluster_recovery)
|
||||
{
|
||||
server->set_status(SERVER_MAINT);
|
||||
}
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the server with the best reach in the candidates-array. Running state or 'read_only' is ignored by
|
||||
* this method.
|
||||
|
||||
Reference in New Issue
Block a user