1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-27 05:41:41 +03:00
Files
mariadb/mysql-test/suite/galera/t/MDEV-27862.test
Jan Lindström 28eaf66e18 MDEV-30388 : Assertion `!wsrep_has_changes(thd) || (thd->lex->sql_command == SQLCOM_CREATE_TABLE && !thd->is_current_stmt_binlog_format_row()) || thd->wsrep_cs().transaction().state() == wsrep::transaction::s_aborted' failed
Problem for Galera is the fact that sequences are not really
transactional. Sequence operation is committed immediately
in sql_sequence.cd and later Galera could find out that
we have changes but actual statement is not there anymore.

Therefore, we must make some restrictions what kind
of sequences Galera can support.

(1) Galera cluster supports only sequences implemented
by InnoDB storage engine. This is because Galera replication
supports currently only InnoDB.

(2) We do not allow LOCK TABLE on sequence object and
we do not allow sequence creation under LOCK TABLE, instead
lock is released and we issue warning.

(3) We allow sequences with NOCACHE definition or with
INCREMEMENT BY 0 CACHE=n definition. This makes sure that
sequence values are unique accross Galera cluster.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-05-11 14:34:03 +02:00

57 lines
849 B
Plaintext

--source include/galera_cluster.inc
--source include/have_innodb.inc
# NEXTVAL
--connection node_1
CREATE SEQUENCE seq NOCACHE ENGINE=InnoDB;
SELECT NEXTVAL(seq) = 1;
--connection node_2
SELECT NEXTVAL(seq) = 2;
--connection node_1
SELECT NEXTVAL(seq) = 3;
# SETVAL
SELECT SETVAL(seq, 100);
--connection node_2
SELECT NEXTVAL(seq) = 101;
--connection node_1
SELECT NEXTVAL(seq) = 102;
DROP SEQUENCE seq;
# TRANSACTIONS
CREATE TABLE t1(f1 INT);
CREATE SEQUENCE seq_transaction NOCACHE ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO t1 VALUES (0);
SELECT NEXTVAL(seq_transaction);
INSERT INTO t1 VALUES (NEXTVAL(seq_transaction));
COMMIT;
--connection node_2
SELECT COUNT(*) = 2 FROM t1;
SELECT NEXTVAL(seq_transaction) = 3;
--connection node_1
SELECT NEXTVAL(seq_transaction) = 4;
DROP SEQUENCE seq_transaction;
DROP TABLE t1;