MXS-2276 Fix things due to MXS_MONITOR -> Monitor change
This commit is contained in:
@ -154,7 +154,7 @@ bool Clustrix::is_part_of_the_quorum(const SERVER& server, MYSQL* pCon)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Clustrix::ping_or_connect_to_hub(const MXS_MONITOR& mon, SERVER& server, MYSQL** ppCon)
|
bool Clustrix::ping_or_connect_to_hub(const Monitor& mon, SERVER& server, MYSQL** ppCon)
|
||||||
{
|
{
|
||||||
bool connected = false;
|
bool connected = false;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ inline bool is_part_of_the_quorum(MXS_MONITORED_SERVER& ms)
|
|||||||
*
|
*
|
||||||
* @note Upon return @c *ppCon will be non-NULL.
|
* @note Upon return @c *ppCon will be non-NULL.
|
||||||
*/
|
*/
|
||||||
bool ping_or_connect_to_hub(const MXS_MONITOR& mon, SERVER& server, MYSQL** ppCon);
|
bool ping_or_connect_to_hub(const Monitor& mon, SERVER& server, MYSQL** ppCon);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ping or create connection to server and check whether it can be used
|
* Ping or create connection to server and check whether it can be used
|
||||||
@ -88,7 +88,7 @@ bool ping_or_connect_to_hub(const MXS_MONITOR& mon, SERVER& server, MYSQL** ppCo
|
|||||||
*
|
*
|
||||||
* @return True, if the server can be used as hub, false otherwise.
|
* @return True, if the server can be used as hub, false otherwise.
|
||||||
*/
|
*/
|
||||||
inline bool ping_or_connect_to_hub(const MXS_MONITOR& mon, MXS_MONITORED_SERVER& ms)
|
inline bool ping_or_connect_to_hub(const Monitor& mon, MXS_MONITORED_SERVER& ms)
|
||||||
{
|
{
|
||||||
return ping_or_connect_to_hub(mon, *ms.server, &ms.con);
|
return ping_or_connect_to_hub(mon, *ms.server, &ms.con);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ void ClustrixMonitor::choose_hub()
|
|||||||
auto& element = *it;
|
auto& element = *it;
|
||||||
ClustrixNode& node = element.second;
|
ClustrixNode& node = element.second;
|
||||||
|
|
||||||
if (node.can_be_used_as_hub(*m_monitor))
|
if (node.can_be_used_as_hub(*this))
|
||||||
{
|
{
|
||||||
pHub_con = node.release_connection();
|
pHub_con = node.release_connection();
|
||||||
pHub_server = node.server();
|
pHub_server = node.server();
|
||||||
@ -129,8 +129,8 @@ void ClustrixMonitor::choose_hub()
|
|||||||
// If that fails, then we check the bootstrap servers, but only if
|
// If that fails, then we check the bootstrap servers, but only if
|
||||||
// it was not checked above.
|
// it was not checked above.
|
||||||
|
|
||||||
auto b = begin(*(m_monitor->monitored_servers));
|
auto b = begin(*(this->monitored_servers));
|
||||||
auto e = end(*(m_monitor->monitored_servers));
|
auto e = end(*(this->monitored_servers));
|
||||||
|
|
||||||
for (auto it = b; !pHub_con && (it != e); ++it)
|
for (auto it = b; !pHub_con && (it != e); ++it)
|
||||||
{
|
{
|
||||||
@ -138,7 +138,7 @@ void ClustrixMonitor::choose_hub()
|
|||||||
|
|
||||||
if (ips.find(ms.server->address) == ips.end())
|
if (ips.find(ms.server->address) == ips.end())
|
||||||
{
|
{
|
||||||
if (Clustrix::ping_or_connect_to_hub(*m_monitor, ms))
|
if (Clustrix::ping_or_connect_to_hub(*this, ms))
|
||||||
{
|
{
|
||||||
pHub_con = ms.con;
|
pHub_con = ms.con;
|
||||||
pHub_server = ms.server;
|
pHub_server = ms.server;
|
||||||
@ -342,7 +342,7 @@ void ClustrixMonitor::check_hub()
|
|||||||
mxb_assert(m_pHub_con);
|
mxb_assert(m_pHub_con);
|
||||||
mxb_assert(m_pHub_server);
|
mxb_assert(m_pHub_server);
|
||||||
|
|
||||||
if (!Clustrix::ping_or_connect_to_hub(*m_monitor, *m_pHub_server, &m_pHub_con))
|
if (!Clustrix::ping_or_connect_to_hub(*this, *m_pHub_server, &m_pHub_con))
|
||||||
{
|
{
|
||||||
mysql_close(m_pHub_con);
|
mysql_close(m_pHub_con);
|
||||||
m_pHub_con = nullptr;
|
m_pHub_con = nullptr;
|
||||||
@ -444,10 +444,10 @@ bool ClustrixMonitor::check_cluster_membership(std::map<int, ClustrixMembership>
|
|||||||
|
|
||||||
void ClustrixMonitor::update_server_statuses()
|
void ClustrixMonitor::update_server_statuses()
|
||||||
{
|
{
|
||||||
mxb_assert(m_monitor->monitored_servers);
|
mxb_assert(this->monitored_servers);
|
||||||
|
|
||||||
auto b = std::begin(*m_monitor->monitored_servers);
|
auto b = std::begin(*this->monitored_servers);
|
||||||
auto e = std::end(*m_monitor->monitored_servers);
|
auto e = std::end(*this->monitored_servers);
|
||||||
|
|
||||||
for_each(b, e,
|
for_each(b, e,
|
||||||
[this](MXS_MONITORED_SERVER& ms) {
|
[this](MXS_MONITORED_SERVER& ms) {
|
||||||
@ -506,7 +506,7 @@ void ClustrixMonitor::initiate_delayed_http_check()
|
|||||||
{
|
{
|
||||||
mxb_assert(m_delayed_http_check_id == 0);
|
mxb_assert(m_delayed_http_check_id == 0);
|
||||||
|
|
||||||
long max_delay_ms = m_monitor->interval / 10;
|
long max_delay_ms = this->interval / 10;
|
||||||
|
|
||||||
long ms = m_http.wait_no_more_than();
|
long ms = m_http.wait_no_more_than();
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "clustrixnode.hh"
|
#include "clustrixnode.hh"
|
||||||
#include "clustrix.hh"
|
#include "clustrix.hh"
|
||||||
|
|
||||||
bool ClustrixNode::can_be_used_as_hub(const MXS_MONITOR& mon)
|
bool ClustrixNode::can_be_used_as_hub(const Monitor& mon)
|
||||||
{
|
{
|
||||||
mxb_assert(m_pServer);
|
mxb_assert(m_pServer);
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ public:
|
|||||||
m_pServer->is_active = false;
|
m_pServer->is_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool can_be_used_as_hub(const MXS_MONITOR& mon);
|
bool can_be_used_as_hub(const Monitor& mon);
|
||||||
|
|
||||||
SERVER* server() const
|
SERVER* server() const
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user