[Commits] 7525e19: MDEV-12179: Per-engine mysql.gtid_slave_pos table

Kristian Nielsen knielsen at knielsen-hq.org
Mon Mar 20 14:30:39 EET 2017


revision-id: 7525e1940ccec3ea3a19d07a8107d2e85fc3a0a1 (mariadb-10.1.21-8-g7525e19)
parent(s): 9b5077bd25a6c0c5ed16adba7aa375e25fa94427
author: Kristian Nielsen
committer: Kristian Nielsen
timestamp: 2017-03-20 13:29:37 +0100
message:

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).

---
 mysql-test/suite/rpl/r/rpl_mdev12179.result |  6 ++++++
 mysql-test/suite/rpl/t/rpl_mdev12179.test   |  7 ++++++-
 sql/mysqld.cc                               | 31 +++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/mysql-test/suite/rpl/r/rpl_mdev12179.result b/mysql-test/suite/rpl/r/rpl_mdev12179.result
index 17ae007..c7a791f 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 a85195e..a4b344d 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 af0c857..389e670 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4833,6 +4833,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");
@@ -5256,6 +5276,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)
   {
@@ -7296,6 +7319,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,


More information about the commits mailing list