Fix monitor connection error messages

The connection is closed by the ping_or_connect_to_db function which
causes the information about why the connection failed to be lost.
This commit is contained in:
Markus Mäkelä
2020-12-16 14:27:10 +02:00
parent 780c08c90f
commit 26d2c2387f
3 changed files with 16 additions and 6 deletions

View File

@ -208,7 +208,8 @@ bool xpand::ping_or_connect_to_hub(const char* zName,
MYSQL** ppCon)
{
bool connected = false;
MonitorServer::ConnectResult rv = Monitor::ping_or_connect_to_db(settings, server, ppCon);
std::string err;
MonitorServer::ConnectResult rv = Monitor::ping_or_connect_to_db(settings, server, ppCon, &err);
if (Monitor::connection_is_ok(rv))
{
@ -229,7 +230,7 @@ bool xpand::ping_or_connect_to_hub(const char* zName,
else
{
MXS_ERROR("%s: Could either not ping or create connection to %s:%d: %s",
zName, server.address, server.port, mysql_error(*ppCon));
zName, server.address, server.port, err.c_str());
}
return connected;