[Commits] d146605: MDEV-7673: CREATE TABLE SELECT fails on Galera cluster

Nirbhay Choubey nirbhay at mariadb.com
Fri Mar 6 20:22:15 EET 2015


revision-id: d146605124a3d326f3769fd162e0af0a124266a9
parent(s): c6acdf7c281f91026cfac549d718511b9ed083aa
committer: Nirbhay Choubey
branch nick: 10.0-galera
timestamp: 2015-03-06 13:22:15 -0500
message:

MDEV-7673: CREATE TABLE SELECT fails on Galera cluster

Enable execution of CREATE TABLE SELECT in total order isolation. Added
a test case.

Contributed by : Andrew W Elble

---
 mysql-test/suite/galera/r/create.result | 5 +++++
 mysql-test/suite/galera/t/create.test   | 8 ++++++++
 sql/sql_parse.cc                        | 8 ++++++++
 3 files changed, 21 insertions(+)

diff --git a/mysql-test/suite/galera/r/create.result b/mysql-test/suite/galera/r/create.result
index 4dffe96..2c31ed7 100644
--- a/mysql-test/suite/galera/r/create.result
+++ b/mysql-test/suite/galera/r/create.result
@@ -20,4 +20,9 @@ i
 1
 DROP TABLE t1;
 SET @@GLOBAL.wsrep_forced_binlog_format=@wsrep_forced_binlog_format_saved;
+#
+# MDEV-7673: CREATE TABLE SELECT fails on Galera cluster
+#
+CREATE TABLE t1 (i INT) ENGINE=INNODB DEFAULT CHARSET=utf8 SELECT 1 as i;
+DROP TABLE t1;
 # End of tests
diff --git a/mysql-test/suite/galera/t/create.test b/mysql-test/suite/galera/t/create.test
index b56a841..38c793e 100644
--- a/mysql-test/suite/galera/t/create.test
+++ b/mysql-test/suite/galera/t/create.test
@@ -22,5 +22,13 @@ SELECT * FROM t1_temp;
 DROP TABLE t1;
 SET @@GLOBAL.wsrep_forced_binlog_format=@wsrep_forced_binlog_format_saved;
 
+--echo #
+--echo # MDEV-7673: CREATE TABLE SELECT fails on Galera cluster
+--echo #
+CREATE TABLE t1 (i INT) ENGINE=INNODB DEFAULT CHARSET=utf8 SELECT 1 as i;
+
+# Cleanup
+DROP TABLE t1;
+
 --echo # End of tests
 
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 280c220..9b7ea77 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3284,6 +3284,14 @@ static bool wsrep_is_show_query(enum enum_sql_command command)
         /* Store reference to table in case of LOCK TABLES */
         create_info.table= create_table->table;
 
+#ifdef WITH_WSREP
+        if (WSREP(thd) &&
+            (!thd->is_current_stmt_binlog_format_row() ||
+             !(create_info.tmp_table())))
+          WSREP_TO_ISOLATION_BEGIN(create_table->db, create_table->table_name,
+                                   NULL)
+#endif
+
         /*
           select_create is currently not re-execution friendly and
           needs to be created for every execution of a PS/SP.


More information about the commits mailing list