Commit 48570eb6 authored by mkaruza's avatar mkaruza Committed by Jan Lindström

MDEV-18832 Galera: 10.4 node crashed with Assertion `state() == s_committing'...

MDEV-18832 Galera: 10.4 node crashed with Assertion `state() == s_committing' if you create SEQUENCE, use it, then drop and recreate and use again (#1339)

We could still end committing to binlog even in rollback.
Do not proceed with WSREP commit in this case.
parent e85e4814
connection node_2;
connection node_1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1;
CREATE TABLE t1 (Id int(11) NOT NULL, PRIMARY KEY (Id));
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
DROP SEQUENCE Seq1_1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1;
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
DROP SEQUENCE Seq1_1;
DROP TABLE t1;
!include ../galera_2nodes.cnf
[mysqld]
log-bin
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1;
CREATE TABLE t1 (Id int(11) NOT NULL, PRIMARY KEY (Id));
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
DROP SEQUENCE Seq1_1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
DROP SEQUENCE Seq1_1;
DROP TABLE t1;
......@@ -193,6 +193,8 @@ static inline bool wsrep_run_commit_hook(THD* thd, bool all)
wsrep_is_ordered(thd)));
/* Is MST commit or autocommit? */
bool ret= wsrep_is_active(thd) && wsrep_is_real(thd, all);
/* Do not commit if we are aborting */
ret= ret && (thd->wsrep_trx().state() != wsrep::transaction::s_aborting);
if (ret && !(wsrep_has_changes(thd) || /* Has generated write set */
/* Is high priority (replay, applier, storage) and the
transaction is scheduled for commit ordering */
......
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