MXS-2275 Fix breakage due to rebasing
This commit is contained in:
parent
6d60714a17
commit
55b1e031d6
@ -156,15 +156,17 @@ bool Clustrix::is_part_of_the_quorum(const char* zName, const SERVER& server, MY
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool Clustrix::ping_or_connect_to_hub(const MXS_MONITORED_SERVER::ConnectionSettings& sett, SERVER& server,
|
||||
bool Clustrix::ping_or_connect_to_hub(const char* zName,
|
||||
const MXS_MONITORED_SERVER::ConnectionSettings& settings,
|
||||
SERVER& server,
|
||||
MYSQL** ppCon)
|
||||
{
|
||||
bool connected = false;
|
||||
mxs_connect_result_t rv = mon_ping_or_connect_to_db(sett, server, ppCon);
|
||||
mxs_connect_result_t rv = mon_ping_or_connect_to_db(settings, server, ppCon);
|
||||
|
||||
if (mon_connection_is_ok(rv))
|
||||
{
|
||||
if (Clustrix::is_part_of_the_quorum(mon.m_name, server, *ppCon))
|
||||
if (Clustrix::is_part_of_the_quorum(zName, server, *ppCon))
|
||||
{
|
||||
connected = true;
|
||||
}
|
||||
@ -172,7 +174,7 @@ bool Clustrix::ping_or_connect_to_hub(const MXS_MONITORED_SERVER::ConnectionSett
|
||||
else
|
||||
{
|
||||
MXS_ERROR("%s: Could either not ping or create connection to %s:%d: %s",
|
||||
mon.m_name, server.address, server.port, mysql_error(*ppCon));
|
||||
zName, server.address, server.port, mysql_error(*ppCon));
|
||||
}
|
||||
|
||||
return connected;
|
||||
|
@ -70,30 +70,36 @@ inline bool is_part_of_the_quorum(const char* zName, MXS_MONITORED_SERVER& ms)
|
||||
* Ping or create connection to server and check whether it can be used
|
||||
* as hub.
|
||||
*
|
||||
* @param sett Connection settings
|
||||
* @param server Server object referring to a Clustrix node.
|
||||
* @param ppCon Address of pointer to MYSQL object referring to @server
|
||||
* (@c *ppCon may also be NULL).
|
||||
* @param zName The name of the Clustrix monitor instance.
|
||||
* @param settings Connection settings
|
||||
* @param server Server object referring to a Clustrix node.
|
||||
* @param ppCon Address of pointer to MYSQL object referring to @server
|
||||
* (@c *ppCon may also be NULL).
|
||||
*
|
||||
* @return True, if the server can be used as hub, false otherwise.
|
||||
*
|
||||
* @note Upon return @c *ppCon will be non-NULL.
|
||||
*/
|
||||
bool ping_or_connect_to_hub(const MXS_MONITORED_SERVER::ConnectionSettings& sett, SERVER& server,
|
||||
bool ping_or_connect_to_hub(const char* zName,
|
||||
const MXS_MONITORED_SERVER::ConnectionSettings& settings,
|
||||
SERVER& server,
|
||||
MYSQL** ppCon);
|
||||
|
||||
/**
|
||||
* Ping or create connection to server and check whether it can be used
|
||||
* as hub.
|
||||
*
|
||||
* @param ms Monitored server object referring to a Clustrix node.
|
||||
* @param sett Connection settings
|
||||
* @param zName The name of the Clustrix monitor instance.
|
||||
* @param settings Connection settings
|
||||
* @param ms The monitored server.
|
||||
*
|
||||
* @return True, if the server can be used as hub, false otherwise.
|
||||
*/
|
||||
inline bool ping_or_connect_to_hub(const MXS_MONITORED_SERVER::ConnectionSettings& sett,
|
||||
inline bool ping_or_connect_to_hub(const char* zName,
|
||||
const MXS_MONITORED_SERVER::ConnectionSettings& settings,
|
||||
MXS_MONITORED_SERVER& ms)
|
||||
{
|
||||
return ping_or_connect_to_hub(sett, *ms.server, &ms.con);
|
||||
return ping_or_connect_to_hub(zName, settings, *ms.server, &ms.con);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ void ClustrixMonitor::choose_hub()
|
||||
auto& element = *it;
|
||||
ClustrixNode& node = element.second;
|
||||
|
||||
if (node.can_be_used_as_hub(m_settings.conn_settings))
|
||||
if (node.can_be_used_as_hub(m_name, m_settings.conn_settings))
|
||||
{
|
||||
pHub_con = node.release_connection();
|
||||
pHub_server = node.server();
|
||||
@ -189,7 +189,7 @@ void ClustrixMonitor::choose_hub()
|
||||
|
||||
if (ips.find(ms.server->address) == ips.end())
|
||||
{
|
||||
if (Clustrix::ping_or_connect_to_hub(m_settings.conn_settings, ms))
|
||||
if (Clustrix::ping_or_connect_to_hub(m_name, m_settings.conn_settings, ms))
|
||||
{
|
||||
pHub_con = ms.con;
|
||||
pHub_server = ms.server;
|
||||
@ -395,7 +395,7 @@ void ClustrixMonitor::check_hub()
|
||||
mxb_assert(m_pHub_con);
|
||||
mxb_assert(m_pHub_server);
|
||||
|
||||
if (!Clustrix::ping_or_connect_to_hub(m_settings.conn_settings, *m_pHub_server, &m_pHub_con))
|
||||
if (!Clustrix::ping_or_connect_to_hub(m_name, m_settings.conn_settings, *m_pHub_server, &m_pHub_con))
|
||||
{
|
||||
mysql_close(m_pHub_con);
|
||||
m_pHub_con = nullptr;
|
||||
|
@ -14,10 +14,11 @@
|
||||
#include "clustrixnode.hh"
|
||||
#include "clustrix.hh"
|
||||
|
||||
bool ClustrixNode::can_be_used_as_hub(const MXS_MONITORED_SERVER::ConnectionSettings& sett)
|
||||
bool ClustrixNode::can_be_used_as_hub(const char* zName,
|
||||
const MXS_MONITORED_SERVER::ConnectionSettings& settings)
|
||||
{
|
||||
mxb_assert(m_pServer);
|
||||
bool rv = Clustrix::ping_or_connect_to_hub(sett, *m_pServer, &m_pCon);
|
||||
bool rv = Clustrix::ping_or_connect_to_hub(zName, settings, *m_pServer, &m_pCon);
|
||||
|
||||
if (!rv)
|
||||
{
|
||||
|
@ -160,7 +160,8 @@ public:
|
||||
m_pServer->is_active = false;
|
||||
}
|
||||
|
||||
bool can_be_used_as_hub(const MXS_MONITORED_SERVER::ConnectionSettings& sett);
|
||||
bool can_be_used_as_hub(const char* zName,
|
||||
const MXS_MONITORED_SERVER::ConnectionSettings& settings);
|
||||
|
||||
SERVER* server() const
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user