summaryrefslogtreecommitdiff
path: root/sql/rpl_parallel.h
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2015-11-13 14:24:40 +0100
committerKristian Nielsen <knielsen@knielsen-hq.org>2015-11-13 14:24:40 +0100
commit8f2e05f41cf3b92bdb4c409e542ef126d5fe8f95 (patch)
tree701b5599a3c9478e125535580e294f8b627f2834 /sql/rpl_parallel.h
parent2828c2be554b62646fc990ac28b4aef20cd9b9d2 (diff)
parentba02550166eb39c0375a6422ecaa4731421250b6 (diff)
downloadmariadb-git-8f2e05f41cf3b92bdb4c409e542ef126d5fe8f95.tar.gz
Merge branch 'mdev7818-4' into 10.1
Conflicts: mysql-test/suite/perfschema/r/stage_mdl_global.result sql/rpl_rli.cc sql/sql_parse.cc
Diffstat (limited to 'sql/rpl_parallel.h')
-rw-r--r--sql/rpl_parallel.h38
1 files changed, 31 insertions, 7 deletions
diff --git a/sql/rpl_parallel.h b/sql/rpl_parallel.h
index 0b6c0b460d0..6c1a650429b 100644
--- a/sql/rpl_parallel.h
+++ b/sql/rpl_parallel.h
@@ -93,6 +93,7 @@ struct rpl_parallel_thread {
bool delay_start;
bool running;
bool stop;
+ bool pause_for_ftwrl;
mysql_mutex_t LOCK_rpl_thread;
mysql_cond_t COND_rpl_thread;
mysql_cond_t COND_rpl_thread_queue;
@@ -222,12 +223,18 @@ struct rpl_parallel_thread {
struct rpl_parallel_thread_pool {
- uint32 count;
struct rpl_parallel_thread **threads;
struct rpl_parallel_thread *free_list;
mysql_mutex_t LOCK_rpl_thread_pool;
mysql_cond_t COND_rpl_thread_pool;
+ uint32 count;
bool inited;
+ /*
+ While FTWRL runs, this counter is incremented to make SQL thread or
+ STOP/START slave not try to start new activity while that operation
+ is in progress.
+ */
+ bool busy;
rpl_parallel_thread_pool();
int init(uint32 size);
@@ -242,6 +249,12 @@ struct rpl_parallel_entry {
mysql_mutex_t LOCK_parallel_entry;
mysql_cond_t COND_parallel_entry;
uint32 domain_id;
+ /*
+ Incremented by wait_for_workers_idle() and rpl_pause_for_ftwrl() to show
+ that they are waiting, so that finish_event_group knows to signal them
+ when last_committed_sub_id is increased.
+ */
+ uint32 need_sub_id_signal;
uint64 last_commit_id;
bool active;
/*
@@ -251,12 +264,6 @@ struct rpl_parallel_entry {
*/
bool force_abort;
/*
- Set in wait_for_workers_idle() to show that it is waiting, so that
- finish_event_group knows to signal it when last_committed_sub_id is
- increased.
- */
- bool need_sub_id_signal;
- /*
At STOP SLAVE (force_abort=true), we do not want to process all events in
the queue (which could unnecessarily delay stop, if a lot of events happen
to be queued). The stop_count provides a safe point at which to stop, so
@@ -296,6 +303,15 @@ struct rpl_parallel_entry {
queued for execution by a worker thread.
*/
uint64 current_sub_id;
+ /*
+ The largest sub_id that has started its transaction. Protected by
+ LOCK_parallel_entry.
+
+ (Transactions can start out-of-order, so this value signifies that no
+ transactions with larger sub_id have started, but not necessarily that all
+ transactions with smaller sub_id have started).
+ */
+ uint64 largest_started_sub_id;
rpl_group_info *current_group_info;
/*
If we get an error in some event group, we set the sub_id of that event
@@ -305,6 +321,12 @@ struct rpl_parallel_entry {
The value is ULONGLONG_MAX when no error occured.
*/
uint64 stop_on_error_sub_id;
+ /*
+ During FLUSH TABLES WITH READ LOCK, transactions with sub_id larger than
+ this value must not start, but wait until the global read lock is released.
+ The value is set to ULONGLONG_MAX when no FTWRL is pending.
+ */
+ uint64 pause_sub_id;
/* Total count of event groups queued so far. */
uint64 count_queued_event_groups;
/*
@@ -345,5 +367,7 @@ extern struct rpl_parallel_thread_pool global_rpl_thread_pool;
extern int rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool);
extern int rpl_parallel_inactivate_pool(rpl_parallel_thread_pool *pool);
extern bool process_gtid_for_restart_pos(Relay_log_info *rli, rpl_gtid *gtid);
+extern int rpl_pause_for_ftwrl(THD *thd);
+extern void rpl_unpause_after_ftwrl(THD *thd);
#endif /* RPL_PARALLEL_H */