diff options
-rw-r--r-- | mysql-test/suite/galera/r/mdev-26175.result | 24 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_sequences.test | 1 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/mdev-26175.test | 27 | ||||
-rw-r--r-- | sql/handler.cc | 8 |
4 files changed, 59 insertions, 1 deletions
diff --git a/mysql-test/suite/galera/r/mdev-26175.result b/mysql-test/suite/galera/r/mdev-26175.result new file mode 100644 index 00000000000..f84244fe916 --- /dev/null +++ b/mysql-test/suite/galera/r/mdev-26175.result @@ -0,0 +1,24 @@ +connection node_2; +connection node_1; +connection node_1; +SET sql_mode="no_zero_date"; +SET GLOBAL wsrep_max_ws_rows=1; +CREATE TABLE t2 (a INT); +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TRIGGER tgr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (0); +INSERT INTO t1 VALUES (0),(1); +ERROR HY000: wsrep_max_ws_rows exceeded +SELECT * FROM t1; +a +SELECT * FROM t2; +a +connection node_2; +SELECT * FROM t1; +a +SELECT * FROM t2; +a +connection node_1; +SET sql_mode=DEFAULT; +SET GLOBAL wsrep_max_ws_rows=DEFAULT; +DROP TRIGGER tgr; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test index faa3b46d2a7..613823d83e9 100644 --- a/mysql-test/suite/galera/t/galera_sequences.test +++ b/mysql-test/suite/galera/t/galera_sequences.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc # # MDEV-19353 : Alter Sequence do not replicate to another nodes with in Galera Cluster diff --git a/mysql-test/suite/galera/t/mdev-26175.test b/mysql-test/suite/galera/t/mdev-26175.test new file mode 100644 index 00000000000..1a3f1153e03 --- /dev/null +++ b/mysql-test/suite/galera/t/mdev-26175.test @@ -0,0 +1,27 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# MDEV-26175 : Assertion `! thd->in_sub_stmt' failed in bool trans_rollback_stmt(THD*) +# +--connection node_1 +SET sql_mode="no_zero_date"; +SET GLOBAL wsrep_max_ws_rows=1; +CREATE TABLE t2 (a INT); +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TRIGGER tgr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (0); + +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 VALUES (0),(1); +SELECT * FROM t1; +SELECT * FROM t2; + +--connection node_2 +SELECT * FROM t1; +SELECT * FROM t2; + +--connection node_1 +SET sql_mode=DEFAULT; +SET GLOBAL wsrep_max_ws_rows=DEFAULT; +DROP TRIGGER tgr; +DROP TABLE t1, t2; diff --git a/sql/handler.cc b/sql/handler.cc index 8ed8ee64880..7eaaaf63f00 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -6618,7 +6618,13 @@ static int wsrep_after_row(THD *thd) wsrep_thd_is_local(thd) && thd->wsrep_affected_rows > wsrep_max_ws_rows) { - trans_rollback_stmt(thd) || trans_rollback(thd); + /* + If we are inside stored function or trigger we should not commit or + rollback current statement transaction. See comment in ha_commit_trans() + call for more information. + */ + if (!thd->in_sub_stmt) + trans_rollback_stmt(thd) || trans_rollback(thd); my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0)); DBUG_RETURN(ER_ERROR_DURING_COMMIT); } |