MXS-2275 Always log monitor instance name
When logging something, always log the monitor instance name as well.
This commit is contained in:
parent
cb07687672
commit
6d60714a17
@ -87,7 +87,7 @@ Clustrix::SubState Clustrix::substate_from_string(const std::string& substate)
|
||||
}
|
||||
}
|
||||
|
||||
bool Clustrix::is_part_of_the_quorum(const SERVER& server, MYSQL* pCon)
|
||||
bool Clustrix::is_part_of_the_quorum(const char* zName, const SERVER& server, MYSQL* pCon)
|
||||
{
|
||||
bool rv = false;
|
||||
|
||||
@ -124,18 +124,20 @@ bool Clustrix::is_part_of_the_quorum(const SERVER& server, MYSQL* pCon)
|
||||
break;
|
||||
|
||||
case Clustrix::Status::STATIC:
|
||||
MXS_NOTICE("Node %s:%d is not part of the quorum, switching to "
|
||||
"other node for monitoring.", zAddress, port);
|
||||
MXS_NOTICE("%s: Node %s:%d is not part of the quorum, switching to "
|
||||
"other node for monitoring.",
|
||||
zName, zAddress, port);
|
||||
break;
|
||||
|
||||
case Clustrix::Status::UNKNOWN:
|
||||
MXS_WARNING("Do not know how to interpret '%s'. Assuming node %s:%d "
|
||||
"is not part of the quorum.", row[0], zAddress, port);
|
||||
MXS_WARNING("%s: Do not know how to interpret '%s'. Assuming node %s:%d "
|
||||
"is not part of the quorum.",
|
||||
zName, row[0], zAddress, port);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_WARNING("No status returned for '%s' on %s:%d.", zQuery, zAddress, port);
|
||||
MXS_WARNING("%s: No status returned for '%s' on %s:%d.", zName, zQuery, zAddress, port);
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,12 +145,12 @@ bool Clustrix::is_part_of_the_quorum(const SERVER& server, MYSQL* pCon)
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_WARNING("No result returned for '%s' on %s:%d.", zQuery, zAddress, port);
|
||||
MXS_WARNING("%s: No result returned for '%s' on %s:%d.", zName, zQuery, zAddress, port);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Could not execute '%s' on %s:%d: %s", zQuery, zAddress, port, mysql_error(pCon));
|
||||
MXS_ERROR("%s: Could not execute '%s' on %s:%d: %s", zName, zQuery, zAddress, port, mysql_error(pCon));
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -162,15 +164,15 @@ bool Clustrix::ping_or_connect_to_hub(const MXS_MONITORED_SERVER::ConnectionSett
|
||||
|
||||
if (mon_connection_is_ok(rv))
|
||||
{
|
||||
if (Clustrix::is_part_of_the_quorum(server, *ppCon))
|
||||
if (Clustrix::is_part_of_the_quorum(mon.m_name, server, *ppCon))
|
||||
{
|
||||
connected = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Could either not ping or create connection to %s:%d: %s",
|
||||
server.address, server.port, mysql_error(*ppCon));
|
||||
MXS_ERROR("%s: Could either not ping or create connection to %s:%d: %s",
|
||||
mon.m_name, server.address, server.port, mysql_error(*ppCon));
|
||||
}
|
||||
|
||||
return connected;
|
||||
|
@ -42,26 +42,28 @@ std::string to_string(SubState sub_state);
|
||||
/**
|
||||
* Is a particular Clustrix node part of the quorum.
|
||||
*
|
||||
* @param zName The name of the Clustrix monitor instance.
|
||||
* @param server The server object of a Clustrix node.
|
||||
* @param pCon Valid MYSQL handle to the server.
|
||||
*
|
||||
* @return True, if the node is part of the quorum, false otherwise.
|
||||
*/
|
||||
bool is_part_of_the_quorum(const SERVER& server, MYSQL* pCon);
|
||||
bool is_part_of_the_quorum(const char* zName, const SERVER& server, MYSQL* pCon);
|
||||
|
||||
/**
|
||||
* Is a particular Clustrix node part of the quorum.
|
||||
*
|
||||
* @param ms The monitored server object of a Clustrix node.
|
||||
* @param zName The name of the Clustrix monitor instance.
|
||||
* @param ms The monitored server object of a Clustrix node.
|
||||
*
|
||||
* @return True, if the node is part of the quorum, false otherwise.
|
||||
*/
|
||||
inline bool is_part_of_the_quorum(MXS_MONITORED_SERVER& ms)
|
||||
inline bool is_part_of_the_quorum(const char* zName, MXS_MONITORED_SERVER& ms)
|
||||
{
|
||||
mxb_assert(ms.server);
|
||||
mxb_assert(ms.con);
|
||||
|
||||
return is_part_of_the_quorum(*ms.server, ms.con);
|
||||
return is_part_of_the_quorum(zName, *ms.server, ms.con);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,7 +61,7 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
{
|
||||
MODULECMD_ARG_MONITOR | MODULECMD_ARG_NAME_MATCHES_DOMAIN,
|
||||
"Monitor name (from configuration file"
|
||||
"Monitor name (from configuration file)"
|
||||
},
|
||||
{
|
||||
MODULECMD_ARG_SERVER, "Node to be softfailed."
|
||||
@ -76,7 +76,7 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
{
|
||||
MODULECMD_ARG_MONITOR | MODULECMD_ARG_NAME_MATCHES_DOMAIN,
|
||||
"Monitor name (from configuration file"
|
||||
"Monitor name (from configuration file)"
|
||||
},
|
||||
{
|
||||
MODULECMD_ARG_SERVER, "Node to be unsoftfailed."
|
||||
|
@ -135,11 +135,11 @@ void ClustrixMonitor::tick()
|
||||
switch (m_http.status())
|
||||
{
|
||||
case http::Async::PENDING:
|
||||
MXS_WARNING("Health check round had not completed when next tick arrived.");
|
||||
MXS_WARNING("%s: Health check round had not completed when next tick arrived.", m_name);
|
||||
break;
|
||||
|
||||
case http::Async::ERROR:
|
||||
MXS_WARNING("Health check round ended with general error.");
|
||||
MXS_WARNING("%s: Health check round ended with general error.", m_name);
|
||||
make_health_check();
|
||||
break;
|
||||
|
||||
@ -206,8 +206,8 @@ void ClustrixMonitor::choose_hub()
|
||||
|
||||
if (pHub_con)
|
||||
{
|
||||
MXS_NOTICE("Monitoring Clustrix cluster state using node %s:%d.",
|
||||
pHub_server->address, pHub_server->port);
|
||||
MXS_NOTICE("%s: Monitoring Clustrix cluster state using node %s:%d.",
|
||||
m_name, pHub_server->address, pHub_server->port);
|
||||
|
||||
m_pHub_con = pHub_con;
|
||||
m_pHub_server = pHub_server;
|
||||
@ -217,8 +217,8 @@ void ClustrixMonitor::choose_hub()
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Could not connect to any server or no server that could "
|
||||
"be connected to was part of the quorum.");
|
||||
MXS_ERROR("%s: Could not connect to any server or no server that could "
|
||||
"be connected to was part of the quorum.", m_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -313,8 +313,8 @@ void ClustrixMonitor::refresh_nodes()
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Could not create server %s at %s:%d.",
|
||||
name.c_str(), ip.c_str(), mysql_port);
|
||||
MXS_ERROR("%s: Could not create server %s at %s:%d.",
|
||||
m_name, name.c_str(), ip.c_str(), mysql_port);
|
||||
}
|
||||
|
||||
memberships.erase(mit);
|
||||
@ -322,14 +322,15 @@ void ClustrixMonitor::refresh_nodes()
|
||||
else
|
||||
{
|
||||
// Node found in system.node_info but not in system.membership
|
||||
MXS_ERROR("Node %d at %s:%d,%d found in system.node_info "
|
||||
MXS_ERROR("%s: Node %d at %s:%d,%d found in system.node_info "
|
||||
"but not in system.membership.",
|
||||
id, ip.c_str(), mysql_port, health_port);
|
||||
m_name, id, ip.c_str(), mysql_port, health_port);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_WARNING("Either nodeid and/or iface_ip is missing, ignoring node.");
|
||||
MXS_WARNING("%s: Either nodeid and/or iface_ip is missing, ignoring node.",
|
||||
m_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -359,13 +360,14 @@ void ClustrixMonitor::refresh_nodes()
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_WARNING("No result returned for '%s' on %s.", ZQUERY, m_pHub_server->address);
|
||||
MXS_WARNING("%s: No result returned for '%s' on %s.",
|
||||
m_name, ZQUERY, m_pHub_server->address);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Could not execute '%s' on %s: %s",
|
||||
ZQUERY, m_pHub_server->address, mysql_error(m_pHub_con));
|
||||
MXS_ERROR("%s: Could not execute '%s' on %s: %s",
|
||||
m_name, ZQUERY, m_pHub_server->address, mysql_error(m_pHub_con));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -460,7 +462,8 @@ bool ClustrixMonitor::check_cluster_membership(std::map<int, ClustrixMembership>
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_WARNING("No node id returned in row for '%s'.", ZQUERY);
|
||||
MXS_WARNING("%s: No node id returned in row for '%s'.",
|
||||
m_name, ZQUERY);
|
||||
}
|
||||
}
|
||||
|
||||
@ -481,13 +484,13 @@ bool ClustrixMonitor::check_cluster_membership(std::map<int, ClustrixMembership>
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_WARNING("No result returned for '%s'.", ZQUERY);
|
||||
MXS_WARNING("%s: No result returned for '%s'.", m_name, ZQUERY);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Could not execute '%s' on %s: %s",
|
||||
ZQUERY, m_pHub_server->address, mysql_error(m_pHub_con));
|
||||
MXS_ERROR("%s: Could not execute '%s' on %s: %s",
|
||||
m_name, ZQUERY, m_pHub_server->address, mysql_error(m_pHub_con));
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -540,11 +543,11 @@ void ClustrixMonitor::make_health_check()
|
||||
break;
|
||||
|
||||
case http::Async::ERROR:
|
||||
MXS_ERROR("Could not initiate health check.");
|
||||
MXS_ERROR("%s: Could not initiate health check.", m_name);
|
||||
break;
|
||||
|
||||
case http::Async::READY:
|
||||
MXS_NOTICE("Health check available immediately.");
|
||||
MXS_INFO("%s: Health check available immediately.", m_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -602,7 +605,7 @@ bool ClustrixMonitor::check_http(Call::action_t action)
|
||||
break;
|
||||
|
||||
case http::Async::ERROR:
|
||||
MXS_ERROR("Health check waiting ended with general error.");
|
||||
MXS_ERROR("%s: Health check waiting ended with general error.", m_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -655,7 +658,7 @@ bool ClustrixMonitor::perform_operation(Operation operation,
|
||||
|
||||
if (mysql_query(m_pHub_con, zQuery) == 0)
|
||||
{
|
||||
MXS_NOTICE("Clustrix monitor %s performed %s on node %d (%s).",
|
||||
MXS_NOTICE("%s: %s performed on node %d (%s).",
|
||||
m_name, zOperation, id, pServer->address);
|
||||
|
||||
if (operation == Operation::SOFTFAIL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user