MXS-1513: mysql_mon.cc formatting changes

Ran astyle, cut some long lines.
This commit is contained in:
Esa Korhonen
2017-12-04 13:42:14 +02:00
parent c0ab80e459
commit 046ed5c93d

View File

@ -101,7 +101,7 @@ void check_maxscale_schema_replication(MXS_MONITOR *monitor);
static bool mon_process_failover(MYSQL_MONITOR*, uint32_t, bool*); static bool mon_process_failover(MYSQL_MONITOR*, uint32_t, bool*);
static bool do_failover(MYSQL_MONITOR* mon, json_t** output); static bool do_failover(MYSQL_MONITOR* mon, json_t** output);
static bool do_switchover(MYSQL_MONITOR* mon, MXS_MONITORED_SERVER* current_master, static bool do_switchover(MYSQL_MONITOR* mon, MXS_MONITORED_SERVER* current_master,
MXS_MONITORED_SERVER* new_master,json_t** err_out); MXS_MONITORED_SERVER* new_master, json_t** err_out);
static bool update_gtids(MYSQL_MONITOR* mon, MXS_MONITORED_SERVER *database, MySqlServerInfo* info); static bool update_gtids(MYSQL_MONITOR* mon, MXS_MONITORED_SERVER *database, MySqlServerInfo* info);
static bool update_replication_settings(MXS_MONITORED_SERVER *database, MySqlServerInfo* info); static bool update_replication_settings(MXS_MONITORED_SERVER *database, MySqlServerInfo* info);
static bool query_one_row(MXS_MONITORED_SERVER *database, const char* query, unsigned int expected_cols, static bool query_one_row(MXS_MONITORED_SERVER *database, const char* query, unsigned int expected_cols,
@ -538,8 +538,8 @@ bool mysql_handle_failover(const MODULECMD_ARG* args, json_t** output)
extern "C" extern "C"
{ {
MXS_MODULE* MXS_CREATE_MODULE() MXS_MODULE* MXS_CREATE_MODULE()
{ {
MXS_NOTICE("Initialise the MySQL Monitor module."); MXS_NOTICE("Initialise the MySQL Monitor module.");
const char ARG_MONITOR_DESC[] = "MySQL Monitor name (from configuration file)"; const char ARG_MONITOR_DESC[] = "MySQL Monitor name (from configuration file)";
static modulecmd_arg_type_t switchover_argv[] = static modulecmd_arg_type_t switchover_argv[] =
@ -553,8 +553,8 @@ MXS_MODULE* MXS_CREATE_MODULE()
}; };
modulecmd_register_command(MXS_MODULE_NAME, "switchover", MODULECMD_TYPE_ACTIVE, modulecmd_register_command(MXS_MODULE_NAME, "switchover", MODULECMD_TYPE_ACTIVE,
mysql_handle_switchover, MXS_ARRAY_NELEMS(switchover_argv), switchover_argv, mysql_handle_switchover, MXS_ARRAY_NELEMS(switchover_argv),
"Perform master switchover"); switchover_argv, "Perform master switchover");
static modulecmd_arg_type_t failover_argv[] = static modulecmd_arg_type_t failover_argv[] =
{ {
@ -565,8 +565,8 @@ MXS_MODULE* MXS_CREATE_MODULE()
}; };
modulecmd_register_command(MXS_MODULE_NAME, "failover", MODULECMD_TYPE_ACTIVE, modulecmd_register_command(MXS_MODULE_NAME, "failover", MODULECMD_TYPE_ACTIVE,
mysql_handle_failover, MXS_ARRAY_NELEMS(failover_argv), failover_argv, mysql_handle_failover, MXS_ARRAY_NELEMS(failover_argv),
"Perform master failover"); failover_argv, "Perform master failover");
static MXS_MONITOR_OBJECT MyObject = static MXS_MONITOR_OBJECT MyObject =
{ {
@ -625,7 +625,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
}; };
return &info; return &info;
} }
} }
@ -642,12 +642,12 @@ public:
{} {}
/** /**
* Parse a Gtid-triplet from a string. In case of a multi-triplet value, only the triplet with the given domain * Parse a Gtid-triplet from a string. In case of a multi-triplet value, only the triplet with
* is returned. * the given domain is returned.
* *
* @param str Gtid string * @param str Gtid string
* @param search_domain The Gtid domain whose triplet should be returned. Negative domain means autoselect, * @param search_domain The Gtid domain whose triplet should be returned. Negative domain stands for
* which is only allowed when the string contains one triplet. * autoselect, which is only allowed when the string contains one triplet.
*/ */
Gtid(const char* str, int64_t search_domain = -1) Gtid(const char* str, int64_t search_domain = -1)
: domain(0) : domain(0)
@ -687,7 +687,7 @@ public:
private: private:
void parse_triplet(const char* str) void parse_triplet(const char* str)
{ {
ss_debug(int rv =) sscanf(str, "%" PRIu32 "-%" PRIu32 "-%" PRIu64, &domain, &server_id, &sequence); ss_debug(int rv = ) sscanf(str, "%" PRIu32 "-%" PRIu32 "-%" PRIu64, &domain, &server_id, &sequence);
ss_dassert(rv == 3); ss_dassert(rv == 3);
} }
}; };
@ -698,7 +698,8 @@ public:
int master_server_id; /**< The master's server_id value. */ int master_server_id; /**< The master's server_id value. */
bool slave_io_running; /**< Whether the slave I/O thread is running and connected. */ bool slave_io_running; /**< Whether the slave I/O thread is running and connected. */
bool slave_sql_running; /**< Whether or not the SQL thread is running. */ bool slave_sql_running; /**< Whether or not the SQL thread is running. */
string master_log_file; /**< Name of the master binary log file that the I/O thread is currently reading from. */ string master_log_file; /**< Name of the master binary log file that the I/O thread is currently
* reading from. */
uint64_t read_master_log_pos; /**< Position up to which the I/O thread has read in the current master uint64_t read_master_log_pos; /**< Position up to which the I/O thread has read in the current master
* binary log file. */ * binary log file. */
Gtid gtid_io_pos; /**< Gtid I/O position of the slave thread. Only shows the triplet with Gtid gtid_io_pos; /**< Gtid I/O position of the slave thread. Only shows the triplet with
@ -2215,8 +2216,9 @@ monitorMain(void *arg)
if (failover_not_possible(handle)) if (failover_not_possible(handle))
{ {
const char PROBLEMS[] = "Failover is not possible due to one or more problems in the " const char PROBLEMS[] = "Failover is not possible due to one or more problems in the "
"replication configuration, disabling automatic failover. Failover should only be " "replication configuration, disabling automatic failover. Failover "
"enabled after the replication configuration has been fixed."; "should only be enabled after the replication configuration has been "
"fixed.";
MXS_ERROR(RE_ENABLE_FMT, PROBLEMS, CN_AUTO_FAILOVER, mon->name); MXS_ERROR(RE_ENABLE_FMT, PROBLEMS, CN_AUTO_FAILOVER, mon->name);
handle->auto_failover = false; handle->auto_failover = false;
disable_setting(handle, CN_AUTO_FAILOVER); disable_setting(handle, CN_AUTO_FAILOVER);
@ -3319,7 +3321,7 @@ bool failover_wait_relay_log(MYSQL_MONITOR* mon, MXS_MONITORED_SERVER* new_maste
{ {
reason = "Old master sent new event(s)"; reason = "Old master sent new event(s)";
} }
else if(master_info->relay_log_events() < 0) else if (master_info->relay_log_events() < 0)
{ {
reason = "Invalid Gtid(s) (current_pos: " + master_info->gtid_current_pos.to_string() + reason = "Invalid Gtid(s) (current_pos: " + master_info->gtid_current_pos.to_string() +
", io_pos: " + master_info->slave_status.gtid_io_pos.to_string() + ")"; ", io_pos: " + master_info->slave_status.gtid_io_pos.to_string() + ")";
@ -3832,7 +3834,7 @@ static void read_server_variables(MXS_MONITORED_SERVER* database, MySqlServerInf
if (query_one_row(database, query.c_str(), columns, &row)) if (query_one_row(database, query.c_str(), columns, &row))
{ {
uint32_t server_id = 0; uint32_t server_id = 0;
ss_debug(int rv =) sscanf(row[ind_id].c_str(), "%" PRIu32, &server_id); ss_debug(int rv = ) sscanf(row[ind_id].c_str(), "%" PRIu32, &server_id);
ss_dassert(rv == 1 && (row[ind_ro] == "0" || row[ind_ro] == "1")); ss_dassert(rv == 1 && (row[ind_ro] == "0" || row[ind_ro] == "1"));
database->server->node_id = server_id; database->server->node_id = server_id;
serv_info->server_id = server_id; serv_info->server_id = server_id;
@ -3840,7 +3842,7 @@ static void read_server_variables(MXS_MONITORED_SERVER* database, MySqlServerInf
if (columns == 3) if (columns == 3)
{ {
uint32_t domain = 0; uint32_t domain = 0;
ss_debug(rv =) sscanf(row[ind_domain].c_str(), "%" PRIu32, &domain); ss_debug(rv = ) sscanf(row[ind_domain].c_str(), "%" PRIu32, &domain);
ss_dassert(rv == 1); ss_dassert(rv == 1);
serv_info->gtid_domain_id = domain; serv_info->gtid_domain_id = domain;
} }