Add missing quotes when printing server names

Some of the log messages didn't have the quotes.
This commit is contained in:
Esa Korhonen 2018-11-22 10:43:38 +02:00
parent 75fb728ee7
commit 0a5a3309e0
4 changed files with 58 additions and 75 deletions

View File

@ -915,7 +915,7 @@ void MariaDBMonitor::set_low_disk_slaves_maintenance()
&& !server->is_master() && !server->is_relay_master())
{
// TODO: Handle relays somehow, e.g. switch with a slave
MXS_WARNING("Setting %s to maintenance because it is low on disk space.", server->name());
MXS_WARNING("Setting '%s' to maintenance because it is low on disk space.", server->name());
server->set_status(SERVER_MAINT);
}
}

View File

@ -135,12 +135,12 @@ bool MariaDBMonitor::manual_rejoin(SERVER* rejoin_cand_srv, json_t** output)
if (empty_gtid)
{
rejoin_allowed = true;
MXB_WARNING("gtid_curren_pos of %s is empty. Manual rejoin is unsafe "
MXB_WARNING("gtid_curren_pos of '%s' is empty. Manual rejoin is unsafe "
"but allowed.", rejoin_cand->name());
}
else
{
PRINT_MXS_JSON_ERROR(output, "%s cannot replicate from master server %s: %s",
PRINT_MXS_JSON_ERROR(output, "'%s' cannot replicate from master server '%s': %s",
rejoin_cand->name(), m_master->name(),
no_rejoin_reason.c_str());
}
@ -163,7 +163,7 @@ bool MariaDBMonitor::manual_rejoin(SERVER* rejoin_cand_srv, json_t** output)
else
{
PRINT_MXS_JSON_ERROR(output,
"The GTIDs of master server %s could not be updated: %s",
"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
@ -345,7 +345,7 @@ bool MariaDBMonitor::manual_reset_replication(SERVER* master_server, json_t** er
if (!new_master->execute_cmd("FLUSH TABLES;", &error_msg))
{
error = true;
PRINT_MXS_JSON_ERROR(error_out, "Could not add event to %s: %s",
PRINT_MXS_JSON_ERROR(error_out, "Could not add event to '%s': %s",
new_master->name(), error_msg.c_str());
}
@ -484,7 +484,7 @@ int MariaDBMonitor::redirect_slaves_ex(GeneralOpData& general, OperationType typ
* or does the same as in 1.
*/
const char redir_fmt[] = "Redirecting %s to replicate from %s instead of %s.";
const char redir_fmt[] = "Redirecting %s to replicate from '%s' instead of '%s'.";
string slave_names_to_promo = monitored_servers_to_string(redirect_to_promo_target);
string slave_names_to_demo = monitored_servers_to_string(redirect_to_demo_target);
mxb_assert(slave_names_to_demo.empty() || type == OperationType::SWITCHOVER);
@ -492,8 +492,8 @@ int MariaDBMonitor::redirect_slaves_ex(GeneralOpData& general, OperationType typ
// Print both name lists if both have items, otherwise just the one with items.
if (!slave_names_to_promo.empty() && !slave_names_to_demo.empty())
{
MXS_NOTICE("Redirecting %s to replicate from %s instead of %s, and %s to replicate from "
"%s instead of %s.",
MXS_NOTICE("Redirecting %s to replicate from '%s' instead of '%s', and %s to replicate from "
"'%s' instead of '%s'.",
slave_names_to_promo.c_str(), promotion_target->name(), demotion_target->name(),
slave_names_to_demo.c_str(), demotion_target->name(), promotion_target->name());
}
@ -527,7 +527,7 @@ int MariaDBMonitor::redirect_slaves_ex(GeneralOpData& general, OperationType typ
{
// Already has a connection to redirect target.
conflicts++;
MXS_WARNING("%s already has a slave connection to %s, connection to %s was "
MXS_WARNING("'%s' already has a slave connection to '%s', connection to '%s' was "
"not redirected.",
redirectable->name(), to->name(), from->name());
}
@ -640,7 +640,7 @@ uint32_t MariaDBMonitor::do_rejoin(const ServerArray& joinable_servers, json_t**
else
{
PRINT_MXS_JSON_ERROR(output,
"Failed to prepare (demote) standalone server %s for rejoin.", name);
"Failed to prepare (demote) standalone server '%s' for rejoin.", name);
}
}
else
@ -725,7 +725,7 @@ bool MariaDBMonitor::get_joinable_servers(ServerArray* output)
}
else
{
MXS_ERROR("The GTIDs of master server %s could not be updated while attempting an automatic "
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;
}
@ -851,7 +851,7 @@ bool MariaDBMonitor::switchover_perform(SwitchoverParams& op)
}
else
{
MXS_WARNING("Could not copy slave connections from %s to %s.",
MXS_WARNING("Could not copy slave connections from '%s' to '%s'.",
promotion_target->name(), demotion_target->name());
}
ServerArray redirected_to_demo_target;
@ -878,12 +878,13 @@ bool MariaDBMonitor::switchover_perform(SwitchoverParams& op)
const char QUERY_UNDO[] = "SET GLOBAL read_only=0;";
if (mxs_mysql_query(demotion_target->m_server_base->con, QUERY_UNDO) == 0)
{
PRINT_MXS_JSON_ERROR(error_out, "read_only disabled on server %s.", demotion_target->name());
PRINT_MXS_JSON_ERROR(error_out, "read_only disabled on server '%s'.",
demotion_target->name());
}
else
{
PRINT_MXS_JSON_ERROR(error_out,
"Could not disable read_only on server %s: '%s'.",
"Could not disable read_only on server '%s': '%s'.",
demotion_target->name(),
mysql_error(demotion_target->m_server_base->con));
}
@ -981,7 +982,7 @@ void MariaDBMonitor::wait_cluster_stabilization(GeneralOpData& op, const ServerA
if (slave_conn == NULL)
{
// Highly unlikely. Maybe someone just removed the slave connection after it was created.
MXS_WARNING("%s does not have a slave connection to %s although one should have "
MXS_WARNING("'%s' does not have a slave connection to '%s' although one should have "
"been created.",
slave->name(), new_master->name());
repl_fails.push_back(*iter);
@ -1049,20 +1050,20 @@ void MariaDBMonitor::wait_cluster_stabilization(GeneralOpData& op, const ServerA
if (successes.size() == redirected_slaves.size())
{
// Complete success.
MXS_NOTICE("All redirected slaves successfully started replication from %s.", new_master->name());
MXS_NOTICE("All redirected slaves successfully started replication from '%s'.", new_master->name());
}
else
{
if (!successes.empty())
{
MXS_NOTICE("%s successfully started replication from %s.",
MXS_NOTICE("%s successfully started replication from '%s'.",
monitored_servers_to_string(successes).c_str(), new_master->name());
}
// Something went wrong.
auto fails = query_fails.size() + repl_fails.size() + unconfirmed.size();
const char MSG[] = "%lu slaves did not start replicating from %s. "
const char MSG[] = "%lu slaves did not start replicating from '%s'. "
"%lu encountered an I/O or SQL error, %lu failed to reply and %lu did not "
"connect to %s within the time limit.";
"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());
}
@ -1436,7 +1437,7 @@ void MariaDBMonitor::handle_auto_failover()
else if (m_verify_master_failure
&& (connected_slave = slave_receiving_events(m_master, &event_age, &delay_time)) != NULL)
{
MXS_NOTICE("Slave %s is still connected to %s and received a new gtid or heartbeat event %.1f "
MXS_NOTICE("Slave '%s' is still connected to '%s' and received a new gtid or heartbeat event %.1f "
"seconds ago. Delaying failover for at least %.1f seconds.",
connected_slave->name(), m_master->name(), event_age.secs(), delay_time.secs());
}
@ -1491,7 +1492,7 @@ void MariaDBMonitor::check_cluster_operations_support()
if (server->m_srv_type != MariaDBServer::server_type::UNKNOWN && !server->m_capabilities.gtid)
{
supported = false;
auto reason = string_printf("The version of %s (%s) is not supported. Failover/switchover "
auto reason = string_printf("The version of '%s' (%s) is not supported. Failover/switchover "
"requires MariaDB 10.0.2 or later.",
server->name(), server->m_server_base->server->version_string);
printer.cat(all_reasons, reason);
@ -1604,11 +1605,9 @@ MariaDBMonitor::switchover_prepare(SERVER* promotion_server, SERVER* demotion_se
}
else if (!demotion_candidate->can_be_demoted_switchover(&demotion_msg))
{
PRINT_ERROR_IF(log_mode,
error_out,
PRINT_ERROR_IF(log_mode, error_out,
"'%s' is not a valid demotion target for switchover: %s",
demotion_candidate->name(),
demotion_msg.c_str());
demotion_candidate->name(), demotion_msg.c_str());
}
else
{
@ -1708,11 +1707,11 @@ void MariaDBMonitor::enforce_read_only_on_slaves()
MYSQL* conn = server->m_server_base->con;
if (mxs_mysql_query(conn, QUERY) == 0)
{
MXS_NOTICE("read_only set to ON on server '%s'.", server->name());
MXS_NOTICE("read_only set to ON on '%s'.", server->name());
}
else
{
MXS_ERROR("Setting read_only on server '%s' failed: '%s.", server->name(), mysql_error(conn));
MXS_ERROR("Setting read_only on '%s' failed: '%s'.", server->name(), mysql_error(conn));
}
}
}
@ -1824,11 +1823,9 @@ bool MariaDBMonitor::check_gtid_replication(Log log_mode, const MariaDBServer* d
auto sstatus = server->slave_connection_status(demotion_target);
if (sstatus && sstatus->gtid_io_pos.empty())
{
PRINT_ERROR_IF(log_mode,
error_out,
PRINT_ERROR_IF(log_mode, error_out,
"The slave connection '%s' -> '%s' is not using gtid replication.",
server->name(),
demotion_target->name());
server->name(), demotion_target->name());
gtid_ok = false;
}
}

View File

@ -939,7 +939,7 @@ string monitored_servers_to_string(const ServerArray& servers)
for (size_t i = 0; i < array_size; i++)
{
rval += separator;
rval += servers[i]->name();
rval += string("'") + servers[i]->name() + "'";
separator = ", ";
}
}

View File

@ -194,7 +194,7 @@ bool MariaDBServer::execute_cmd_time_limit(const std::string& cmd, maxbase::Dura
{
if (keep_trying)
{
MXS_WARNING("Query '%s' failed on %s: %s Retrying with %.1f seconds left.",
MXS_WARNING("Query '%s' failed on '%s': %s Retrying with %.1f seconds left.",
cmd.c_str(), name(), error_msg.c_str(), time_remaining.secs());
if (query_time < min_query_time)
{
@ -544,8 +544,7 @@ bool MariaDBServer::catchup_to_master(GeneralOpData& op, const GtidList& target)
else
{
error = true;
PRINT_MXS_JSON_ERROR(error_out,
"Failed to update gtid on %s while waiting for catchup: %s",
PRINT_MXS_JSON_ERROR(error_out, "Failed to update gtid on '%s' while waiting for catchup: %s",
name(), error_msg.c_str());
}
}
@ -697,19 +696,19 @@ bool MariaDBServer::can_replicate_from(MariaDBServer* master, string* reason_out
bool can_replicate = false;
if (m_gtid_current_pos.empty())
{
*reason_out = string_printf("%s does not have a valid gtid_current_pos.", name());
*reason_out = string_printf("'%s' does not have a valid gtid_current_pos.", name());
}
else if (master->m_gtid_binlog_pos.empty())
{
*reason_out = string_printf("%s does not have a valid gtid_binlog_pos.", master->name());
*reason_out = string_printf("'%s' does not have a valid gtid_binlog_pos.", master->name());
}
else
{
can_replicate = m_gtid_current_pos.can_replicate_from(master->m_gtid_binlog_pos);
if (!can_replicate)
{
*reason_out = string_printf("gtid_current_pos of %s (%s) is incompatible with "
"gtid_binlog_pos of %s (%s).",
*reason_out = string_printf("gtid_current_pos of '%s' (%s) is incompatible with "
"gtid_binlog_pos of '%s' (%s).",
name(), m_gtid_current_pos.to_string().c_str(),
master->name(), master->m_gtid_binlog_pos.to_string().c_str());
}
@ -743,9 +742,7 @@ bool MariaDBServer::redirect_one_slave(const string& change_cmd)
if (!success)
{
MXS_WARNING("Slave '%s' redirection failed: '%s'. Query: '%s'.",
name(),
mysql_error(slave_conn),
query);
name(), mysql_error(slave_conn), query);
}
return success;
}
@ -913,9 +910,8 @@ void MariaDBServer::update_server_version()
}
else
{
MXS_ERROR("MariaDB/MySQL version of %s is less than 5.5, which is not supported. "
"The server is ignored by the monitor. Server version string: '%s'.",
name(), srv->version_string);
MXS_ERROR("MariaDB/MySQL version of '%s' (%s) is less than 5.5, which is not supported. "
"The server is ignored by the monitor.", name(), srv->version_string);
}
}
}
@ -936,9 +932,7 @@ void MariaDBServer::check_permissions()
// Only print error if last round was ok.
if (!had_status(SERVER_AUTH_ERROR))
{
MXS_WARNING("Error during monitor permissions test for server '%s': %s",
name(),
err_msg.c_str());
MXS_WARNING("Error during monitor permissions test for server '%s': %s", name(), err_msg.c_str());
}
}
else
@ -1336,9 +1330,7 @@ bool MariaDBServer::events_foreach(ManipulatorFunc& func, json_t** error_out)
{
MXS_ERROR("Could not query event status of '%s': %s Event handling can be disabled by "
"setting '%s' to false.",
name(),
error_msg.c_str(),
CN_HANDLE_EVENTS);
name(), error_msg.c_str(), CN_HANDLE_EVENTS);
return false;
}
@ -1538,8 +1530,7 @@ bool MariaDBServer::promote(GeneralOpData& general, ServerOperation& promotion,
}
else
{
PRINT_MXS_JSON_ERROR(error_out,
"Could not copy slave connections from %s to %s.",
PRINT_MXS_JSON_ERROR(error_out, "Could not copy slave connections from '%s' to '%s'.",
demotion_target->name(), name());
}
}
@ -1551,8 +1542,7 @@ bool MariaDBServer::promote(GeneralOpData& general, ServerOperation& promotion,
}
else
{
PRINT_MXS_JSON_ERROR(error_out,
"Could not merge slave connections from %s to %s.",
PRINT_MXS_JSON_ERROR(error_out, "Could not merge slave connections from '%s' to '%s'.",
demotion_target->name(), name());
}
}
@ -1604,7 +1594,7 @@ bool MariaDBServer::demote(GeneralOpData& general, ServerOperation& demotion)
if (!events_disabled)
{
demotion_error = true;
PRINT_MXS_JSON_ERROR(error_out, "Failed to disable events on %s.", name());
PRINT_MXS_JSON_ERROR(error_out, "Failed to disable events on '%s'.", name());
}
}
@ -1618,7 +1608,7 @@ bool MariaDBServer::demote(GeneralOpData& general, ServerOperation& demotion)
{
demotion_error = true;
PRINT_MXS_JSON_ERROR(error_out,
"Execution of file '%s' failed during demotion of server %s.",
"Execution of file '%s' failed during demotion of server '%s'.",
sql_file.c_str(), name());
}
}
@ -1634,7 +1624,7 @@ bool MariaDBServer::demote(GeneralOpData& general, ServerOperation& demotion)
{
demotion_error = true;
PRINT_MXS_JSON_ERROR(error_out,
"Failed to flush binary logs of %s during demotion: %s.",
"Failed to flush binary logs of '%s' during demotion: %s.",
name(), error_msg.c_str());
}
}
@ -1652,8 +1642,7 @@ bool MariaDBServer::demote(GeneralOpData& general, ServerOperation& demotion)
else
{
demotion_error = true;
PRINT_MXS_JSON_ERROR(error_out,
"Failed to update gtid:s of %s during demotion: %s.",
PRINT_MXS_JSON_ERROR(error_out, "Failed to update gtid:s of '%s' during demotion: %s.",
name(), error_msg.c_str());
}
}
@ -1710,8 +1699,7 @@ bool MariaDBServer::stop_slave_conn(const std::string& conn_name, StopMode mode,
}
else
{
PRINT_MXS_JSON_ERROR(error_out,
"Failed to reset slave connection on %s: %s",
PRINT_MXS_JSON_ERROR(error_out, "Failed to reset slave connection on '%s': %s",
name(), error_msg.c_str());
}
}
@ -1722,8 +1710,7 @@ bool MariaDBServer::stop_slave_conn(const std::string& conn_name, StopMode mode,
}
else
{
PRINT_MXS_JSON_ERROR(error_out,
"Failed to stop slave connection on %s: %s",
PRINT_MXS_JSON_ERROR(error_out, "Failed to stop slave connection on '%s': %s",
name(), error_msg.c_str());
}
return rval;
@ -1759,7 +1746,7 @@ bool MariaDBServer::remove_slave_conns(GeneralOpData& op, const SlaveStatusArray
bool success = false;
if (stop_slave_error)
{
PRINT_MXS_JSON_ERROR(error_out, "Failed to remove slave connection(s) from %s.", name());
PRINT_MXS_JSON_ERROR(error_out, "Failed to remove slave connection(s) from '%s'.", name());
}
else
{
@ -1793,14 +1780,13 @@ bool MariaDBServer::remove_slave_conns(GeneralOpData& op, const SlaveStatusArray
{
// This means server is really bugging.
PRINT_MXS_JSON_ERROR(error_out,
"%s still has %i removed slave connections,"
"'%s' still has %i removed slave connections, "
"RESET SLAVE must have failed.", name(), found);
}
}
else
{
PRINT_MXS_JSON_ERROR(error_out,
"Failed to update slave connections of %s: %s",
PRINT_MXS_JSON_ERROR(error_out, "Failed to update slave connections of '%s': %s",
name(), error_msg.c_str());
}
}
@ -1863,12 +1849,12 @@ bool MariaDBServer::merge_slave_conns(GeneralOpData& op, const SlaveStatusArray&
{
// This is not an error but indicates a complicated topology. In any case, ignore this.
accepted = false;
ignore_reason = string_printf("it points to %s (according to server id:s).", name());
ignore_reason = string_printf("it points to '%s' (according to server id:s).", name());
}
else if (slave_conn.master_host == my_host && slave_conn.master_port == my_port)
{
accepted = false;
ignore_reason = string_printf("it points to %s (according to master host:port).", name());
ignore_reason = string_printf("it points to '%s' (according to master host:port).", name());
}
else
{
@ -1878,8 +1864,8 @@ bool MariaDBServer::merge_slave_conns(GeneralOpData& op, const SlaveStatusArray&
if (my_slave_conn.seen_connected && my_slave_conn.master_server_id == master_id)
{
accepted = false;
const char format[] =
"its Master_Server_Id (%" PRIi64 ") matches an existing slave connection on %s.";
const char format[] = "its Master_Server_Id (%" PRIi64 ") matches an existing "
"slave connection on '%s'.";
ignore_reason = string_printf(format, master_id, name());
}
else if (my_slave_conn.master_host == slave_conn.master_host
@ -1925,7 +1911,7 @@ bool MariaDBServer::merge_slave_conns(GeneralOpData& op, const SlaveStatusArray&
}
else
{
MXS_WARNING("A slave connection with name '%s' already exists on %s, using generated "
MXS_WARNING("A slave connection with name '%s' already exists on '%s', using generated "
"name '%s' instead.", slave_conn->name.c_str(), name(), second_try.c_str());
slave_conn->name = second_try;
name_is_unique = true;
@ -1965,7 +1951,7 @@ bool MariaDBServer::merge_slave_conns(GeneralOpData& op, const SlaveStatusArray&
else
{
mxb_assert(!ignore_reason.empty());
MXS_WARNING("%s was ignored when promoting %s because %s",
MXS_WARNING("%s was ignored when promoting '%s' because %s",
slave_conn.to_short_string().c_str(), name(), ignore_reason.c_str());
}
}
@ -1998,7 +1984,7 @@ bool MariaDBServer::copy_slave_conns(GeneralOpData& op, const SlaveStatusArray&
}
else
{
MXS_WARNING("%s was not copied to %s because %s",
MXS_WARNING("%s was not copied to '%s' because %s",
slave_conn.to_short_string().c_str(), name(), reason_not_copied.c_str());
}
}