MXS-2158 Clean up gtid updating during rejoin

Error messages from update_gtids() are now printed. can_replicate_from()
no longer updates gtid:s.
This commit is contained in:
Esa Korhonen
2018-11-15 12:22:01 +02:00
parent 715eaf6760
commit 6a1cfddb43
3 changed files with 37 additions and 40 deletions

View File

@ -118,7 +118,8 @@ bool MariaDBMonitor::manual_rejoin(SERVER* rejoin_server, json_t** output)
if (server_is_rejoin_suspect(slave_cand, output))
{
if (m_master->update_gtids())
string gtid_update_error;
if (m_master->update_gtids(&gtid_update_error))
{
string no_rejoin_reason;
if (slave_cand->can_replicate_from(m_master, &no_rejoin_reason))
@ -138,18 +139,15 @@ bool MariaDBMonitor::manual_rejoin(SERVER* rejoin_server, json_t** output)
else
{
PRINT_MXS_JSON_ERROR(output,
"Server '%s' cannot replicate from cluster master '%s': "
"%s.",
rejoin_serv_name,
m_master->name(),
no_rejoin_reason.c_str());
"%s cannot replicate from cluster master %s: %s.",
rejoin_serv_name, m_master->name(), no_rejoin_reason.c_str());
}
}
else
{
PRINT_MXS_JSON_ERROR(output,
"Cluster master '%s' gtid info could not be updated.",
m_master->name());
"The GTIDs of master server %s could not be updated: %s",
m_master->name(), gtid_update_error.c_str());
}
} // server_is_rejoin_suspect has added any error messages to the output, no need to print here
}
@ -687,7 +685,8 @@ bool MariaDBMonitor::get_joinable_servers(ServerArray* output)
bool comm_ok = true;
if (!suspects.empty())
{
if (m_master->update_gtids())
string gtid_update_error;
if (m_master->update_gtids(&gtid_update_error))
{
for (size_t i = 0; i < suspects.size(); i++)
{
@ -710,6 +709,8 @@ bool MariaDBMonitor::get_joinable_servers(ServerArray* output)
}
else
{
MXS_ERROR("The GTIDs of master server %s could not be updated while attempting an automatic "
"rejoin: %s", m_master->name(), gtid_update_error.c_str());
comm_ok = false;
}
}
@ -1760,10 +1761,7 @@ void MariaDBMonitor::handle_auto_rejoin()
MXS_NOTICE("%d server(s) redirected or rejoined the cluster.", joins);
}
}
else
{
MXS_ERROR("Query error to master '%s' prevented a possible rejoin operation.", m_master->name());
}
// get_joinable_servers prints an error if master is unresponsive
}
void MariaDBMonitor::report_and_disable(const string& operation, const string& setting_name,