diff options
-rw-r--r-- | mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result | 9 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test | 10 | ||||
-rw-r--r-- | sql/sql_base.cc | 24 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 |
4 files changed, 39 insertions, 8 deletions
diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result index 73a0576048b..22ba4ca8767 100644 --- a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result +++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result @@ -74,5 +74,14 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY' COMMIT; DROP TABLE t1; DROP TABLE t2; +# +# MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO +# +CREATE TABLE t1 (i INT) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +SELECT * FROM t1; +i +1 +DROP TABLE t1; SET GLOBAL wsrep_replicate_myisam = 0; SET GLOBAL wsrep_replicate_myisam = 0; diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test index 9cb0edf1810..90c786f0af0 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test @@ -132,6 +132,16 @@ COMMIT; DROP TABLE t1; DROP TABLE t2; +--echo # +--echo # MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO +--echo # +--connection node_1 +CREATE TABLE t1 (i INT) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +# This command should not get replicated. +SELECT * FROM t1; +DROP TABLE t1; + --connection node_1 --eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f04bece86d2..e3f755be7ae 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4731,14 +4731,22 @@ restart: } } - if (WSREP_ON && - wsrep_replicate_myisam && - (*start) && - (*start)->table && - (*start)->table->file->ht == myisam_hton && - !is_stat_table((*start)->db, (*start)->alias) && - sqlcom_can_generate_row_events(thd) && - thd->get_command() != COM_STMT_PREPARE) + if (WSREP_ON && + wsrep_replicate_myisam && + (*start) && + (*start)->table && + (*start)->table->file->ht == myisam_hton && + wsrep_thd_exec_mode(thd) == LOCAL_STATE && + !is_stat_table((*start)->db, (*start)->alias) && + thd->get_command() != COM_STMT_PREPARE && + ((thd->lex->sql_command == SQLCOM_INSERT || + thd->lex->sql_command == SQLCOM_INSERT_SELECT || + thd->lex->sql_command == SQLCOM_REPLACE || + thd->lex->sql_command == SQLCOM_REPLACE_SELECT || + thd->lex->sql_command == SQLCOM_UPDATE || + thd->lex->sql_command == SQLCOM_UPDATE_MULTI || + thd->lex->sql_command == SQLCOM_LOAD || + thd->lex->sql_command == SQLCOM_DELETE))) { WSREP_TO_ISOLATION_BEGIN(NULL, NULL, (*start)); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e37a4b9ccc1..5169b7c5573 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2941,6 +2941,10 @@ mysql_execute_command(THD *thd) case SQLCOM_SHOW_STORAGE_ENGINES: case SQLCOM_SHOW_PROFILE: { +#ifdef WITH_WSREP + DBUG_ASSERT(thd->wsrep_exec_mode != REPL_RECV); +#endif /* WITH_WSREP */ + thd->status_var.last_query_cost= 0.0; /* |