Skip to content

Commit

Permalink
MDEV-7673: CREATE TABLE SELECT fails on Galera cluster
Browse files Browse the repository at this point in the history
Enable execution of CREATE TABLE SELECT in total order isolation. Added
a test case.

Contributed by : Andrew W Elble
  • Loading branch information
Nirbhay Choubey committed Mar 6, 2015
1 parent c6acdf7 commit d146605
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mysql-test/suite/galera/r/create.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions mysql-test/suite/galera/t/create.test
Original file line number Diff line number Diff line change
Expand Up @@ -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

8 changes: 8 additions & 0 deletions sql/sql_parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3284,6 +3284,14 @@ case SQLCOM_PREPARE:
/* 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.
Expand Down

0 comments on commit d146605

Please sign in to comment.