MXS-2367 Print slave connection errors when replication fails

The slave connection I/O-tread stays running if replication credentials are
wrong when connecting to master. This causes a switchover/failover timeout.
When this happens, print the error in the slave connection status as this
clarifies the problem to the user.
This commit is contained in:
Esa Korhonen 2019-06-17 15:25:06 +03:00
parent 6cbe9d1258
commit a60bd37610

View File

@ -1085,6 +1085,18 @@ void MariaDBMonitor::wait_cluster_stabilization(GeneralOpData& op, const ServerA
"connect to '%s' within the time limit.";
MXS_WARNING(MSG, fails, new_master->name(), repl_fails.size(), query_fails.size(),
unconfirmed.size(), new_master->name());
// If any of the unconfirmed slaves have error messages in their slave status, print them. They
// may explain what went wrong.
for (auto failed_slave : unconfirmed)
{
auto slave_conn = failed_slave->slave_connection_status_host_port(new_master);
if (slave_conn && !slave_conn->last_error.empty())
{
MXB_WARNING("%s did not connect because of error: '%s'",
slave_conn->to_short_string().c_str(), slave_conn->last_error.c_str());
}
}
}
time_remaining -= timer.lap();
}