Skip to content

Commit

Permalink
MDEV-12179: Per-engine mysql.gtid_slave_pos table
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
knielsen committed Apr 21, 2017
1 parent 363d6a1 commit 8bc1632
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
6 changes: 6 additions & 0 deletions mysql-test/suite/rpl/r/rpl_mdev12179.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion mysql-test/suite/rpl/t/rpl_mdev12179.test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
31 changes: 31 additions & 0 deletions sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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",
&gtid_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,
Expand Down

0 comments on commit 8bc1632

Please sign in to comment.