Allow switchover for arbitrary topologies
The demoted server no longer needs to be the master.
This commit is contained in:
@ -1058,10 +1058,9 @@ bool MariaDBServer::can_be_demoted_switchover(string* reason_out)
|
||||
string reason;
|
||||
string query_error;
|
||||
|
||||
// TODO: Add relay server support
|
||||
if (!is_master())
|
||||
if (!is_usable())
|
||||
{
|
||||
reason = "it is not the current master or it is in maintenance.";
|
||||
reason = "it is not running or it is in maintenance.";
|
||||
}
|
||||
else if (!update_replication_settings(&query_error))
|
||||
{
|
||||
@ -1071,6 +1070,12 @@ bool MariaDBServer::can_be_demoted_switchover(string* reason_out)
|
||||
{
|
||||
reason = "its binary log is disabled.";
|
||||
}
|
||||
else if (!is_master() && !m_rpl_settings.log_slave_updates)
|
||||
{
|
||||
// This means that gtid_binlog_pos cannot be trusted.
|
||||
// TODO: reduce dependency on gtid_binlog_pos to get rid of this requirement
|
||||
reason = "it is not the master and log_slave_updates is disabled.";
|
||||
}
|
||||
else if (m_gtid_binlog_pos.empty())
|
||||
{
|
||||
reason = "it does not have a 'gtid_binlog_pos'.";
|
||||
|
Reference in New Issue
Block a user