diff options
-rw-r--r-- | mysql-test/suite/galera/r/create.result | 31 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/create.test | 24 | ||||
-rw-r--r-- | sql/mysqld.cc | 7 | ||||
-rw-r--r-- | sql/sql_parse.cc | 9 |
4 files changed, 61 insertions, 10 deletions
diff --git a/mysql-test/suite/galera/r/create.result b/mysql-test/suite/galera/r/create.result index 2c31ed76d1e..d32a0378eb6 100644 --- a/mysql-test/suite/galera/r/create.result +++ b/mysql-test/suite/galera/r/create.result @@ -24,5 +24,36 @@ 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; +SELECT * FROM t1; +i +1 +SELECT * FROM t1; +i +1 DROP TABLE t1; +# +# MDEV-8166 : Adding index on new table from select crashes Galera +# cluster +# +CREATE TABLE t1(i int(11) NOT NULL DEFAULT '0') ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO t1(i) VALUES (1), (2), (3); +CREATE TABLE t2 (i INT) SELECT i FROM t1; +ALTER TABLE t2 ADD INDEX idx(i); +SELECT * FROM t2; +i +1 +2 +3 +SELECT * FROM t2; +i +1 +2 +3 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `i` int(11) DEFAULT NULL, + KEY `idx` (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; # End of tests diff --git a/mysql-test/suite/galera/t/create.test b/mysql-test/suite/galera/t/create.test index 38c793e33b6..fb9b0935288 100644 --- a/mysql-test/suite/galera/t/create.test +++ b/mysql-test/suite/galera/t/create.test @@ -25,10 +25,34 @@ SET @@GLOBAL.wsrep_forced_binlog_format=@wsrep_forced_binlog_format_saved; --echo # --echo # MDEV-7673: CREATE TABLE SELECT fails on Galera cluster --echo # +--connection node_1 CREATE TABLE t1 (i INT) ENGINE=INNODB DEFAULT CHARSET=utf8 SELECT 1 as i; +SELECT * FROM t1; +--connection node_2 +SELECT * FROM t1; # Cleanup DROP TABLE t1; +--echo # +--echo # MDEV-8166 : Adding index on new table from select crashes Galera +--echo # cluster +--echo # +--connection node_1 +CREATE TABLE t1(i int(11) NOT NULL DEFAULT '0') ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO t1(i) VALUES (1), (2), (3); + +CREATE TABLE t2 (i INT) SELECT i FROM t1; +ALTER TABLE t2 ADD INDEX idx(i); + +SELECT * FROM t2; + +--connection node_2 +SELECT * FROM t2; +SHOW CREATE TABLE t2; + +# Cleanup +DROP TABLE t1, t2; + --echo # End of tests diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 338a15422ac..39f7e8062a3 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4966,8 +4966,6 @@ static int init_server_components() } #endif - DBUG_ASSERT(!opt_bin_log || opt_bin_logname); - if (opt_bin_log) { /* Reports an error and aborts, if the --log-bin's path @@ -5052,6 +5050,11 @@ static int init_server_components() { set_ports(); // this is also called in network_init() later but we need // to know mysqld_port now - lp:1071882 + /* + Plugin initialization (plugin_init()) hasn't happened yet, set + maria_hton to 0. + */ + maria_hton= 0; wsrep_init_startup(true); } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1b50a21472f..c561cc73707 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3301,17 +3301,10 @@ 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. + Note: In wsrep-patch, CTAS is handled like a regular transaction. */ if ((result= new select_create(create_table, &create_info, |