Debian Codegraph @

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

raw
1 ################################################################################
2 # Verify performance_schema.replication_group_member_stats for new columns
3 #
4 # Test:
5 # 0. Start GR on two servers
6 # 1. With both members ONLINE. Execute some transactions on server1.
7 # 1A. Assert values are correct in table replication_group_member_stats.
8 # 2. Testing of column COUNT_TRANSACTIONS_LOCAL_ROLLBACK.
9 # 2A. Force negative certification outcome of the next transaction using DEBUG
10 # sync point.
11 # 2B. Assert values are correct in table replication_group_member_stats.
12 # 3. Testing of column COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE.
13 # 3A. Execute 10 transactions on M2 and block them before commiting.
14 # 3B. Assert values are correct in table replication_group_member_stats.
15 # 4. Assert values are correct in table replication_group_member_stats.
16 # 5. Clean up(debug flag and tables).
17 ################################################################################
18
19 --echo
20 --echo ############################################################
21 --echo # 0. Start GR on two servers
22 --echo ############################################################
23
24 --source include/big_test.inc
25 --source include/have_debug.inc
26 --source include/have_debug_sync.inc
27 --source include/have_group_replication_plugin.inc
28 --source include/group_replication.inc
29
30 --echo
31 --echo #####################################################################
32 --echo # 1. With both members ONLINE. Execute some transactions on server1.
33 --echo #####################################################################
34 --let $rpl_connection_name= server1
35 --source include/rpl_connection.inc
36
37 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
38 INSERT INTO t1 VALUES (1);
39 --source include/rpl_sync.inc
40
41 --let $rpl_connection_name= server1
42 --source include/rpl_connection.inc
43 --let $server1_uuid= `SELECT @@server_uuid`
44
45 --let $rpl_connection_name= server2
46 --source include/rpl_connection.inc
47 --let $server2_uuid= `SELECT @@server_uuid`
48
49 ############################################################
50 # 1A. Assert values are correct in table replication_group_member_stats.
51 ############################################################
52
53 ## Connect to server1 and confirm flow control has been exchanged.
54 ## Flow control is exchanged every 1 second interval and GTIDs 30 seconds
55 ## Else assert will fail for remote member information
56 ## Member join adds to remote applied
57 --let $rpl_connection_name= server1
58 --source include/rpl_connection.inc
59 --let $wait_condition= SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED = 4 from performance_schema.replication_group_member_stats where member_id='$server2_uuid';
60 --source include/wait_condition.inc
61
62 ## Assert COUNT_TRANSACTIONS_REMOTE_APPLIED is 0 on server 1
63 --let $transaction_remote_applied_1= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_REMOTE_APPLIED, 1)
64 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_APPLIED should be 0 on server 1'
65 --let $assert_cond= $transaction_remote_applied_1= 0
66 --source include/assert.inc
67 ## Assert COUNT_TRANSACTIONS_REMOTE_APPLIED is 4 on server 2
68 --let $transaction_remote_applied_2= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_REMOTE_APPLIED, 1)
69 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_APPLIED should be 4 on server 2'
70 --let $assert_cond= $transaction_remote_applied_2= 4
71 --source include/assert.inc
72
73 ## Assert COUNT_TRANSACTIONS_LOCAL_PROPOSED is 2 on server 1
74 --let $transaction_local_proposed_1= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_LOCAL_PROPOSED, 1)
75 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_PROPOSED should be 2 on server 1'
76 --let $assert_cond= $transaction_local_proposed_1= 2
77 --source include/assert.inc
78 ## Assert COUNT_TRANSACTIONS_LOCAL_PROPOSED is 0 on server 2
79 --let $transaction_local_proposed_2= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_LOCAL_PROPOSED, 1)
80 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_PROPOSED should be 0 on server 2'
81 --let $assert_cond= $transaction_local_proposed_2= 0
82 --source include/assert.inc
83
84 --let $rpl_connection_name= server2
85 --source include/rpl_connection.inc
86
87 ## Wait for flow control exchange
88 --let $wait_condition= SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED = 2 from performance_schema.replication_group_member_stats where member_id='$server1_uuid';
89 --source include/wait_condition.inc
90
91 ## Assert COUNT_TRANSACTIONS_REMOTE_APPLIED is 0 on server 1
92 --let $transaction_remote_applied_1= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_REMOTE_APPLIED, 1)
93 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_APPLIED should be 0 on server 1'
94 --let $assert_cond= $transaction_remote_applied_1= 0
95 --source include/assert.inc
96 ## Assert COUNT_TRANSACTIONS_REMOTE_APPLIED is 4 on server 2
97 --let $transaction_remote_applied_2= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_REMOTE_APPLIED, 1)
98 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_APPLIED should be 4 on server 2'
99 --let $assert_cond= $transaction_remote_applied_2= 4
100 --source include/assert.inc
101
102 ## Assert COUNT_TRANSACTIONS_LOCAL_PROPOSED is 2 on server 1
103 --let $transaction_local_proposed_1= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_LOCAL_PROPOSED, 1)
104 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_PROPOSED should be 2 on server 1'
105 --let $assert_cond= $transaction_local_proposed_1= 2
106 --source include/assert.inc
107 ## Assert COUNT_TRANSACTIONS_LOCAL_PROPOSED is 0 on server 2
108 --let $transaction_local_proposed_2= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_LOCAL_PROPOSED, 1)
109 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_PROPOSED should be 0 on server 2'
110 --let $assert_cond= $transaction_local_proposed_2= 0
111 --source include/assert.inc
112
113 --echo
114 --echo #####################################################################
115 --echo # 2. Testing of column COUNT_TRANSACTIONS_LOCAL_ROLLBACK.
116 --echo #####################################################################
117
118 ############################################################
119 # 2A. Force negative certification outcome of the next transaction using DEBUG
120 # sync point.
121 ############################################################
122
123 --let $rpl_connection_name= server1
124 --source include/rpl_connection.inc
125 SET @debug_save= @@GLOBAL.DEBUG;
126 SET @@GLOBAL.DEBUG= '+d,certifier_force_1_negative_certification';
127 --let $rpl_connection_name= server2
128 --source include/rpl_connection.inc
129 SET @debug_save= @@GLOBAL.DEBUG;
130 SET @@GLOBAL.DEBUG= '+d,certifier_force_1_negative_certification';
131
132 ## First insert will be aborted
133 --let $rpl_connection_name= server1
134 --source include/rpl_connection.inc
135 --error ER_TRANSACTION_ROLLBACK_DURING_COMMIT
136 INSERT INTO t1 VALUES (2);
137 INSERT INTO t1 VALUES (3);
138 --source include/rpl_sync.inc
139
140 ## Connect to server1 and confirm flow control has been exchanged
141 ## Flow control is exchanged every 1 second interval, GTID 30 seconds
142 ## Else assert will fail for remote member assert checks
143 --let $rpl_connection_name= server1
144 --source include/rpl_connection.inc
145 --let $wait_condition= SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED = 5 from performance_schema.replication_group_member_stats where member_id='$server2_uuid';
146 --source include/wait_condition.inc
147
148 ############################################################
149 # 2B. Assert values are correct in table replication_group_member_stats.
150 ############################################################
151
152 ## Assert COUNT_TRANSACTIONS_REMOTE_APPLIED is 0 on server 1
153 --let $transaction_remote_applied_2_1= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_REMOTE_APPLIED, 1)
154 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_APPLIED should be 0 on server 1'
155 --let $assert_cond= $transaction_remote_applied_2_1= 0
156 --source include/assert.inc
157 ## Assert COUNT_TRANSACTIONS_REMOTE_APPLIED is 5 on server 2
158 --let $transaction_remote_applied_2_2= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_REMOTE_APPLIED, 1)
159 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_APPLIED should be 5 on server 2'
160 --let $assert_cond= $transaction_remote_applied_2_2= 5
161 --source include/assert.inc
162
163 ## Assert COUNT_TRANSACTIONS_LOCAL_PROPOSED is 4 on server 1
164 --let $transaction_local_proposed_2_1= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_LOCAL_PROPOSED, 1)
165 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_PROPOSED should be 4 on server 1'
166 --let $assert_cond= $transaction_local_proposed_2_1= 4
167 --source include/assert.inc
168 ## Assert COUNT_TRANSACTIONS_LOCAL_PROPOSED is 0 on server 2
169 --let $transaction_local_proposed_2_2= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_LOCAL_PROPOSED, 1)
170 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_PROPOSED should be 0 on server 2'
171 --let $assert_cond= $transaction_local_proposed_2_2= 0
172 --source include/assert.inc
173
174 ## Assert COUNT_TRANSACTIONS_LOCAL_ROLLBACK is 1 on server 1
175 --let $transaction_local_rollback_2_1= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_ROLLBACK FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_LOCAL_ROLLBACK, 1)
176 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_ROLLBACK should be 1 on server 1'
177 --let $assert_cond= $transaction_local_rollback_2_1= 1
178 --source include/assert.inc
179 ## Assert COUNT_TRANSACTIONS_LOCAL_ROLLBACK is 0 on server 2
180 --let $transaction_local_rollback_2_2= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_ROLLBACK FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_LOCAL_ROLLBACK, 1)
181 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_ROLLBACK should be 0 on server 2'
182 --let $assert_cond= $transaction_local_rollback_2_2= 0
183 --source include/assert.inc
184
185 ## Assert COUNT_CONFLICTS_DETECTED is 1 on server 1
186 --let $transaction_conflict_detected_2_1= query_get_value(SELECT COUNT_CONFLICTS_DETECTED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_CONFLICTS_DETECTED, 1)
187 --let $assert_text= 'The value of COUNT_CONFLICTS_DETECTED should be 1 on server 1'
188 --let $assert_cond= $transaction_conflict_detected_2_1= 1
189 --source include/assert.inc
190 ## Assert COUNT_CONFLICTS_DETECTED is 1 on server 2
191 --let $transaction_conflict_detected_2_2= query_get_value(SELECT COUNT_CONFLICTS_DETECTED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_CONFLICTS_DETECTED, 1)
192 --let $assert_text= 'The value of COUNT_CONFLICTS_DETECTED should be 1 on server 2'
193 --let $assert_cond= $transaction_conflict_detected_2_2= 1
194 --source include/assert.inc
195
196 --let $rpl_connection_name= server2
197 --source include/rpl_connection.inc
198 --let $wait_condition= SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED = 4 from performance_schema.replication_group_member_stats where member_id='$server1_uuid';
199 --source include/wait_condition.inc
200
201 ## Assert COUNT_TRANSACTIONS_REMOTE_APPLIED is 0 on server 1
202 --let $_transaction_remote_applied_= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_REMOTE_APPLIED, 1)
203 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_APPLIED should be 0 on server 1'
204 --let $assert_cond= $_transaction_remote_applied_= 0
205 --source include/assert.inc
206 ## Assert COUNT_TRANSACTIONS_REMOTE_APPLIED is 5 on server 2
207 --let $_transaction_remote_applied_= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_REMOTE_APPLIED, 1)
208 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_APPLIED should be 5 on server 2'
209 --let $assert_cond= $_transaction_remote_applied_= 5
210 --source include/assert.inc
211
212 ## Assert COUNT_TRANSACTIONS_LOCAL_PROPOSED is 4 on server 1
213 --let $_transaction_local_proposed_= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_LOCAL_PROPOSED, 1)
214 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_PROPOSED should be 4 on server 1'
215 --let $assert_cond= $_transaction_local_proposed_= 4
216 --source include/assert.inc
217 ## Assert COUNT_TRANSACTIONS_LOCAL_PROPOSED is 0 on server 2
218 --let $_transaction_local_proposed_= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_LOCAL_PROPOSED, 1)
219 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_PROPOSED should be 0 on server 2'
220 --let $assert_cond= $_transaction_local_proposed_= 0
221 --source include/assert.inc
222
223 ## Assert COUNT_TRANSACTIONS_LOCAL_ROLLBACK is 1 on server 1
224 --let $_transaction_local_rollback_= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_ROLLBACK FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_LOCAL_ROLLBACK, 1)
225 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_ROLLBACK should be 1 on server 1'
226 --let $assert_cond= $_transaction_local_rollback_= 1
227 --source include/assert.inc
228 ## Assert COUNT_TRANSACTIONS_LOCAL_ROLLBACK is 0 on server 2
229 --let $_transaction_local_rollback_= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_ROLLBACK FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_LOCAL_ROLLBACK, 1)
230 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_ROLLBACK should be 0 on server 2'
231 --let $assert_cond= $_transaction_local_rollback_= 0
232 --source include/assert.inc
233
234 ## Assert COUNT_CONFLICTS_DETECTED is 1 on server 1
235 --let $_transaction_conflict_detected_= query_get_value(SELECT COUNT_CONFLICTS_DETECTED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_CONFLICTS_DETECTED, 1)
236 --let $assert_text= 'The value of COUNT_CONFLICTS_DETECTED should be 1 on server 1'
237 --let $assert_cond= $_transaction_conflict_detected_= 1
238 --source include/assert.inc
239 ## Assert COUNT_CONFLICTS_DETECTED is 1 on server 2
240 --let $_transaction_conflict_detected_= query_get_value(SELECT COUNT_CONFLICTS_DETECTED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_CONFLICTS_DETECTED, 1)
241 --let $assert_text= 'The value of COUNT_CONFLICTS_DETECTED should be 1 on server 2'
242 --let $assert_cond= $_transaction_conflict_detected_= 1
243 --source include/assert.inc
244
245 --echo
246 --echo #####################################################################
247 --echo # 3. Testing of column COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE.
248 --echo #####################################################################
249
250 --let $rpl_connection_name= server1
251 --source include/rpl_connection.inc
252 SET @@GLOBAL.DEBUG='+d,block_applier_updates';
253
254 ############################################################
255 # 3A. Execute 10 transactions on M2 and block them before commiting.
256 ############################################################
257
258 --let $rpl_connection_name= server2
259 --source include/rpl_connection.inc
260
261 --disable_query_log
262 --let $i=101
263 while($i <= 110)
264 {
265 --EVAL INSERT INTO t1 VALUES ($i)
266 --inc $i
267 }
268 --enable_query_log
269
270 ############################################################
271 # 3B. Assert values are correct in table replication_group_member_stats.
272 ############################################################
273
274 ## NOTE: Server2 will commit and clear queue, so test cannot be done for server2
275 ## For server1 we have stopped applier, hence it will work.
276
277 --let $rpl_connection_name= server1
278 --source include/rpl_connection.inc
279
280 --let $wait_condition=SELECT COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE = 10 from performance_schema.replication_group_member_stats where member_id='$server1_uuid';
281 --source include/wait_condition.inc
282
283 ## Assert COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE is 10 on server 1
284 --let $transaction_remote_in_applier_queue_3_1= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE, 1)
285 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE should be 10 on server 1'
286 --let $assert_cond= $transaction_remote_in_applier_queue_3_1= 10
287 --source include/assert.inc
288
289 ## Assert COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE is 0 on server 2
290 --let $transaction_remote_in_applier_queue_3_2= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE, 1)
291 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE should be 0 on server 2'
292 --let $assert_cond= $transaction_remote_in_applier_queue_3_2= 0
293 --source include/assert.inc
294
295 --let $rpl_connection_name= server2
296 --source include/rpl_connection.inc
297
298 --let $wait_condition=SELECT COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE = 10 from performance_schema.replication_group_member_stats where member_id='$server1_uuid';
299 --source include/wait_condition.inc
300
301 ## Assert COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE is 10 on server 1
302 --let $transaction_remote_in_applier_queue_3_3= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE, 1)
303 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE should be 10 on server 1'
304 --let $assert_cond= $transaction_remote_in_applier_queue_3_3= 10
305 --source include/assert.inc
306
307 ## Assert COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE is 0 on server 2
308 --let $transaction_remote_in_applier_queue_3_4= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE, 1)
309 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE should be 0 on server 2'
310 --let $assert_cond= $transaction_remote_in_applier_queue_3_4= 0
311 --source include/assert.inc
312
313 --let $rpl_connection_name= server1
314 --source include/rpl_connection.inc
315 SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked";
316 SET @@GLOBAL.DEBUG='-d,block_applier_updates';
317 SET DEBUG_SYNC = "now SIGNAL resume_applier_read";
318
319 --let $rpl_connection_name= server2
320 --source include/rpl_connection.inc
321 --source include/rpl_sync.inc
322
323 --let $rpl_connection_name= server1
324 --source include/rpl_connection.inc
325 SET DEBUG_SYNC= 'RESET';
326
327 --echo
328 --echo #####################################################################
329 --echo # 4. Assert values are correct in table replication_group_member_stats.
330 --echo #####################################################################
331 --let $rpl_connection_name= server1
332 --source include/rpl_connection.inc
333
334 --let $wait_condition= SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED = 10 from performance_schema.replication_group_member_stats where member_id='$server2_uuid';
335 --source include/wait_condition.inc
336
337
338 ## Assert COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE is 0 on server 1
339 --let $transaction_remote_in_applier_queue_4_1= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE, 1)
340 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE should be 0 on server 1'
341 --let $assert_cond= $transaction_remote_in_applier_queue_4_1= 0
342 --source include/assert.inc
343 ## Assert COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE is 0 on server 2
344 --let $transaction_remote_in_applier_queue_4_2= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE, 1)
345 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE should be 0 on server 2'
346 --let $assert_cond= $transaction_remote_in_applier_queue_4_2= 0
347 --source include/assert.inc
348
349 ## Assert COUNT_TRANSACTIONS_REMOTE_APPLIED is 10 on server 1
350 --let $transaction_remote_applied_4_1= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_REMOTE_APPLIED, 1)
351 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_APPLIED should be 10 on server 1'
352 --let $assert_cond= $transaction_remote_applied_4_1= 10
353 --source include/assert.inc
354 ## Assert COUNT_TRANSACTIONS_REMOTE_APPLIED is 5 on server 2
355 --let $transaction_remote_applied_4_2= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_REMOTE_APPLIED, 1)
356 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_APPLIED should be 5 on server 2'
357 --let $assert_cond= $transaction_remote_applied_4_2= 5
358 --source include/assert.inc
359
360 ## Assert COUNT_TRANSACTIONS_LOCAL_PROPOSED is 4 on server 1
361 --let $transaction_local_proposed_4_1= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_LOCAL_PROPOSED, 1)
362 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_PROPOSED should be 4 on server 1'
363 --let $assert_cond= $transaction_local_proposed_4_1= 4
364 --source include/assert.inc
365 ## Assert COUNT_TRANSACTIONS_LOCAL_PROPOSED is 10 on server 2
366 --let $transaction_local_proposed_4_2= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_LOCAL_PROPOSED, 1)
367 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_PROPOSED should be 10 on server 2'
368 --let $assert_cond= $transaction_local_proposed_4_2= 10
369 --source include/assert.inc
370
371 ## Assert COUNT_TRANSACTIONS_LOCAL_ROLLBACK is 1 on server 1
372 --let $transaction_local_rollback_4_1= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_ROLLBACK FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_LOCAL_ROLLBACK, 1)
373 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_ROLLBACK should be 1 on server 1'
374 --let $assert_cond= $transaction_local_rollback_4_1= 1
375 --source include/assert.inc
376 ## Assert COUNT_TRANSACTIONS_LOCAL_ROLLBACK is 0 on server 2
377 --let $transaction_local_rollback_4_2= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_ROLLBACK FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_LOCAL_ROLLBACK, 1)
378 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_ROLLBACK should be 0 on server 2'
379 --let $assert_cond= $transaction_local_rollback_4_2= 0
380 --source include/assert.inc
381
382 ## Assert COUNT_CONFLICTS_DETECTED is 1 on server 1
383 --let $_transaction_conflict_detected_= query_get_value(SELECT COUNT_CONFLICTS_DETECTED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_CONFLICTS_DETECTED, 1)
384 --let $assert_text= 'The value of COUNT_CONFLICTS_DETECTED should be 1 on server 1'
385 --let $assert_cond= $_transaction_conflict_detected_= 1
386 --source include/assert.inc
387 ## Assert COUNT_CONFLICTS_DETECTED is 1 on server 2
388 --let $_transaction_conflict_detected_= query_get_value(SELECT COUNT_CONFLICTS_DETECTED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_CONFLICTS_DETECTED, 1)
389 --let $assert_text= 'The value of COUNT_CONFLICTS_DETECTED should be 1 on server 2'
390 --let $assert_cond= $_transaction_conflict_detected_= 1
391 --source include/assert.inc
392
393 ###############################################################################
394 ## Assert table replication_group_member_stats has same information on server 2
395
396 --let $rpl_connection_name= server2
397 --source include/rpl_connection.inc
398
399 ## Wait for flow control exchange
400 --let $wait_condition= SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED = 10 from performance_schema.replication_group_member_stats where member_id='$server1_uuid';
401 --source include/wait_condition.inc
402
403
404 ## Assert COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE is 0 on server 1
405 --let $transaction_remote_in_applier_queue_5_1= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE, 1)
406 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE should be 0 on server 1'
407 --let $assert_cond= $transaction_remote_in_applier_queue_5_1= 0
408 --source include/assert.inc
409 ## Assert COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE is 0 on server 2
410 --let $transaction_remote_in_applier_queue_5_2= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE, 1)
411 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE should be 0 on server 2'
412 --let $assert_cond= $transaction_remote_in_applier_queue_5_2= 0
413 --source include/assert.inc
414
415 ## Assert COUNT_TRANSACTIONS_REMOTE_APPLIED is 10 on server 1
416 --let $transaction_remote_applied_5_1= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_REMOTE_APPLIED, 1)
417 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_APPLIED should be 10 on server 1'
418 --let $assert_cond= $transaction_remote_applied_5_1= 10
419 --source include/assert.inc
420 ## Assert COUNT_TRANSACTIONS_REMOTE_APPLIED is 5 on server 2
421 --let $transaction_remote_applied_5_2= query_get_value(SELECT COUNT_TRANSACTIONS_REMOTE_APPLIED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_REMOTE_APPLIED, 1)
422 --let $assert_text= 'The value of COUNT_TRANSACTIONS_REMOTE_APPLIED should be 5 on server 2'
423 --let $assert_cond= $transaction_remote_applied_5_2= 5
424 --source include/assert.inc
425
426 ## Assert COUNT_TRANSACTIONS_LOCAL_PROPOSED is 4 on server 1
427 --let $transaction_local_proposed_5_1= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_LOCAL_PROPOSED, 1)
428 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_PROPOSED should be 4 on server 1'
429 --let $assert_cond= $transaction_local_proposed_5_1= 4
430 --source include/assert.inc
431 ## Assert COUNT_TRANSACTIONS_LOCAL_PROPOSED is 10 on server 2
432 --let $transaction_local_proposed_5_2= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_PROPOSED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_LOCAL_PROPOSED, 1)
433 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_PROPOSED should be 10 on server 2'
434 --let $assert_cond= $transaction_local_proposed_5_2= 10
435 --source include/assert.inc
436
437 ## Assert COUNT_TRANSACTIONS_LOCAL_ROLLBACK is 1 on server 1
438 --let $transaction_local_rollback_5_1= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_ROLLBACK FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_TRANSACTIONS_LOCAL_ROLLBACK, 1)
439 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_ROLLBACK should be 1 on server 1'
440 --let $assert_cond= $transaction_local_rollback_5_1= 1
441 --source include/assert.inc
442 ## Assert COUNT_TRANSACTIONS_LOCAL_ROLLBACK is 0 on server 2
443 --let $transaction_local_rollback_5_2= query_get_value(SELECT COUNT_TRANSACTIONS_LOCAL_ROLLBACK FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_TRANSACTIONS_LOCAL_ROLLBACK, 1)
444 --let $assert_text= 'The value of COUNT_TRANSACTIONS_LOCAL_ROLLBACK should be 0 on server 2'
445 --let $assert_cond= $transaction_local_rollback_5_2= 0
446 --source include/assert.inc
447
448 ## Assert COUNT_CONFLICTS_DETECTED is 1 on server 1
449 --let $_transaction_conflict_detected_= query_get_value(SELECT COUNT_CONFLICTS_DETECTED FROM performance_schema.replication_group_member_stats where member_id='$server1_uuid', COUNT_CONFLICTS_DETECTED, 1)
450 --let $assert_text= 'The value of COUNT_CONFLICTS_DETECTED should be 1 on server 1'
451 --let $assert_cond= $_transaction_conflict_detected_= 1
452 --source include/assert.inc
453 ## Assert COUNT_CONFLICTS_DETECTED is 1 on server 2
454 --let $_transaction_conflict_detected_= query_get_value(SELECT COUNT_CONFLICTS_DETECTED FROM performance_schema.replication_group_member_stats where member_id='$server2_uuid', COUNT_CONFLICTS_DETECTED, 1)
455 --let $assert_text= 'The value of COUNT_CONFLICTS_DETECTED should be 1 on server 2'
456 --let $assert_cond= $_transaction_conflict_detected_= 1
457 --source include/assert.inc
458
459 ## Validate diff of table
460 --let $wait_timeout= 150
461 --let $wait_condition= SELECT COUNT(*)=1 from performance_schema.replication_group_member_stats where member_id='$server1_uuid' and (transactions_committed_all_members like '%:1-5:1000002-1000011' or transactions_committed_all_members like '%:1-15') and count_transactions_rows_validating=1;
462 --source include/wait_condition.inc
463
464 --let $rpl_connection_name= server1
465 --source include/rpl_connection.inc
466 --let $wait_timeout= 150
467 --let $wait_condition= SELECT COUNT(*)=1 from performance_schema.replication_group_member_stats where member_id='$server2_uuid' and (transactions_committed_all_members like '%:1-5:1000002-1000011' or transactions_committed_all_members like '%:1-15') and count_transactions_rows_validating=1;
468 --source include/wait_condition.inc
469
470 --let $diff_tables= server1:performance_schema.replication_group_member_stats, server2:performance_schema.replication_group_member_stats
471 --source include/diff_tables.inc
472
473 --echo
474 --echo #####################################################################
475 --echo # 5. Clean up(debug flag and tables).
476 --echo #####################################################################
477
478 ## Cleanup of debug flags
479 --let $rpl_connection_name= server1
480 --source include/rpl_connection.inc
481 SET @@GLOBAL.DEBUG= @debug_saved;
482
483 --let $rpl_connection_name= server2
484 --source include/rpl_connection.inc
485 SET @@GLOBAL.DEBUG= @debug_saved;
486
487 ## Cleanup tables
488 --let $rpl_connection_name= server1
489 --source include/rpl_connection.inc
490 DROP TABLE t1;
491
492 ## Shutdown group
493 --source include/group_replication_end.inc