Commit b800264e authored by Nirbhay Choubey's avatar Nirbhay Choubey

MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated

... using TO

Fixed the 'wsrep_replicate_myisam' check to allow only limited
set of commands. Added a debug assert to discover such cases.
parent d51e7f90
...@@ -94,6 +94,16 @@ connection node_1; ...@@ -94,6 +94,16 @@ connection node_1;
COMMIT; COMMIT;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
#
# MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO
#
connection node_1;
CREATE TABLE t1 (i INT) ENGINE=INNODB;
INSERT INTO t1 VALUES(1);
SELECT * FROM t1;
i
1
DROP TABLE t1;
connection node_1; connection node_1;
SET GLOBAL wsrep_replicate_myisam = 0; SET GLOBAL wsrep_replicate_myisam = 0;
connection node_2; connection node_2;
......
...@@ -132,6 +132,16 @@ COMMIT; ...@@ -132,6 +132,16 @@ COMMIT;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; 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 --connection node_1
--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig --eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig
......
...@@ -4063,14 +4063,22 @@ bool open_tables(THD *thd, const DDL_options_st &options, ...@@ -4063,14 +4063,22 @@ bool open_tables(THD *thd, const DDL_options_st &options,
} }
} }
if (WSREP_ON && if (WSREP_ON &&
wsrep_replicate_myisam && wsrep_replicate_myisam &&
(*start) && (*start) &&
(*start)->table && (*start)->table &&
(*start)->table->file->ht == myisam_hton && (*start)->table->file->ht == myisam_hton &&
!is_stat_table((*start)->db, (*start)->alias) && wsrep_thd_exec_mode(thd) == LOCAL_STATE &&
sqlcom_can_generate_row_events(thd) && !is_stat_table((*start)->db, (*start)->alias) &&
thd->get_command() != COM_STMT_PREPARE) 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)); WSREP_TO_ISOLATION_BEGIN(NULL, NULL, (*start));
} }
......
...@@ -3350,6 +3350,10 @@ mysql_execute_command(THD *thd) ...@@ -3350,6 +3350,10 @@ mysql_execute_command(THD *thd)
case SQLCOM_SHOW_STORAGE_ENGINES: case SQLCOM_SHOW_STORAGE_ENGINES:
case SQLCOM_SHOW_PROFILE: 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; thd->status_var.last_query_cost= 0.0;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment