diff options
author | Kristian Nielsen <knielsen@knielsen-hq.org> | 2017-03-20 13:29:37 +0100 |
---|---|---|
committer | Kristian Nielsen <knielsen@knielsen-hq.org> | 2017-04-21 10:30:15 +0200 |
commit | 8bc1632ea54624b6bdb4aac692147603e734e9c5 (patch) | |
tree | f5c7094fb227ffc378ef577015b84b2fc6aefc9f | |
parent | 363d6a16ae3469496e9f17eab168c5b14fad7203 (diff) | |
download | mariadb-git-8bc1632ea54624b6bdb4aac692147603e734e9c5.tar.gz |
MDEV-12179: Per-engine mysql.gtid_slave_pos table
Intermediate commit.
Implement the command-line part of --gtid-pos-auto-engines.
(The option is still not actually used for anything, this will be for
a later commit).
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_mdev12179.result | 6 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_mdev12179.test | 7 | ||||
-rw-r--r-- | sql/mysqld.cc | 31 |
3 files changed, 43 insertions, 1 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_mdev12179.result b/mysql-test/suite/rpl/r/rpl_mdev12179.result index 17ae0074046..c7a791faeb6 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev12179.result +++ b/mysql-test/suite/rpl/r/rpl_mdev12179.result @@ -64,6 +64,12 @@ a 1 2 3 +SELECT @@gtid_pos_auto_engines; +@@gtid_pos_auto_engines +InnoDB,MyISAM +include/stop_slave.inc +SET GLOBAL gtid_pos_auto_engines=""; +include/start_slave.inc SET sql_log_bin=0; DROP TABLE mysql.gtid_slave_pos_innodb; SET sql_log_bin=1; diff --git a/mysql-test/suite/rpl/t/rpl_mdev12179.test b/mysql-test/suite/rpl/t/rpl_mdev12179.test index a85195eb6b4..a4b344de3f1 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev12179.test +++ b/mysql-test/suite/rpl/t/rpl_mdev12179.test @@ -62,8 +62,9 @@ SELECT * FROM t1 ORDER BY a; --source include/save_master_gtid.inc # Let the slave mysqld server start again. +# As we are restarting, also take the opportunity to test --gtid-pos-auto-engines --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect -restart: --skip-slave-start=0 +restart: --skip-slave-start=0 --gtid-pos-auto-engines=innodb,myisam EOF --connection server_2 @@ -73,6 +74,10 @@ EOF --source include/sync_with_master_gtid.inc SELECT * FROM t1 ORDER BY a; +SELECT @@gtid_pos_auto_engines; +--source include/stop_slave.inc +SET GLOBAL gtid_pos_auto_engines=""; +--source include/start_slave.inc --connection server_2 SET sql_log_bin=0; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3c3acdf6030..e43b074a018 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4917,6 +4917,26 @@ static int init_default_storage_engine_impl(const char *opt_name, return 0; } + +static int +init_gtid_pos_auto_engines(void) +{ + plugin_ref *plugins; + + if (gtid_pos_auto_engines) + plugins= resolve_engine_list(gtid_pos_auto_engines, + strlen(gtid_pos_auto_engines)); + else + plugins= resolve_engine_list("", 0); + if (!plugins) + return 1; + mysql_mutex_lock(&LOCK_global_system_variables); + opt_gtid_pos_auto_plugins= plugins; + mysql_mutex_unlock(&LOCK_global_system_variables); + return 0; +} + + static int init_server_components() { DBUG_ENTER("init_server_components"); @@ -5354,6 +5374,9 @@ static int init_server_components() if (init_default_storage_engine(enforced_storage_engine, enforced_table_plugin)) unireg_abort(1); + if (init_gtid_pos_auto_engines()) + unireg_abort(1); + #ifdef USE_ARIA_FOR_TMP_TABLES if (!ha_storage_engine_is_enabled(maria_hton) && !opt_bootstrap) { @@ -7354,6 +7377,14 @@ struct my_option my_long_options[]= "Set up signals usable for debugging. Deprecated, use --debug-gdb instead.", &opt_debugging, &opt_debugging, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"gtid-pos-auto-engines", 0, + "List of engines for which to automatically create a " + "mysql.gtid_slave_pos_ENGINE table, if a transaction using that engine " + "is replicated. This can be used to avoid introducing cross-engine " + "transactions, if engines are used different from that used by table " + "mysql.gtid_slave_pos", + >id_pos_auto_engines, 0, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0 }, #ifdef HAVE_LARGE_PAGE_OPTION {"super-large-pages", 0, "Enable support for super large pages.", &opt_super_large_pages, &opt_super_large_pages, 0, |