Debian Codegraph @

mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test

raw
1 #
2 # Test the operation of wsrep_auto_increment_control = ON
3 #
4
5 --source include/galera_cluster.inc
6 --source include/have_innodb.inc
7
8 --connection node_1
9
10 CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB;
11
12 --let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`
13 # auto_increment_increment is equal to the number of nodes
14 SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
15
16 --connection node_2
17 --disable_query_log
18 --eval SELECT @@global.auto_increment_offset != $auto_increment_offset_node_1 AS auto_increment_offset_differ;
19 --enable_query_log
20
21 # Expect no conflicts
22 --connection node_1
23 --send INSERT INTO t1 VALUES (DEFAULT, 'node1');
24
25 --connection node_2
26 --send INSERT INTO t1 VALUES (DEFAULT, 'node2');
27
28 --connection node_1
29 --reap
30
31 --connection node_2
32 --reap
33
34 --let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`
35 # auto_increment_increment is equal to the number of nodes
36 SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
37
38 --connection node_1
39 --disable_query_log
40 --eval SELECT @@global.auto_increment_offset != $auto_increment_offset_node_2 AS auto_increment_offset_differ;
41 --enable_query_log
42
43
44 # Expect no conflicts
45 --connection node_2
46 --send INSERT INTO t1 VALUES (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2');
47
48 --connection node_1
49 --send INSERT INTO t1 VALUES (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1');
50
51 --connection node_2
52 --reap
53
54 --connection node_1
55 --reap
56
57 --connection node_2
58 SELECT COUNT(*) = 22 FROM t1;
59 SELECT COUNT(DISTINCT f1) = 22 FROM t1;
60
61 --connection node_1
62 SELECT COUNT(*) = 22 FROM t1;
63 SELECT COUNT(DISTINCT f1) = 22 FROM t1;
64
65 DROP TABLE t1;