diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2021-10-06 13:49:27 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2021-10-07 11:05:58 +0300 |
commit | d9b933bec6061758c5d7b34f55afcae32a85c110 (patch) | |
tree | f2b4302456eb929c6ba0f075eb612b5f6d004a9f | |
parent | 96b4a5a6484148778facf95cd8b2be17f47c4da7 (diff) | |
download | mariadb-git-d9b933bec6061758c5d7b34f55afcae32a85c110.tar.gz |
MDEV-24062 : Galera test failure on galera_var_replicate_myisam_on
We should do after_statement only for local transactions.
-rw-r--r-- | mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result | 15 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test | 16 | ||||
-rw-r--r-- | sql/wsrep_trans_observer.h | 9 |
3 files changed, 33 insertions, 7 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 ad28f5a426e..314da703e58 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 @@ -53,8 +53,8 @@ COUNT(*) = 0 1 DROP TABLE t1; connection node_1; -CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; -CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES (1); @@ -100,7 +100,7 @@ DROP TABLE t2; # MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO # connection node_1; -CREATE TABLE t1 (i INT) ENGINE=INNODB; +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES(1); SELECT * FROM t1; i @@ -237,5 +237,14 @@ DROP TRIGGER tr1; DROP TRIGGER tr2; DROP TRIGGER tr3; DROP TABLE t1,t2; +CREATE TABLE t1 (a INT, b INT, UNIQUE(a)) ENGINE=MyISAM; +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1; +SET GLOBAL wsrep_replicate_myisam=ON; +INSERT INTO t1 (a,b) VALUES (10,20); +connection node_2; +SELECT * from t1; +a b +1 20 connection node_1; +DROP TABLE t1; connection node_2; 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 adb5cb04273..acebe4cccdc 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 @@ -80,8 +80,8 @@ DROP TABLE t1; # --connection node_1 -CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; -CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES (1); @@ -136,7 +136,7 @@ DROP TABLE t2; --echo # MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO --echo # --connection node_1 -CREATE TABLE t1 (i INT) ENGINE=INNODB; +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES(1); # This command should not get replicated. SELECT * FROM t1; @@ -218,7 +218,16 @@ DROP TRIGGER tr2; DROP TRIGGER tr3; DROP TABLE t1,t2; +CREATE TABLE t1 (a INT, b INT, UNIQUE(a)) ENGINE=MyISAM; +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1; +SET GLOBAL wsrep_replicate_myisam=ON; +INSERT INTO t1 (a,b) VALUES (10,20); + +--connection node_2 +SELECT * from t1; --connection node_1 +DROP TABLE t1; + --disable_query_log --eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig --enable_query_log @@ -227,3 +236,4 @@ DROP TABLE t1,t2; --disable_query_log --eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig --enable_query_log + diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h index 8157c14fcdf..55beb6ebe7c 100644 --- a/sql/wsrep_trans_observer.h +++ b/sql/wsrep_trans_observer.h @@ -396,7 +396,14 @@ static inline int wsrep_after_statement(THD* thd) { DBUG_ENTER("wsrep_after_statement"); - DBUG_RETURN(thd->wsrep_cs().state() != wsrep::client_state::s_none ? + WSREP_DEBUG("wsrep_after_statement for %lu client_state %s " + " client_mode %s trans_state %s", + thd_get_thread_id(thd), + wsrep::to_c_string(thd->wsrep_cs().state()), + wsrep::to_c_string(thd->wsrep_cs().mode()), + wsrep::to_c_string(thd->wsrep_cs().transaction().state())); + DBUG_RETURN((thd->wsrep_cs().state() != wsrep::client_state::s_none && + thd->wsrep_cs().mode() == Wsrep_client_state::m_local) ? thd->wsrep_cs().after_statement() : 0); } |