Commit f83b7ae1 authored by Jan Lindström's avatar Jan Lindström Committed by Julius Goryavsky

MDEV-26175 : Assertion `! thd->in_sub_stmt' failed in bool trans_rollback_stmt(THD*)

If we are inside stored function or trigger we should not commit
or rollback current statement transaction.
Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
parent 4daea2f8
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;
--source include/galera_cluster.inc
--source include/have_innodb.inc
#
# MDEV-19353 : Alter Sequence do not replicate to another nodes with in Galera Cluster
......
--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;
......@@ -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);
}
......
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