From c58041d4fb0e3e7227331398e3a8ac1eff8631ec Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Tue, 25 Sep 2018 16:03:03 +0300 Subject: [PATCH] Format MariaDBMonitor source Some parts were manually edited for better results. No functional changes. --- .../mariadbmon/cluster_manipulation.cc | 24 +++++++++---------- .../modules/monitor/mariadbmon/mariadbmon.hh | 8 +++---- .../monitor/mariadbmon/mariadbmon_common.cc | 2 +- .../monitor/mariadbmon/mariadbmon_common.hh | 14 +++++------ .../monitor/mariadbmon/mariadbserver.cc | 6 ++--- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/server/modules/monitor/mariadbmon/cluster_manipulation.cc b/server/modules/monitor/mariadbmon/cluster_manipulation.cc index 4cd24654d..1dee2191c 100644 --- a/server/modules/monitor/mariadbmon/cluster_manipulation.cc +++ b/server/modules/monitor/mariadbmon/cluster_manipulation.cc @@ -1192,7 +1192,7 @@ bool MariaDBMonitor::promote_new_master(MariaDBServer* new_master, json_t** erro * @return The selected promotion target or NULL if no valid candidates */ MariaDBServer* MariaDBMonitor::select_promotion_target(MariaDBServer* demotion_target, - OperationType op, + OperationType op, Log log_mode, json_t** error_out) { @@ -1475,19 +1475,19 @@ unique_ptr MariaDBMonitor::failover_prepare(Log log_mode, json // repeatedly since it is likely to change continuously. if (error_out || log_mode == Log::ON) { - string unproc_events = string_printf( - "The relay log of '%s' has %" PRIu64 " unprocessed events " - "(Gtid_IO_Pos: %s, Gtid_Current_Pos: %s).", - promotion_target->name(), - events, - slave_conn->gtid_io_pos.to_string().c_str(), - promotion_target->m_gtid_current_pos.to_string().c_str()); + const char unproc_fmt[] = + "The relay log of '%s' has %" PRIu64 + " unprocessed events (Gtid_IO_Pos: %s, Gtid_Current_Pos: %s)."; + string unproc_events = string_printf(unproc_fmt, promotion_target->name(), events, + slave_conn->gtid_io_pos.to_string().c_str(), + promotion_target->m_gtid_current_pos.to_string().c_str()); if (error_out) { - // Print a bit more helpful error for the user, goes to log too. This should be a very rare - // occurrence: either the dba managed to start failover really fast, or the relay log is - // massive. In the latter case it's ok that the monitor does not do the waiting since there - // is no telling how long the wait will be. + /* Print a bit more helpful error for the user, goes to log too. + * This should be a very rare occurrence: either the dba managed to start failover + * really fast, or the relay log is massive. In the latter case it's ok + * that the monitor does not do the waiting since there is no telling how long + * the wait will be. */ const char wait_relay_log[] = "%s To avoid data loss, failover should be postponed until " "the log has been processed. Please try again later."; diff --git a/server/modules/monitor/mariadbmon/mariadbmon.hh b/server/modules/monitor/mariadbmon/mariadbmon.hh index 404ca52b6..72c716dad 100644 --- a/server/modules/monitor/mariadbmon/mariadbmon.hh +++ b/server/modules/monitor/mariadbmon/mariadbmon.hh @@ -248,9 +248,9 @@ private: // Failover methods std::unique_ptr failover_prepare(Log log_mode, json_t** error_out); - bool failover_perform(ClusterOperation& operation); - const MariaDBServer* slave_receiving_events(const MariaDBServer* demotion_target, - Duration* event_age_out); + bool failover_perform(ClusterOperation& operation); + const MariaDBServer* slave_receiving_events(const MariaDBServer* demotion_target, + Duration* event_age_out); bool manual_failover(json_t** output); void handle_auto_failover(); @@ -264,7 +264,7 @@ private: // Methods common to failover/switchover/rejoin MariaDBServer* select_promotion_target(MariaDBServer* current_master, - OperationType op, + OperationType op, Log log_mode, json_t** error_out); bool server_is_excluded(const MariaDBServer* server); diff --git a/server/modules/monitor/mariadbmon/mariadbmon_common.cc b/server/modules/monitor/mariadbmon/mariadbmon_common.cc index d8da7b7af..6ef2d5953 100644 --- a/server/modules/monitor/mariadbmon/mariadbmon_common.cc +++ b/server/modules/monitor/mariadbmon/mariadbmon_common.cc @@ -44,4 +44,4 @@ ClusterOperation::ClusterOperation(OperationType type, , handle_events(handle_events) , error_out(error) , time_remaining(time_remaining) -{} \ No newline at end of file +{} diff --git a/server/modules/monitor/mariadbmon/mariadbmon_common.hh b/server/modules/monitor/mariadbmon/mariadbmon_common.hh index 3948ab1cd..24566dbc0 100644 --- a/server/modules/monitor/mariadbmon/mariadbmon_common.hh +++ b/server/modules/monitor/mariadbmon/mariadbmon_common.hh @@ -89,13 +89,13 @@ class MariaDBServer; class ClusterOperation { public: - const OperationType type; // Failover or switchover - MariaDBServer* const promotion_target; // Which server will be promoted - MariaDBServer* const demotion_target; // Which server will be demoted - const bool demotion_target_is_master; // Was the demotion target the master? - const bool handle_events; // Should scheduled server events be disabled/enabled? - json_t** const error_out; // Json error output - maxbase::Duration time_remaining; // How much time remains to complete the operation + const OperationType type; // Failover or switchover + MariaDBServer* const promotion_target; // Which server will be promoted + MariaDBServer* const demotion_target; // Which server will be demoted + const bool demotion_target_is_master; // Was the demotion target the master? + const bool handle_events; // Should scheduled server events be disabled/enabled? + json_t** const error_out; // Json error output + maxbase::Duration time_remaining; // How much time remains to complete the operation ClusterOperation(OperationType type, MariaDBServer* promotion_target, MariaDBServer* demotion_target, diff --git a/server/modules/monitor/mariadbmon/mariadbserver.cc b/server/modules/monitor/mariadbmon/mariadbserver.cc index 8f3f5cba5..89cf7046e 100644 --- a/server/modules/monitor/mariadbmon/mariadbserver.cc +++ b/server/modules/monitor/mariadbmon/mariadbserver.cc @@ -1272,9 +1272,9 @@ bool MariaDBServer::alter_event(const EventInfo& event, const string& target_sta if (loc_at != string::npos) { auto host_begin = loc_at + 1; - quoted_definer = event.definer.substr(0, loc_at + 1) + - // host_begin may be the null-char if @ was the last char - "'" + event.definer.substr(host_begin, string::npos) + "'"; + quoted_definer = event.definer.substr(0, loc_at + 1) + + // host_begin may be the null-char if @ was the last char + "'" + event.definer.substr(host_begin, string::npos) + "'"; } else {