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:
parent
61bb172033
commit
91ab59530f
@ -343,10 +343,15 @@ inline bool server_is_in_cluster(const SERVER* server)
|
||||
(SERVER_MASTER | SERVER_SLAVE | SERVER_RELAY | SERVER_JOINED | SERVER_NDB)) != 0);
|
||||
}
|
||||
|
||||
inline bool status_is_slave_of_ext_master(uint64_t status)
|
||||
{
|
||||
return ((status & (SERVER_RUNNING | SERVER_SLAVE_OF_EXT_MASTER)) ==
|
||||
(SERVER_RUNNING | SERVER_SLAVE_OF_EXT_MASTER));
|
||||
}
|
||||
|
||||
inline bool server_is_slave_of_ext_master(const SERVER* server)
|
||||
{
|
||||
return ((server->status & (SERVER_RUNNING | SERVER_SLAVE_OF_EXT_MASTER)) ==
|
||||
(SERVER_RUNNING | SERVER_SLAVE_OF_EXT_MASTER));
|
||||
return status_is_slave_of_ext_master(server->status);
|
||||
}
|
||||
|
||||
inline bool status_is_disk_space_exhausted(uint64_t status)
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user