mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 02:30:06 +01:00
28eaf66e18
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>
14 lines
564 B
Text
14 lines
564 B
Text
connection node_2;
|
|
connection node_1;
|
|
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1 NOCACHE;
|
|
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 NOCACHE;
|
|
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
|
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
|
DROP SEQUENCE Seq1_1;
|
|
DROP TABLE t1;
|