diff options
| author | Aleksey Midenkov <midenok@gmail.com> | 2023-01-16 00:01:35 +0300 |
|---|---|---|
| committer | Aleksey Midenkov <midenok@gmail.com> | 2023-03-26 20:20:42 +0300 |
| commit | 06a7eb2dc31a273c3408ae983c3a2a7523dc353a (patch) | |
| tree | fb3311b1d3c6727d564da35dd37b295793c8d841 /sql/mysqld.cc | |
| parent | 8f934a8a573dedf15b40d9cdb1d033e24792c70c (diff) | |
| download | mariadb-git-bb-11.0-midenok-MDEV-30421.tar.gz | |
MDEV-30421 Allow administrators to enable or disable parallel replication on a per-table basisbb-11.0-midenok-MDEV-30421
Per-domain dedicated thread for processing ordered transactions. The
thread is reserved from the total number of domain threads (controlled
by slave_parallel_threads and slave_domain_parallel_threads). Whether
the event goes to ordered thread depends on FL_ALLOW_PARALLEL flag as
well as several other conditions. FL_ALLOW_PARALLEL is passed from
master and is set for the event depending on master configuration
directives. To allow dedicated slave on server one must enable it
explicitly with configuration directive:
set global slave_ordered_thread= 1;
Originally it was controlled by skip_parallel_replication session
variable which can be changed per-statement. This patch adds several
more directives to control it on per-schema and per-table levels:
parallel_do_db
parallel_do_table
parallel_ignore_db
parallel_ignore_table
parallel_wild_do_table
parallel_wild_ignore_table
Each directive is comma-separated list of fully-qualified table
names. Spaces after comma are ignored (but not before).
"Table" directives take precedence over "db" directives. "Do"
directives take precedence over "ignore" directives. "Wild" directives
are checked if "do" and "ignore" directives did not match.
If none of the above directives present everything is considered
parallel. If any of the above directives present and the table did not
match anything in the lists it is considered ordered.
Examples:
set @@global.parallel_do_db= "db_parallel";
set @@global.parallel_ignore_db= "db_serial";
set global parallel_do_table= "db_serial.t3, db_serial.t1";
set global parallel_wild_ignore_table= "db_parallel.non_parallel_%"
Normal behaviour of ordered transaction is before start to wait any of
prior transactions to commit: they get into different commit
groups. But since all the ordered transactions (within one domain) go
to a single thread we may avoid that restriction with this directive
on slave:
set global slave_ordered_dont_wait= 1;
When set events without explicit FL_WAITED flag going to ordered
thread nonetheless accept optimistic speculation. I.e. they get into
same commit group with parallel events: ordered event is executed in
parallel with parallel events.
Diffstat (limited to 'sql/mysqld.cc')
| -rw-r--r-- | sql/mysqld.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ee368def9be..1ec4a2072af 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -355,6 +355,8 @@ bool opt_bin_log, opt_bin_log_used=0, opt_ignore_builtin_innodb= 0; bool opt_bin_log_compress; uint opt_bin_log_compress_min_len; my_bool opt_log, debug_assert_if_crashed_table= 0, opt_help= 0; +my_bool opt_slave_ordered_thread= 0; +my_bool opt_slave_ordered_dont_wait= 0; my_bool debug_assert_on_not_freed_memory= 0; my_bool disable_log_notes, opt_support_flashback= 0; static my_bool opt_abort; @@ -632,6 +634,7 @@ THD_list server_threads; Rpl_filter* cur_rpl_filter; Rpl_filter* global_rpl_filter; Rpl_filter* binlog_filter; +Rpl_filter* parallel_filter; struct system_variables global_system_variables; /** @@ -2027,6 +2030,7 @@ static void clean_up(bool print_message) wsrep_thr_deinit(); my_uuid_end(); delete type_handler_data; + delete parallel_filter; delete binlog_filter; delete global_rpl_filter; end_ssl(); @@ -3947,7 +3951,8 @@ static int init_common_variables() global_rpl_filter= new Rpl_filter; binlog_filter= new Rpl_filter; - if (!global_rpl_filter || !binlog_filter) + parallel_filter= new Rpl_filter; + if (!global_rpl_filter || !binlog_filter || !parallel_filter) { sql_perror("Could not allocate replication and binlog filters"); exit(1); @@ -5952,6 +5957,7 @@ int mysqld_main(int argc, char **argv) /* Copy default global rpl_filter to global_rpl_filter */ copy_filter_setting(global_rpl_filter, get_or_create_rpl_filter("", 0)); + copy_filter_setting(parallel_filter, get_or_create_rpl_filter("", 0)); /* init_slave() must be called after the thread keys are created. |
