Assign slave status even if no master is available
The master validity check now checks if the master is down. This requires that the slave status is assigned even if no master is available. The failover precondition is also fulfilled as long as one valid promotion candidate is found. Previously a slave that didn't use GTID replication appeared to prevent failover.
This commit is contained in:
parent
e80a145b2c
commit
bded99aea3
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user