blob: 25b7bc6cfd26ac6d9dfc9cff8d389564c9d33c93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
connection node_2;
connection node_1;
CREATE SEQUENCE seq_nocache ENGINE=InnoDB;
DROP SEQUENCE seq_nocache;
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
connection node_2;
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
connection node_1;
CREATE SEQUENCE seq NOCACHE ENGINE=InnoDB;
SELECT NEXTVAL(seq) = 1;
NEXTVAL(seq) = 1
1
connection node_2;
SELECT NEXTVAL(seq) = 2;
NEXTVAL(seq) = 2
1
connection node_1;
SELECT NEXTVAL(seq) = 3;
NEXTVAL(seq) = 3
1
SELECT SETVAL(seq, 100);
SETVAL(seq, 100)
100
connection node_2;
SELECT NEXTVAL(seq) = 101;
NEXTVAL(seq) = 101
1
connection node_1;
SELECT NEXTVAL(seq) = 102;
NEXTVAL(seq) = 102
1
DROP SEQUENCE seq;
CREATE TABLE t1(f1 INT);
CREATE SEQUENCE seq_transaction NOCACHE ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO t1 VALUES (0);
SELECT NEXTVAL(seq_transaction);
NEXTVAL(seq_transaction)
1
INSERT INTO t1 VALUES (NEXTVAL(seq_transaction));
COMMIT;
connection node_2;
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
SELECT NEXTVAL(seq_transaction) = 3;
NEXTVAL(seq_transaction) = 3
1
connection node_1;
SELECT NEXTVAL(seq_transaction) = 4;
NEXTVAL(seq_transaction) = 4
1
DROP SEQUENCE seq_transaction;
DROP TABLE t1;
|