Debian Codegraph @

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

raw
1 #
2 # Test that even after multiple restarts in a WAN context with two segments, the cluster continues to operate correctly.
3 #
4 # We can not easily restart the first node, so instead we restart all the other nodes. MTR does not allow multiple nodes
5 # to be down at the same time, so restarts are sequential.
6 #
7 # We can not test any of the actual WAN optimizations from inside MTR and no
8 # status variables are provided. So we only check that simple replication works.
9 #
10
11 --source include/big_test.inc
12 --source include/galera_cluster.inc
13 --source include/force_restart.inc
14
15 --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
16 --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
17
18 --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
19 --source include/wait_condition.inc
20
21 # Save original auto_increment_offset values.
22 --let $node_1=node_1
23 --let $node_2=node_2
24 --let $node_3=node_3
25 --let $node_4=node_4
26 --source include/auto_increment_offset_save.inc
27
28 SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
29
30 --connection node_1
31 CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB;
32 INSERT INTO t1 VALUES (1);
33
34 --connection node_2
35 INSERT INTO t1 VALUES (2);
36
37 --connection node_3
38 INSERT INTO t1 VALUES (3);
39
40 --connection node_4
41 INSERT INTO t1 VALUES (4);
42
43 #
44 # Restart node #3
45 #
46
47 --connection node_3
48 INSERT INTO t1 VALUES (13);
49
50 --echo Shutting down server ...
51 --source include/shutdown_mysqld.inc
52
53
54 --connection node_1
55 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
56 --source include/wait_condition.inc
57 SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
58
59 INSERT INTO t1 VALUES (11);
60
61 --connection node_2
62 INSERT INTO t1 VALUES (12);
63
64 --connection node_4
65 INSERT INTO t1 VALUES (14);
66
67 --connection node_3
68 --source include/start_mysqld.inc
69 --source include/wait_until_connected_again.inc
70
71 --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
72 --source include/wait_condition.inc
73 SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
74
75 INSERT INTO t1 VALUES (131);
76
77 #
78 # Restart node #2
79 #
80
81 --connection node_2
82 INSERT INTO t1 VALUES (22);
83
84 --echo Shutting down server ...
85 --source include/shutdown_mysqld.inc
86
87 --connection node_1
88 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
89 --source include/wait_condition.inc
90 SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
91
92 INSERT INTO t1 VALUES (21);
93
94 --connection node_3
95 INSERT INTO t1 VALUES (23);
96
97 --connection node_4
98 INSERT INTO t1 VALUES (24);
99
100 --connection node_2
101 --source include/start_mysqld.inc
102 --source include/wait_until_connected_again.inc
103
104 --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
105 --source include/wait_condition.inc
106 SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
107
108 INSERT INTO t1 VALUES (221);
109
110 #
111 # Restart node #4
112 #
113
114 --connection node_4
115 INSERT INTO t1 VALUES (34);
116
117 --echo Shutting down server ...
118 --source include/shutdown_mysqld.inc
119
120 --connection node_1
121 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
122 --source include/wait_condition.inc
123 SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
124
125 INSERT INTO t1 VALUES (31);
126
127 --connection node_2
128 INSERT INTO t1 VALUES (32);
129
130 --connection node_3
131 INSERT INTO t1 VALUES (33);
132
133 --connection node_4
134 --source include/start_mysqld.inc
135 --source include/wait_until_connected_again.inc
136
137 --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
138 --source include/wait_condition.inc
139 SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
140
141 INSERT INTO t1 VALUES (341);
142
143
144 #
145 # Check all nodes
146 #
147
148 --connection node_1
149 --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
150 --source include/wait_condition.inc
151 --let $wait_condition = SELECT COUNT(*) = 19 FROM t1
152 --source include/wait_condition.inc
153
154 SELECT COUNT(*) AS EXPECT_19 FROM t1;
155
156 --connection node_2
157 --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
158 --source include/wait_condition.inc
159 SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
160
161 --let $wait_condition = SELECT COUNT(*) = 19 FROM t1
162 --source include/wait_condition.inc
163
164 SELECT COUNT(*) AS EXPECT_19 FROM t1;
165
166
167 --connection node_3
168 --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
169 --source include/wait_condition.inc
170 SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
171
172 --let $wait_condition = SELECT COUNT(*) = 19 FROM t1
173 --source include/wait_condition.inc
174
175 SELECT COUNT(*) AS EXPECT_19 FROM t1;
176
177 --connection node_4
178 --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
179 --source include/wait_condition.inc
180 SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
181
182 --let $wait_condition = SELECT COUNT(*) = 19 FROM t1
183 --source include/wait_condition.inc
184
185 SELECT COUNT(*) AS EXPECT_19 FROM t1;
186
187
188 --connection node_1
189 DROP TABLE t1;
190 CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
191
192 --connection node_2
193 CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
194
195 --connection node_3
196 CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
197 CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
198
199 --connection node_4
200 CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
201
202 # Restore original auto_increment_offset values.
203 --source include/auto_increment_offset_restore.inc
204
205 --connection node_1
206 --disconnect node_3
207 --disconnect node_4