MXS-2644 Log reason if mysql_real_connect fails

If mysql_real_connect fails inside any of the open_conn_db...
utility functions that will now be logged.
This commit is contained in:
Johan Wikman
2019-08-20 15:25:10 +03:00
parent 891d0503a0
commit e2124ec01f
2 changed files with 30 additions and 19 deletions

View File

@ -84,7 +84,7 @@ int Mariadb_nodes::connect(int i, const std::string& db)
nodes[i] = open_conn_db_timeout(port[i], IP[i], db.c_str(), user_name, password, 50, ssl);
}
if ((nodes[i] != NULL) && (mysql_errno(nodes[i]) != 0))
if ((nodes[i] == NULL) || (mysql_errno(nodes[i]) != 0))
{
return 1;
}
@ -1015,8 +1015,7 @@ bool do_flush_hosts(MYSQL* conn)
int Mariadb_nodes::flush_hosts()
{
if (this->nodes[0] == NULL && this->connect())
if (this->nodes[0] == NULL && (this->connect() != 0))
{
return 1;
}