Use pending status in external master checks

When the replication status from the external master is checked, the
pending status must be used. This makes sure that the SlaveStatusArray and
the server state are sync.

Also extended the message that was logged when the external master was
lost. By adding the network address there, it makes it easier to see where
the server was replicating from if only the log file is available.
This commit is contained in:
Markus Mäkelä
2018-08-22 16:31:05 +03:00
parent 61bb172033
commit 91ab59530f
4 changed files with 22 additions and 4 deletions

View File

@ -587,7 +587,7 @@ void MariaDBMonitor::update_gtid_domain()
void MariaDBMonitor::update_external_master()
{
if (server_is_slave_of_ext_master(m_master->m_server_base->server))
if (m_master->is_slave_of_ext_master())
{
mxb_assert(!m_master->m_slave_status.empty());
if (m_master->m_slave_status[0].master_host != m_external_master_host ||
@ -614,7 +614,8 @@ void MariaDBMonitor::update_external_master()
{
if (m_external_master_port != PORT_UNKNOWN)
{
MXS_NOTICE("Cluster lost the external master.");
MXS_NOTICE("Cluster lost the external master. Previous one was at: [%s]:%d",
m_external_master_host.c_str(), m_external_master_port);
}
m_external_master_host.clear();
m_external_master_port = PORT_UNKNOWN;

View File

@ -437,6 +437,11 @@ bool MariaDBServer::is_slave() const
return status_is_slave(m_server_base->pending_status);
}
bool MariaDBServer::is_slave_of_ext_master() const
{
return status_is_slave_of_ext_master(m_server_base->pending_status);
}
bool MariaDBServer::is_usable() const
{
return status_is_usable(m_server_base->pending_status);

View File

@ -272,6 +272,13 @@ public:
*/
bool is_slave() const;
/**
* Check if server is a slave of an external server.
*
* @return True if server is a slave of an external server
*/
bool is_slave_of_ext_master() const;
/**
* Check if server is running and not in maintenance.
*