MXS-1775 Make MariaDBMon non-dependent on stop() return value

To align it with the behavour or MonitorInstance::stop()
This commit is contained in:
Johan Wikman
2018-05-28 11:43:36 +03:00
parent e8deb553be
commit f862939dd7
4 changed files with 56 additions and 9 deletions

View File

@ -25,9 +25,10 @@ static void print_redirect_errors(MariaDBServer* first_server, const ServerArray
bool MariaDBMonitor::manual_switchover(SERVER* new_master, SERVER* current_master, json_t** error_out)
{
bool stopped = stop();
if (stopped)
bool running = is_running();
if (running)
{
stop();
MXS_NOTICE("Stopped the monitor %s for the duration of switchover.", m_monitor_base->name);
}
else
@ -69,7 +70,7 @@ bool MariaDBMonitor::manual_switchover(SERVER* new_master, SERVER* current_maste
}
}
if (stopped)
if (running)
{
// TODO: What if this fails?
start(m_monitor_base->parameters);
@ -79,9 +80,10 @@ bool MariaDBMonitor::manual_switchover(SERVER* new_master, SERVER* current_maste
bool MariaDBMonitor::manual_failover(json_t** output)
{
bool stopped = stop();
if (stopped)
bool running = is_running();
if (running)
{
stop();
MXS_NOTICE("Stopped monitor %s for the duration of failover.", m_monitor_base->name);
}
else
@ -104,7 +106,7 @@ bool MariaDBMonitor::manual_failover(json_t** output)
}
}
if (stopped)
if (running)
{
// TODO: What if this fails?
start(m_monitor_base->parameters);
@ -114,9 +116,10 @@ bool MariaDBMonitor::manual_failover(json_t** output)
bool MariaDBMonitor::manual_rejoin(SERVER* rejoin_server, json_t** output)
{
bool stopped = stop();
if (stopped)
bool running = is_running();
if (running)
{
stop();
MXS_NOTICE("Stopped monitor %s for the duration of rejoin.", m_monitor_base->name);
}
else
@ -178,7 +181,7 @@ bool MariaDBMonitor::manual_rejoin(SERVER* rejoin_server, json_t** output)
PRINT_MXS_JSON_ERROR(output, BAD_CLUSTER, m_monitor_base->name);
}
if (stopped)
if (running)
{
// TODO: What if this fails?
start(m_monitor_base->parameters);