MXS-2275 Always log monitor instance name

When logging something, always log the monitor instance name
as well.
This commit is contained in:
Johan Wikman
2019-01-31 16:53:29 +02:00
parent cb07687672
commit 6d60714a17
4 changed files with 46 additions and 39 deletions

View File

@ -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;