Debian Codegraph @

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

raw
1 ################################################################################
2 # BUG#20776314 THE CERTIFIER BROADCAST THREAD IS PRONE TO CONCURRENCY PROBLEMS
3 #
4 # This test fixes the second issue with the bug :
5 #
6 # The member_id is introduced in to the member_vector before the member_id is
7 # checked. This generates the case of a same member sending the message again.
8 #
9 # Steps :
10 # 0. The test requires two servers: M1 and M2.
11 #
12 # 1. The test starts with two servers running group_replication, with a debug
13 # flag set on one of the server. This debug flag inject duplicate member_id
14 # in the members vector to simulate the case of the message being received
15 # from a similar source.
16 #
17 # 2. After the first garbage collection round the
18 # transaction_committed_all_member should be empty on server2 as the garbage
19 # collection has not taken place.
20 #
21 # 3. We then remove the flag (although the code already does that) and rerun
22 # the garbage collection. This time the transaction_committed_all_members is
23 # not empty on server2.
24 #
25 # 4. Clean up.
26 ################################################################################
27 --source include/big_test.inc
28 --source include/have_debug.inc
29 --source include/have_group_replication_plugin.inc
30 --let $rpl_skip_group_replication_start= 1
31 --source include/group_replication.inc
32
33 --connection server1
34 SET @debug_save= @@GLOBAL.DEBUG;
35 SET @@GLOBAL.DEBUG= '+d,certifier_inject_duplicate_certifier_data_message';
36 --source include/start_and_bootstrap_group_replication.inc
37
38 --connection server2
39 --source include/start_group_replication.inc
40
41 --echo ############################################################
42 --echo # Execute a transaction on the server1 which is propagated to the
43 --echo # second server and applied on both of them.
44 --connection server1
45 CREATE TABLE t1(i INT PRIMARY KEY);
46 --source include/rpl_sync.inc
47
48 --echo # Start the first round of garbage collection here. Since we have set the DBUG
49 --echo # flag on the second server we expect a message to be logged in the error log
50 --echo # as the same member sent the message.
51 --connection server2
52 --let $wait_timeout= 65
53 --let $wait_condition= SELECT Transactions_committed_all_members<>"" FROM performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid)
54 --source include/wait_condition.inc
55
56 --echo # Transactions_committed_all_members has 1 transaction from when server 2 joined
57 --echo # No more info should have been received.
58 --connection server1
59 --let $expected_gtid="$group_replication_group_name:1"
60 --let $transactions_committed_all_members= query_get_value(SELECT Transactions_committed_all_members from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid), Transactions_committed_all_members, 1)
61 --let $assert_text= Transactions committed on all members should only contain 1 transaction
62 --let $assert_cond= "$transactions_committed_all_members"= $expected_gtid
63 --source include/assert.inc
64
65 INSERT INTO t1 VALUES(1);
66 --echo # Checking that the garbage collection is working fine.
67 --let $wait_timeout= 65
68 --let $wait_condition= SELECT Transactions_committed_all_members<>$expected_gtid FROM performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid)
69 --source include/wait_condition.inc
70
71 --connection server1
72 SET @@GLOBAL.DEBUG= @debug_save;
73 DROP TABLE t1;
74 --source include/group_replication_end.inc