diff --git a/server/modules/monitor/mariadbmon/cluster_discovery.cc b/server/modules/monitor/mariadbmon/cluster_discovery.cc index 430416bba..99f9a7fa6 100644 --- a/server/modules/monitor/mariadbmon/cluster_discovery.cc +++ b/server/modules/monitor/mariadbmon/cluster_discovery.cc @@ -664,6 +664,16 @@ void MariaDBMonitor::assign_master_and_slave() reset_node_index_info(); assign_slave_and_relay_master(m_master); } + else + { + for (MariaDBServer* s: m_servers) + { + if (s->has_status(SERVER_WAS_SLAVE)) + { + s->set_status(SERVER_SLAVE); + } + } + } } /** @@ -760,7 +770,7 @@ bool MariaDBMonitor::master_is_valid(std::string* reason_out) // The master server of the cluster needs to be re-calculated in the following four cases: bool rval = true; // 1) There is no master. - if (m_master == NULL) + if (m_master == NULL || m_master->is_down()) { rval = false; } diff --git a/server/modules/monitor/mariadbmon/cluster_manipulation.cc b/server/modules/monitor/mariadbmon/cluster_manipulation.cc index 40496d25a..b71a834e6 100644 --- a/server/modules/monitor/mariadbmon/cluster_manipulation.cc +++ b/server/modules/monitor/mariadbmon/cluster_manipulation.cc @@ -1327,6 +1327,12 @@ bool MariaDBMonitor::failover_check(string* error_out) *error_out += separator + "No valid slaves to promote."; error = true; } + else + { + // There's at least one valid promotion candidate + error = false; + } + return !error; }