MXS-1744 Rename and clean up gtid code, move to separate file
Renamed the two gtid-classes to better match MariaDB documentation. One domain-server-sequence-combination is now a "Gtid", as these identify a transaction. A "GtidList" contains a list of Gtid:s for handling multi-domain server variables composed of multiple comma separated Gtid:s. Removed unused methods and renamed some existing ones. Moved the Gtid-code to its own file.
This commit is contained in:
@ -811,7 +811,7 @@ bool MariaDBMonitor::failover_wait_relay_log(MXS_MONITORED_SERVER* new_master, i
|
||||
new_master->server->unique_name, master_info->relay_log_events());
|
||||
thread_millisleep(1000); // Sleep for a while before querying server again.
|
||||
// Todo: check server version before entering failover.
|
||||
Gtid old_gtid_io_pos = master_info->slave_status.gtid_io_pos;
|
||||
GtidList old_gtid_io_pos = master_info->slave_status.gtid_io_pos;
|
||||
// Update gtid:s first to make sure Gtid_IO_Pos is the more recent value.
|
||||
// It doesn't matter here, but is a general rule.
|
||||
query_ok = master_info->update_gtids() && master_info->do_show_slave_status();
|
||||
@ -961,7 +961,7 @@ bool MariaDBMonitor::switchover_demote_master(MXS_MONITORED_SERVER* current_mast
|
||||
* @param err_out json object for error printing. Can be NULL.
|
||||
* @return True, if target gtid was reached within allotted time for all servers
|
||||
*/
|
||||
bool MariaDBMonitor::switchover_wait_slaves_catchup(const ServerVector& slaves, const Gtid& gtid,
|
||||
bool MariaDBMonitor::switchover_wait_slaves_catchup(const ServerVector& slaves, const GtidList& gtid,
|
||||
int total_timeout, int read_timeout, json_t** err_out)
|
||||
{
|
||||
bool success = true;
|
||||
@ -1002,7 +1002,7 @@ bool MariaDBMonitor::switchover_wait_slaves_catchup(const ServerVector& slaves,
|
||||
* @param err_out json object for error printing. Can be NULL.
|
||||
* @return True, if target gtid was reached within allotted time
|
||||
*/
|
||||
bool MariaDBMonitor::switchover_wait_slave_catchup(MXS_MONITORED_SERVER* slave, const Gtid& gtid,
|
||||
bool MariaDBMonitor::switchover_wait_slave_catchup(MXS_MONITORED_SERVER* slave, const GtidList& gtid,
|
||||
int total_timeout, int read_timeout,
|
||||
json_t** err_out)
|
||||
{
|
||||
@ -1075,7 +1075,7 @@ bool MariaDBMonitor::wait_cluster_stabilization(MXS_MONITORED_SERVER* new_master
|
||||
int query_fails = 0;
|
||||
int repl_fails = 0;
|
||||
int successes = 0;
|
||||
const Gtid& target = new_master_info->gtid_current_pos;
|
||||
const GtidList& target = new_master_info->gtid_current_pos;
|
||||
ServerVector wait_list = slaves; // Check all the servers in the list
|
||||
bool first_round = true;
|
||||
bool time_is_up = false;
|
||||
@ -1105,8 +1105,8 @@ bool MariaDBMonitor::wait_cluster_stabilization(MXS_MONITORED_SERVER* new_master
|
||||
wait_list.erase(wait_list.begin() + i);
|
||||
repl_fails++;
|
||||
}
|
||||
else if (Gtid::events_ahead(target, slave_info->gtid_current_pos,
|
||||
Gtid::MISSING_DOMAIN_IGNORE) == 0)
|
||||
else if (GtidList::events_ahead(target, slave_info->gtid_current_pos,
|
||||
GtidList::MISSING_DOMAIN_IGNORE) == 0)
|
||||
{
|
||||
// This slave has reached the same gtid as master, remove from list
|
||||
wait_list.erase(wait_list.begin() + i);
|
||||
@ -1329,10 +1329,10 @@ bool MariaDBMonitor::server_is_excluded(const MXS_MONITORED_SERVER* server)
|
||||
bool MariaDBMonitor::is_candidate_better(const MariaDBServer* current_best_info,
|
||||
const MariaDBServer* candidate_info, uint32_t gtid_domain)
|
||||
{
|
||||
uint64_t cand_io = candidate_info->slave_status.gtid_io_pos.get_triplet(gtid_domain).sequence;
|
||||
uint64_t cand_processed = candidate_info->gtid_current_pos.get_triplet(gtid_domain).sequence;
|
||||
uint64_t curr_io = current_best_info->slave_status.gtid_io_pos.get_triplet(gtid_domain).sequence;
|
||||
uint64_t curr_processed = current_best_info->gtid_current_pos.get_triplet(gtid_domain).sequence;
|
||||
uint64_t cand_io = candidate_info->slave_status.gtid_io_pos.get_gtid(gtid_domain).m_sequence;
|
||||
uint64_t cand_processed = candidate_info->gtid_current_pos.get_gtid(gtid_domain).m_sequence;
|
||||
uint64_t curr_io = current_best_info->slave_status.gtid_io_pos.get_gtid(gtid_domain).m_sequence;
|
||||
uint64_t curr_processed = current_best_info->gtid_current_pos.get_gtid(gtid_domain).m_sequence;
|
||||
|
||||
bool cand_updates = candidate_info->rpl_settings.log_slave_updates;
|
||||
bool curr_updates = current_best_info->rpl_settings.log_slave_updates;
|
||||
|
Reference in New Issue
Block a user