MXS-2220 server_alloc returns internal type
Also adds default initializers to SERVER fields.
This commit is contained in:
@ -484,7 +484,7 @@ void MariaDBMonitor::assign_server_roles()
|
||||
for (auto server : m_servers)
|
||||
{
|
||||
server->clear_status(remove_bits);
|
||||
server->m_replication_lag = MXS_RLAG_UNDEFINED;
|
||||
server->m_replication_lag = SERVER::RLAG_UNDEFINED;
|
||||
}
|
||||
|
||||
// Check the the master node, label it as the [Master] if
|
||||
@ -636,8 +636,8 @@ void MariaDBMonitor::assign_slave_and_relay_master(MariaDBServer* start_node)
|
||||
// leading to the master or a relay.
|
||||
int curr_rlag = slave->m_replication_lag;
|
||||
int new_rlag = sstatus->seconds_behind_master;
|
||||
if (new_rlag != MXS_RLAG_UNDEFINED
|
||||
&& (curr_rlag == MXS_RLAG_UNDEFINED || new_rlag < curr_rlag))
|
||||
if (new_rlag != SERVER::RLAG_UNDEFINED
|
||||
&& (curr_rlag == SERVER::RLAG_UNDEFINED || new_rlag < curr_rlag))
|
||||
{
|
||||
slave->m_replication_lag = new_rlag;
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ bool MariaDBServer::do_show_slave_status(string* errmsg_out)
|
||||
|
||||
auto rlag = result->get_uint(i_seconds_behind_master);
|
||||
// If slave connection is stopped, the value given by the backend is null -> -1.
|
||||
new_row.seconds_behind_master = (rlag < 0) ? MXS_RLAG_UNDEFINED :
|
||||
new_row.seconds_behind_master = (rlag < 0) ? SERVER::RLAG_UNDEFINED :
|
||||
(rlag > INT_MAX) ? INT_MAX : rlag;
|
||||
|
||||
if (all_slaves_status)
|
||||
|
@ -126,7 +126,7 @@ public:
|
||||
|
||||
/* Replication lag of the server. Used during calculation so that the actual SERVER struct is
|
||||
* only written to once. */
|
||||
int m_replication_lag = MXS_RLAG_UNDEFINED;
|
||||
int m_replication_lag = SERVER::RLAG_UNDEFINED;
|
||||
/* Copy of same field in monitor object. TODO: pass in struct when adding concurrent updating. */
|
||||
bool m_assume_unique_hostnames = true;
|
||||
/* Has anything that could affect replication topology changed this iteration?
|
||||
|
@ -74,9 +74,8 @@ json_t* SlaveStatus::to_json() const
|
||||
"slave_io_running",
|
||||
json_string(slave_io_to_string(slave_io_running).c_str()));
|
||||
json_object_set_new(result, "slave_sql_running", json_string(slave_sql_running ? "Yes" : "No"));
|
||||
json_object_set_new(result,
|
||||
"seconds_behing_master",
|
||||
seconds_behind_master == MXS_RLAG_UNDEFINED ? json_null() :
|
||||
json_object_set_new(result, "seconds_behing_master",
|
||||
seconds_behind_master == SERVER::RLAG_UNDEFINED ? json_null() :
|
||||
json_integer(seconds_behind_master));
|
||||
json_object_set_new(result, "master_server_id", json_integer(master_server_id));
|
||||
json_object_set_new(result, "last_io_or_sql_error", json_string(last_error.c_str()));
|
||||
|
@ -170,30 +170,28 @@ public:
|
||||
SLAVE_IO_NO,
|
||||
};
|
||||
|
||||
std::string owning_server; /* Server name of the owner */
|
||||
bool seen_connected = false; /* Has this slave connection been seen connected,
|
||||
* meaning that the master server id
|
||||
* is correct? */
|
||||
std::string name; /* Slave connection name. Must be unique for
|
||||
* the server.*/
|
||||
int64_t master_server_id = SERVER_ID_UNKNOWN; /* The master's server_id value. Valid ids are
|
||||
* 32bit unsigned. -1 is unread/error. */
|
||||
std::string master_host; /* Master server host name. */
|
||||
int master_port = PORT_UNKNOWN; /* Master server port. */
|
||||
slave_io_running_t slave_io_running = SLAVE_IO_NO; /* Slave I/O thread running state: * "Yes",
|
||||
* "Connecting" or "No" */
|
||||
bool slave_sql_running = false; /* Slave SQL thread running state, true if "Yes"
|
||||
* */
|
||||
GtidList gtid_io_pos; /* Gtid I/O position of the slave thread. */
|
||||
std::string last_error; /* Last IO or SQL error encountered. */
|
||||
int seconds_behind_master = MXS_RLAG_UNDEFINED; /* How much behind the slave is. */
|
||||
int64_t received_heartbeats = 0; /* How many heartbeats the connection has received
|
||||
* */
|
||||
std::string owning_server; /* Server name of the owner */
|
||||
bool seen_connected = false; /* Has this slave connection been seen connected,
|
||||
* meaning that the master server id is correct? */
|
||||
std::string name; /* Slave connection name. Must be unique for
|
||||
* the server.*/
|
||||
int64_t master_server_id = SERVER_ID_UNKNOWN; /* The master's server_id value. Valid ids are
|
||||
* 32bit unsigned. -1 is unread/error. */
|
||||
std::string master_host; /* Master server host name. */
|
||||
int master_port = PORT_UNKNOWN; /* Master server port. */
|
||||
slave_io_running_t slave_io_running = SLAVE_IO_NO; /* Slave I/O thread running state: * "Yes",
|
||||
* "Connecting" or "No" */
|
||||
bool slave_sql_running = false; /* Slave SQL thread running state, true if "Yes" */
|
||||
GtidList gtid_io_pos; /* Gtid I/O position of the slave thread. */
|
||||
std::string last_error; /* Last IO or SQL error encountered. */
|
||||
int64_t received_heartbeats = 0; /* How many heartbeats the connection has
|
||||
* received */
|
||||
|
||||
int seconds_behind_master = SERVER::RLAG_UNDEFINED; /* How much behind the slave is. */
|
||||
|
||||
/* Time of the latest gtid event or heartbeat the slave connection has received, timed by the monitor. */
|
||||
maxbase::Clock::time_point last_data_time = maxbase::Clock::now();
|
||||
|
||||
|
||||
std::string to_string() const;
|
||||
json_t* to_json() const;
|
||||
|
||||
|
Reference in New Issue
Block a user