Debian Codegraph @

mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split_no_primary.test

raw
1 #
2 # This test verifies that an orphaned SR gets cleanup upon cluster
3 # reconnection. Specifically, the case where the cluster goes through
4 # a state of no primary components, and the nodes rejoin with the
5 # same IDs.
6 #
7
8 --source include/galera_cluster.inc
9
10 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
11 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
12 --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
13 --connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3
14
15 # Save original auto_increment_offset values.
16 --let $node_1=node_1
17 --let $node_2=node_2
18 --let $node_3=node_3
19 --source ../galera/include/auto_increment_offset_save.inc
20
21 --connection node_1
22 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
23 SET SESSION wsrep_trx_fragment_size=1;
24 BEGIN;
25 INSERT INTO t1 VALUES (11);
26 INSERT INTO t1 VALUES (12);
27
28 --connection node_2
29 SET SESSION wsrep_trx_fragment_size=1;
30 BEGIN;
31 INSERT INTO t1 VALUES (21);
32 INSERT INTO t1 VALUES (22);
33
34 --connection node_3
35 SET SESSION wsrep_trx_fragment_size=1;
36 BEGIN;
37 INSERT INTO t1 VALUES (31);
38 INSERT INTO t1 VALUES (32);
39
40 --connection node_2a
41 SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
42
43 --connection node_3a
44 SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
45
46 --connection node_1a
47 # wait until cluster is partitioned
48 SET SESSION wsrep_sync_wait = 0;
49 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
50 --source include/wait_condition.inc
51 SHOW STATUS LIKE 'wsrep_cluster_status';
52 SET SESSION wsrep_sync_wait = DEFAULT;
53
54 --connection node_2a
55 # wait until cluster is partitioned
56 SET SESSION wsrep_sync_wait = 0;
57 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
58 --source include/wait_condition.inc
59 SHOW STATUS LIKE 'wsrep_cluster_status';
60 SET SESSION wsrep_sync_wait = DEFAULT;
61
62 --connection node_3a
63 # wait until cluster is partitioned
64 SET SESSION wsrep_sync_wait = 0;
65 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
66 --source include/wait_condition.inc
67 SHOW STATUS LIKE 'wsrep_cluster_status';
68 SET SESSION wsrep_sync_wait = DEFAULT;
69
70 --connection node_2a
71 # reconnect node 2
72 SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
73
74 --connection node_3a
75 # reconnect node 3
76 SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
77
78 # wait for the cluster to whole again
79 --connection node_1a
80 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
81 --source include/wait_condition.inc
82 --source include/galera_wait_ready.inc
83
84 --connection node_2a
85 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
86 --source include/wait_condition.inc
87 --source include/galera_wait_ready.inc
88
89 --connection node_3a
90 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
91 --source include/wait_condition.inc
92 --source include/galera_wait_ready.inc
93
94 --connection node_1a
95 # check that the streaming log has been cleared and there are no locks
96 # from the SRs by issuing conflicting inserts
97 SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log;
98 INSERT INTO t1 VALUES(11);
99 INSERT INTO t1 VALUES(21);
100 INSERT INTO t1 VALUES(31);
101 SELECT * FROM t1;
102
103 --connection node_2a
104 SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log;
105 --connection node_3a
106 SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log;
107
108
109 # check that all 3 SRs have been rolled back
110 --connection node_1
111 --error ER_LOCK_DEADLOCK
112 INSERT INTO t1 VALUES(103);
113
114 --connection node_2
115 --error ER_LOCK_DEADLOCK
116 INSERT INTO t1 VALUES(203);
117
118 --connection node_3
119 --error ER_LOCK_DEADLOCK
120 INSERT INTO t1 VALUES(303);
121
122 --connection node_1
123 DROP TABLE t1;
124
125 # Restore original auto_increment_offset values.
126 --source ../galera/include/auto_increment_offset_restore.inc