A master which is down for longer than failcount is considered an invalid master

If auto_failover is disabled and an alternative master exists, the
monitor will swap the master. This may break replication, but the
situation requires that the dba has set up a cluster with multiple
masters.
This commit is contained in:
Esa Korhonen
2018-07-19 19:23:16 +03:00
parent c9570ff616
commit 382a017518
3 changed files with 88 additions and 38 deletions

View File

@ -67,6 +67,8 @@ MariaDBMonitor::MariaDBMonitor(MXS_MONITOR* monitor)
, m_log_no_master(true)
, m_warn_failover_precond(true)
, m_warn_cannot_rejoin(true)
, m_warn_current_master_invalid(true)
, m_warn_have_better_master(true)
{}
MariaDBMonitor::~MariaDBMonitor()
@ -485,11 +487,11 @@ void MariaDBMonitor::tick()
}
}
if (m_cluster_topology_changed)
// Topology needs to be rechecked if it has changed or if master is down.
if (m_cluster_topology_changed || (m_master && m_master->is_down()))
{
// This means that a server id or a slave connection has changed, or read_only was set.
// Various things need to be checked and updated.
update_topology();
m_cluster_topology_changed = false;
}
// Always re-assign master, slave etc bits as these depend on other factors outside topology
@ -740,6 +742,8 @@ void MariaDBMonitor::assign_new_master(MariaDBServer* new_master)
{
m_master = new_master;
update_master_cycle_info();
m_warn_current_master_invalid = true;
m_warn_have_better_master = true;
}
/**