Commit 8bc1632e authored by Kristian Nielsen's avatar Kristian Nielsen

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).
parent 363d6a16
...@@ -64,6 +64,12 @@ a ...@@ -64,6 +64,12 @@ a
1 1
2 2
3 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; SET sql_log_bin=0;
DROP TABLE mysql.gtid_slave_pos_innodb; DROP TABLE mysql.gtid_slave_pos_innodb;
SET sql_log_bin=1; SET sql_log_bin=1;
......
...@@ -62,8 +62,9 @@ SELECT * FROM t1 ORDER BY a; ...@@ -62,8 +62,9 @@ SELECT * FROM t1 ORDER BY a;
--source include/save_master_gtid.inc --source include/save_master_gtid.inc
# Let the slave mysqld server start again. # 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 --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 EOF
--connection server_2 --connection server_2
...@@ -73,6 +74,10 @@ EOF ...@@ -73,6 +74,10 @@ EOF
--source include/sync_with_master_gtid.inc --source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a; 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 --connection server_2
SET sql_log_bin=0; SET sql_log_bin=0;
......
...@@ -4917,6 +4917,26 @@ static int init_default_storage_engine_impl(const char *opt_name, ...@@ -4917,6 +4917,26 @@ static int init_default_storage_engine_impl(const char *opt_name,
return 0; 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() static int init_server_components()
{ {
DBUG_ENTER("init_server_components"); DBUG_ENTER("init_server_components");
...@@ -5354,6 +5374,9 @@ static int init_server_components() ...@@ -5354,6 +5374,9 @@ static int init_server_components()
if (init_default_storage_engine(enforced_storage_engine, enforced_table_plugin)) if (init_default_storage_engine(enforced_storage_engine, enforced_table_plugin))
unireg_abort(1); unireg_abort(1);
if (init_gtid_pos_auto_engines())
unireg_abort(1);
#ifdef USE_ARIA_FOR_TMP_TABLES #ifdef USE_ARIA_FOR_TMP_TABLES
if (!ha_storage_engine_is_enabled(maria_hton) && !opt_bootstrap) if (!ha_storage_engine_is_enabled(maria_hton) && !opt_bootstrap)
{ {
...@@ -7354,6 +7377,14 @@ struct my_option my_long_options[]= ...@@ -7354,6 +7377,14 @@ struct my_option my_long_options[]=
"Set up signals usable for debugging. Deprecated, use --debug-gdb instead.", "Set up signals usable for debugging. Deprecated, use --debug-gdb instead.",
&opt_debugging, &opt_debugging, &opt_debugging, &opt_debugging,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 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",
&gtid_pos_auto_engines, 0, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0 },
#ifdef HAVE_LARGE_PAGE_OPTION #ifdef HAVE_LARGE_PAGE_OPTION
{"super-large-pages", 0, "Enable support for super large pages.", {"super-large-pages", 0, "Enable support for super large pages.",
&opt_super_large_pages, &opt_super_large_pages, 0, &opt_super_large_pages, &opt_super_large_pages, 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment