diff options
author | Kristian Nielsen <knielsen@knielsen-hq.org> | 2016-11-15 23:00:11 +0100 |
---|---|---|
committer | Kristian Nielsen <knielsen@knielsen-hq.org> | 2016-11-15 23:00:11 +0100 |
commit | f1fcc1fc105ad0e329b8f6dd11923f99d6edd42b (patch) | |
tree | b405dd16ccd817e8aa76aec46ae5e1ccd73f0269 | |
parent | 9a090728805720fb10697267531235cfbac651f4 (diff) | |
download | mariadb-git-f1fcc1fc105ad0e329b8f6dd11923f99d6edd42b.tar.gz |
Back-port Master_info::using_parallel() to 10.0.
This has no functional changes, but it helps avoid merge problems from 10.0
to 10.1. In 10.0, code that checks for parallel replication uses
opt_slave_parallel_threads > 0, but this check needs to be
mi->using_parallel() in 10.1. By using the same check in 10.0 (with
unchanged semantics), merge problems to 10.1 are avoided.
-rw-r--r-- | sql/log_event.cc | 2 | ||||
-rw-r--r-- | sql/rpl_mi.h | 4 | ||||
-rw-r--r-- | sql/rpl_rli.cc | 2 | ||||
-rw-r--r-- | sql/slave.cc | 21 | ||||
-rw-r--r-- | sql/sys_vars.cc | 3 |
5 files changed, 16 insertions, 16 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index 4a1d13a8004..d311297f8a8 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -12829,7 +12829,7 @@ bool rpl_get_position_info(const char **log_file_name, ulonglong *log_pos, return FALSE; #else const Relay_log_info *rli= &(active_mi->rli); - if (opt_slave_parallel_threads == 0) + if (!rli->mi->using_parallel()) { *log_file_name= rli->group_master_log_name; *log_pos= rli->group_master_log_pos + diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index a27672e4c90..e58df0150f5 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -75,6 +75,10 @@ class Master_info : public Slave_reporting_capability return connection_name.str == 0; } static const char *using_gtid_astext(enum enum_using_gtid arg); + bool using_parallel() + { + return opt_slave_parallel_threads > 0; + } /* the variables below are needed because we can change masters on the fly */ char master_log_name[FN_REFLEN+6]; /* Room for multi-*/ diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 4aed8cdcd94..c570105cdf6 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1231,7 +1231,7 @@ bool Relay_log_info::is_until_satisfied(THD *thd, Log_event *ev) if (ev && ev->server_id == (uint32) global_system_variables.server_id && !replicate_same_server_id) DBUG_RETURN(FALSE); - log_name= (opt_slave_parallel_threads > 0 ? + log_name= (mi->using_parallel() ? future_event_master_log_name : group_master_log_name); log_pos= ((!ev)? group_master_log_pos : (get_flag(IN_TRANSACTION) || !ev->log_pos) ? diff --git a/sql/slave.cc b/sql/slave.cc index 04d62749fb1..e6a0ac086a8 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -620,8 +620,7 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock) if (thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL)) { DBUG_PRINT("info",("Terminating SQL thread")); - if (opt_slave_parallel_threads > 0 && - mi->rli.abort_slave && mi->rli.stop_for_until) + if (mi->using_parallel() && mi->rli.abort_slave && mi->rli.stop_for_until) { mi->rli.stop_for_until= false; mi->rli.parallel.stop_during_until(); @@ -2726,8 +2725,7 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, else { idle= mi->rli.sql_thread_caught_up; - if (opt_slave_parallel_threads > 0 && idle && - !mi->rli.parallel.workers_idle()) + if (mi->using_parallel() && idle && !mi->rli.parallel.workers_idle()) idle= false; } if (idle) @@ -3517,7 +3515,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, the user might be surprised to see a claim that the slave is up to date long before those queued events are actually executed. */ - if (opt_slave_parallel_threads == 0 && + if (!rli->mi->using_parallel() && !(ev->is_artificial_event() || ev->is_relay_log_event() || (ev->when == 0))) { rli->last_master_timestamp= ev->when + (time_t) ev->exec_time; @@ -3568,7 +3566,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, update_state_of_relay_log(rli, ev); - if (opt_slave_parallel_threads > 0) + if (rli->mi->using_parallel()) { int res= rli->parallel.do_event(serial_rgi, ev, event_size); if (res >= 0) @@ -4546,8 +4544,7 @@ pthread_handler_t handle_slave_sql(void *arg) serial_rgi->gtid_sub_id= 0; serial_rgi->gtid_pending= false; - if (mi->using_gtid != Master_info::USE_GTID_NO && - opt_slave_parallel_threads > 0 && + if (mi->using_gtid != Master_info::USE_GTID_NO && mi->using_parallel() && rli->restart_gtid_pos.count() > 0) { /* @@ -4734,7 +4731,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, } } - if (opt_slave_parallel_threads > 0) + if (mi->using_parallel()) rli->parallel.wait_for_done(thd, rli); /* Thread stopped. Print the current replication position to the log */ @@ -4760,7 +4757,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, (We want the first one to be before the printout of stop position to get the correct position printed.) */ - if (opt_slave_parallel_threads > 0) + if (mi->using_parallel()) rli->parallel.wait_for_done(thd, rli); /* @@ -4784,7 +4781,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, ulong domain_count; flush_relay_log_info(rli); - if (opt_slave_parallel_threads > 0) + if (mi->using_parallel()) { /* In parallel replication GTID mode, we may stop with different domains @@ -6475,7 +6472,7 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size) llstr(my_b_tell(cur_log),llbuf1), llstr(rli->event_relay_log_pos,llbuf2))); DBUG_ASSERT(my_b_tell(cur_log) >= BIN_LOG_HEADER_SIZE); - DBUG_ASSERT(opt_slave_parallel_threads > 0 || + DBUG_ASSERT(rli->mi->using_parallel() || my_b_tell(cur_log) == rli->event_relay_log_pos); } #endif diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 689d35c9cc3..089b6cd9c7e 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -4351,8 +4351,7 @@ static bool update_slave_skip_counter(sys_var *self, THD *thd, Master_info *mi) mi->connection_name.str); return true; } - if (mi->using_gtid != Master_info::USE_GTID_NO && - opt_slave_parallel_threads > 0) + if (mi->using_gtid != Master_info::USE_GTID_NO && mi->using_parallel()) { ulong domain_count; mysql_mutex_lock(&rpl_global_gtid_slave_state->LOCK_slave_state); |