Debian Codegraph @

mysql-test/suite/galera/t/galera_wan_restart_sst.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/have_innodb.inc
14 --source include/force_restart.inc
15
16 --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
17 --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
18
19 --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
20 --source include/wait_condition.inc
21
22 # Save original auto_increment_offset values.
23 --let $node_1=node_1
24 --let $node_2=node_2
25 --let $node_3=node_3
26 --let $node_4=node_4
27 --source include/auto_increment_offset_save.inc
28
29 SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
30
31 --connection node_1
32 CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB;
33 INSERT INTO t1 VALUES (1);
34
35 --connection node_2
36 INSERT INTO t1 VALUES (2);
37
38 --connection node_3
39 INSERT INTO t1 VALUES (3);
40
41 --connection node_4
42 INSERT INTO t1 VALUES (4);
43
44 #
45 # Restart node #3
46 #
47
48 --connection node_3
49 INSERT INTO t1 VALUES (13);
50 --let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
51 --source include/wait_condition.inc
52
53 --connection node_1
54 --let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
55 --source include/wait_condition.inc
56
57 --connection node_3
58 --source include/kill_galera.inc
59 --remove_file $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
60
61 --connection node_1
62 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
63 --source include/wait_condition.inc
64 INSERT INTO t1 VALUES (11);
65
66 --connection node_2
67 INSERT INTO t1 VALUES (12);
68
69 --connection node_4
70 INSERT INTO t1 VALUES (14);
71
72 --connection node_3
73 --source include/start_mysqld.inc
74
75 INSERT INTO t1 VALUES (131);
76
77 --connection node_1
78 --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
79 --source include/wait_condition.inc
80
81 #
82 # Restart node #2
83 #
84
85 --connection node_2
86 INSERT INTO t1 VALUES (22);
87
88 --connection node_1
89 --let $wait_condition = SELECT COUNT(*) = 10 FROM t1;
90 --source include/wait_condition.inc
91
92 --connection node_2
93 --source include/kill_galera.inc
94 --remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
95
96 --connection node_1
97 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
98 --source include/wait_condition.inc
99 INSERT INTO t1 VALUES (21);
100
101 --connection node_3
102 INSERT INTO t1 VALUES (23);
103
104 --connection node_4
105 INSERT INTO t1 VALUES (24);
106
107 --connection node_2
108 --source include/start_mysqld.inc
109
110 INSERT INTO t1 VALUES (221);
111
112 #
113 # Restart node #4
114 #
115
116 --connection node_4
117 --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
118 --source include/wait_condition.inc
119 INSERT INTO t1 VALUES (34);
120
121 --connection node_1
122 --let $wait_condition = SELECT COUNT(*) = 15 FROM t1;
123 --source include/wait_condition.inc
124
125 --connection node_4
126 --source include/kill_galera.inc
127 --remove_file $MYSQLTEST_VARDIR/mysqld.4/data/grastate.dat
128
129 --connection node_1
130 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
131 --source include/wait_condition.inc
132 INSERT INTO t1 VALUES (31);
133
134 --connection node_2
135 INSERT INTO t1 VALUES (32);
136
137 --connection node_3
138 INSERT INTO t1 VALUES (33);
139
140 --connection node_4
141 --source include/start_mysqld.inc
142 --remove_file $MYSQLTEST_VARDIR/mysqld.4/data/grastate.dat
143
144 INSERT INTO t1 VALUES (341);
145
146 #
147 # Check all nodes
148 #
149
150 --connection node_1
151 --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
152 --source include/wait_condition.inc
153
154 SELECT COUNT(*) AS EXPECT_19 FROM t1;
155
156 --connection node_2
157 SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
158 SELECT COUNT(*) AS EXPECT_19 FROM t1;
159
160 --connection node_3
161 SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
162 SELECT COUNT(*) AS EXPECT_19 FROM t1;
163
164 --connection node_4
165 SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
166 SELECT COUNT(*) AS EXPECT_19 FROM t1;
167
168 --connection node_1
169 DROP TABLE t1;
170 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");
171 CALL mtr.add_suppression("WSREP: gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)");
172
173 --connection node_2
174 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");
175 CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
176
177 --connection node_3
178 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");
179 CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
180
181 --connection node_4
182 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");
183 CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
184
185 # Restore original auto_increment_offset values.
186 --source include/auto_increment_offset_restore.inc
187
188 --connection node_1
189 --disconnect node_3
190 --disconnect node_4