Debian Codegraph @

mysql-test/suite/group_replication/t/gr_view_change_uuid.test

raw
1 ################################################################################
2 #
3 # Test validates that all members use same UUID on View log event configured on
4 # group_replication_view_change_uuid.
5 #
6 # Test:
7 # 0. This test requires 3 servers to create a Group Replication setup
8 # 1. Start server 1 and assert it only has one transaction
9 # 2. Start server 2 and assert it has two transactions
10 # 3. Confirm server 1 has same GTID_EXECUTED as server 2
11 # 4. Start server 3 and assert it has three transactions
12 # 5. Confirm server 1 has same GTID_EXECUTED than server 3
13 # 6. Confirm server 2 has same GTID_EXECUTED than server 3
14 # 7. Stop server 3 and assert it has three transactions
15 # 8. Stop server 2 and assert it has three transactions
16 # 9. Start server 2 and assert it has 4 transactions
17 # 10. Confirm server 1 has same GTID_EXECUTED as server 2
18 # 11. Start server 3 and assert it has 5 transactions
19 # 12. Confirm server 1 has same GTID_EXECUTED than server 3
20 # 13. Confirm server 2 has same GTID_EXECUTED than server 3
21 # 14. Cleanup
22 #
23 ################################################################################
24
25 --source include/have_group_replication_plugin.inc
26 --let $rpl_skip_group_replication_start= 1
27 --let $rpl_server_count= 3
28 --source include/group_replication.inc
29
30 --let $rpl_connection_name= server1
31 --source include/rpl_connection.inc
32
33 # Load GTID functions (GTID_IS_EQUAL)
34
35 SET sql_log_bin = 0;
36 --source include/gtid_utils.inc
37 SET sql_log_bin = 1;
38
39 --let $rpl_connection_name= server2
40 --source include/rpl_connection.inc
41
42 SET sql_log_bin = 0;
43 --source include/gtid_utils.inc
44 SET sql_log_bin = 1;
45
46 --let $rpl_connection_name= server3
47 --source include/rpl_connection.inc
48
49 SET sql_log_bin = 0;
50 --source include/gtid_utils.inc
51 SET sql_log_bin = 1;
52
53 --echo
54 --echo ############################################################
55 --echo # 1. Start server 1 and assert it only has one transaction
56
57 --let $rpl_connection_name= server1
58 --source include/rpl_connection.inc
59 SET @group_replication_view_change_uuid_save= @@GLOBAL.group_replication_view_change_uuid;
60 --let $view_change_uuid = c0dec0de-c0de-c0de-c0de-c0dec0dec0de
61
62 --eval SET GLOBAL group_replication_view_change_uuid = "$view_change_uuid"
63
64 --source include/start_and_bootstrap_group_replication.inc
65
66 --let $assert_text = GTID_EXECUTED must have one transaction of view change
67 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1")
68 --source include/assert.inc
69
70 --let $keep_gtid_events= 1
71 --source include/show_binlog_events.inc
72
73 --echo
74 --echo ############################################################
75 --echo # 2. Start server 2 and assert it has two transactions
76
77 --let $rpl_connection_name= server2
78 --source include/rpl_connection.inc
79
80 SET @group_replication_view_change_uuid_save= @@GLOBAL.group_replication_view_change_uuid;
81 --eval SET GLOBAL group_replication_view_change_uuid = "$view_change_uuid"
82
83 --source include/start_group_replication.inc
84
85 --let $assert_text = GTID_EXECUTED must have two transactions of view changes
86 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1-2")
87 --source include/assert.inc
88
89 --let $keep_gtid_events= 1
90 --source include/show_binlog_events.inc
91
92 --echo
93 --echo ############################################################
94 --echo # 3. Confirm server 1 has same GTID_EXECUTED as server 2
95
96 --let $rpl_connection_name= server1
97 --source include/rpl_connection.inc
98
99 --let $assert_text = GTID_EXECUTED must have two transactions of view changes
100 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1-2")
101 --source include/assert.inc
102
103 --let $keep_gtid_events= 1
104 --source include/show_binlog_events.inc
105
106 --echo
107 --echo ############################################################
108 --echo # 4. Start server 3 and assert it has three transactions
109
110 --let $rpl_connection_name= server3
111 --source include/rpl_connection.inc
112
113 SET @group_replication_view_change_uuid_save= @@GLOBAL.group_replication_view_change_uuid;
114 --eval SET GLOBAL group_replication_view_change_uuid = "$view_change_uuid"
115 --source include/start_group_replication.inc
116
117 --let $assert_text = GTID_EXECUTED must have three transactions of view changes
118 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1-3")
119 --source include/assert.inc
120
121 --let $keep_gtid_events= 1
122 --source include/show_binlog_events.inc
123
124 --echo
125 --echo ############################################################
126 --echo # 5. Confirm server 1 has same GTID_EXECUTED than server 3
127
128 --let $rpl_connection_name= server1
129 --source include/rpl_connection.inc
130
131 --let $assert_text = GTID_EXECUTED must have three transactions of view changes
132 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1-3")
133 --source include/assert.inc
134
135 --let $keep_gtid_events= 1
136 --source include/show_binlog_events.inc
137
138 --echo ############################################################
139 --echo # 6. Confirm server 2 has same GTID_EXECUTED than server 3
140
141 --let $rpl_connection_name= server2
142 --source include/rpl_connection.inc
143
144 --let $assert_text = GTID_EXECUTED must have three transactions of view changes
145 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1-3")
146 --source include/assert.inc
147
148 --let $keep_gtid_events= 1
149 --source include/show_binlog_events.inc
150
151 --echo
152 --echo ############################################################
153 --echo # 7. Stop server 3 and assert it has three transactions
154
155 --let $rpl_connection_name= server3
156 --source include/rpl_connection.inc
157
158 --source include/stop_group_replication.inc
159
160 --let $assert_text = GTID_EXECUTED must have three transactions of view changes
161 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1-3")
162 --source include/assert.inc
163
164 --let $keep_gtid_events= 1
165 --source include/show_binlog_events.inc
166
167 --echo
168 --echo ############################################################
169 --echo # 8. Stop server 2 and assert it has three transactions
170
171 --let $rpl_connection_name= server2
172 --source include/rpl_connection.inc
173
174 --source include/stop_group_replication.inc
175
176 --let $assert_text = GTID_EXECUTED must have three transactions of view changes
177 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1-3")
178 --source include/assert.inc
179
180 --let $keep_gtid_events= 1
181 --source include/show_binlog_events.inc
182
183 --echo
184 --echo ############################################################
185 --echo # 9. Start server 2 and assert it has 4 transactions
186
187 --let $rpl_connection_name= server2
188 --source include/rpl_connection.inc
189
190 --source include/start_group_replication.inc
191
192 --let $assert_text = GTID_EXECUTED must have four transactions of view changes
193 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1-4")
194 --source include/assert.inc
195
196 --let $keep_gtid_events= 1
197 --source include/show_binlog_events.inc
198
199 --echo
200 --echo ############################################################
201 --echo # 10. Confirm server 1 has same GTID_EXECUTED as server 2
202
203 --let $rpl_connection_name= server1
204 --source include/rpl_connection.inc
205
206 --let $assert_text = GTID_EXECUTED must have four transactions of view changes
207 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1-4")
208 --source include/assert.inc
209
210 --let $keep_gtid_events= 1
211 --source include/show_binlog_events.inc
212
213 --echo
214 --echo ############################################################
215 --echo # 11. Start server 3 and assert it has 5 transactions
216
217 --let $rpl_connection_name= server3
218 --source include/rpl_connection.inc
219
220 --source include/start_group_replication.inc
221
222 --let $assert_text = GTID_EXECUTED must have five transactions of view changes
223 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1-5")
224 --source include/assert.inc
225
226 --let $keep_gtid_events= 1
227 --source include/show_binlog_events.inc
228
229 --echo ############################################################
230 --echo # 12. Confirm server 1 has same GTID_EXECUTED than server 3
231
232 --let $rpl_connection_name= server1
233 --source include/rpl_connection.inc
234
235 --let $assert_text = GTID_EXECUTED must have five transactions of view changes
236 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1-5")
237 --source include/assert.inc
238
239 --let $keep_gtid_events= 1
240 --source include/show_binlog_events.inc
241
242 --echo ############################################################
243 --echo # 13. Confirm server 2 has same GTID_EXECUTED than server 3
244
245 --let $rpl_connection_name= server2
246 --source include/rpl_connection.inc
247
248 --let $assert_text = GTID_EXECUTED must have five transactions of view changes
249 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$view_change_uuid:1-5")
250 --source include/assert.inc
251
252 --let $keep_gtid_events= 1
253 --source include/show_binlog_events.inc
254
255
256 --echo
257 --echo ############################################################
258 --echo # 14. Cleanup
259
260 --let $rpl_connection_name= server1
261 --source include/rpl_connection.inc
262
263 SET sql_log_bin = 0;
264 --source include/gtid_utils_end.inc
265 SET sql_log_bin = 1;
266
267 --source include/stop_group_replication.inc
268 SET @@GLOBAL.group_replication_view_change_uuid= @group_replication_view_change_uuid_save;
269 SET GLOBAL group_replication_view_change_uuid = "AUTOMATIC";
270
271 --let $rpl_connection_name= server2
272 --source include/rpl_connection.inc
273
274 SET sql_log_bin = 0;
275 --source include/gtid_utils_end.inc
276 SET sql_log_bin = 1;
277
278 --source include/stop_group_replication.inc
279 SET @@GLOBAL.group_replication_view_change_uuid= @group_replication_view_change_uuid_save;
280
281 --let $rpl_connection_name= server3
282 --source include/rpl_connection.inc
283
284 SET sql_log_bin = 0;
285 --source include/gtid_utils_end.inc
286 SET sql_log_bin = 1;
287
288 --source include/stop_group_replication.inc
289 SET @@GLOBAL.group_replication_view_change_uuid= @group_replication_view_change_uuid_save;
290
291 --source include/group_replication_end.inc