Debian Codegraph @

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

raw
1 ################################################################################
2 # Validate that when a member is stopped with holes on applier
3 # relay log gtids, those holes will be filled by the next
4 # transactions.
5 #
6 # Test:
7 # 0. The test requires two servers: M1 and M2.
8 # 1. Bootstrap start a group on M1. Start GR on M2.
9 # 2. Block applier channel in order to delay the execution of remote transactions
10 # on M1.
11 # 3. Create a table on M2 with a specified GTID. GTID_EXECUTED must contain a
12 # hole on M2. Wait until statement reaches M1 relay log.
13 # 4. Shutdown the group before applying the received transactions on server1.
14 # - M2: Drop table t1, remove applier thread channel and reset master.
15 # 5. Bootstrap start a group on M1. GTID_EXECUTED must contain no holes.
16 # - UUID_GROUP:3 is used for the view on M1.
17 # - M1: Assert check events sequence in binlog.
18 # - M1: Check received_transaction_set must contain no holes.
19 # - M2: gtid_executed must be empty.
20 # - M2: Start GR. Then, gtid_executed must contain no holes.
21 # 6. Clean up.
22 ################################################################################
23 --source include/big_test.inc
24 --source include/have_debug_sync.inc
25 --source include/have_group_replication_plugin.inc
26 --let $rpl_skip_group_replication_start= 1
27 --source include/group_replication.inc
28
29 # The sequence of events that make up a View Change
30 --let $vcle_seq= Gtid # Query/BEGIN # View_change # Query/COMMIT
31
32 --let $rpl_connection_name= server1
33 --source include/rpl_connection.inc
34 SET SESSION sql_log_bin= 0;
35 --source include/gtid_utils.inc
36 SET SESSION sql_log_bin= 1;
37 --let $rpl_connection_name= server2
38 --source include/rpl_connection.inc
39 SET SESSION sql_log_bin= 0;
40 --source include/gtid_utils.inc
41 SET SESSION sql_log_bin= 1;
42
43
44 --echo
45 --echo ############################################################
46 --echo # 1. Start a group with two members on which server 1 is the
47 --echo # bootstrap member.
48 --let $rpl_connection_name= server1
49 --source include/rpl_connection.inc
50 --source include/start_and_bootstrap_group_replication.inc
51
52 --let $rpl_connection_name= server2
53 --source include/rpl_connection.inc
54 --source include/start_group_replication.inc
55
56
57 --echo
58 --echo ############################################################
59 --echo # 2. Block applier channel in order to delay the execution of
60 --echo # remote transactions on member 1.
61 --let $rpl_connection_name= server1
62 --source include/rpl_connection.inc
63 SET @@GLOBAL.DEBUG='+d,block_applier_updates';
64
65 --echo
66 --echo ############################################################
67 --echo # 3. Create a table on member 2 with a specified GTID.
68 --echo # This statement will not be applied on member 1.
69 --let $rpl_connection_name= server2
70 --source include/rpl_connection.inc
71
72 --let $assert_text= GTID_EXECUTED must contain two transactions from the members join
73 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-2")
74 --source include/assert.inc
75
76 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
77 --eval SET GTID_NEXT= "$group_replication_group_name:4"
78 CREATE TABLE t1 (i INT PRIMARY KEY);
79 SET GTID_NEXT="AUTOMATIC";
80
81 --let $assert_text= GTID_EXECUTED must contain a hole
82 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-2:4")
83 --source include/assert.inc
84
85 # Wait until statement reaches member 1 relay log.
86 --let $rpl_connection_name= server1
87 --source include/rpl_connection.inc
88 --let $wait_condition= SELECT received_transaction_set="$group_replication_group_name:1-2:4" FROM performance_schema.replication_connection_status WHERE channel_name="group_replication_applier";
89 --source include/wait_condition.inc
90
91
92 --echo
93 --echo ############################################################
94 --echo # 4. Shutdown the group before applying the received transactions on server1.
95 --let $rpl_connection_name= server1
96 --source include/rpl_connection.inc
97 SET @@GLOBAL.DEBUG='-d,block_applier_updates';
98 SET @@GLOBAL.DEBUG='+d,force_sql_thread_error';
99 SET DEBUG_SYNC = "now SIGNAL resume_applier_read";
100 --let $group_replication_member_state= ERROR
101 --source include/gr_wait_for_member_state.inc
102 SET @@GLOBAL.DEBUG='-d,force_sql_thread_error';
103 SET DEBUG_SYNC= 'RESET';
104
105 --source include/stop_group_replication.inc
106
107 # Server 2 will contain one more GTID then server 1, which will fill
108 # the GTID hole, to test this scenario we will assume that server 2
109 # did crash and group was bootstrap from server 1.
110 --let $rpl_connection_name= server2
111 --source include/rpl_connection.inc
112 --source include/stop_group_replication.inc
113 DROP TABLE t1;
114 RESET SLAVE ALL FOR CHANNEL "group_replication_applier";
115 RESET MASTER;
116
117
118 --echo
119 --echo ############################################################
120 --echo # 5. Bootstrap the group again.
121 --let $rpl_connection_name= server1
122 --source include/rpl_connection.inc
123
124 --source include/start_and_bootstrap_group_replication.inc
125 --let $assert_text= GTID_EXECUTED must contain no holes
126 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-4")
127 --source include/assert.inc
128
129 # GTID group_replication_group_name:3 was used for the view on
130 # which server1 did bootstrap the group again.
131 # View change (s1) # View change (s2) # Create table # View change (s1)
132 --let $event_sequence= $vcle_seq # $vcle_seq # !Gtid_transaction # $vcle_seq
133 --source include/assert_binlog_events.inc
134
135 --let $received_set= `SELECT received_transaction_set FROM performance_schema.replication_connection_status WHERE channel_name="group_replication_applier"`
136 --let $assert_text= gtid received set must contain no holes
137 --let $assert_cond= GTID_IS_EQUAL("$received_set","$group_replication_group_name:1-4")
138 --source include/assert.inc
139
140 --let $rpl_connection_name= server2
141 --source include/rpl_connection.inc
142 --let $assert_text= GTID_EXECUTED must be empty
143 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"")
144 --source include/assert.inc
145
146 --source include/start_group_replication.inc
147 --let $assert_text= GTID_EXECUTED must contain no holes
148 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-5")
149 --source include/assert.inc
150
151 # View change (s1) # View change (s2) # Create table # View change (s1) # View change (s2)
152 --let $event_sequence= $vcle_seq # $vcle_seq # !Gtid_transaction # $vcle_seq # $vcle_seq
153 --source include/assert_binlog_events.inc
154
155
156 --echo
157 --echo ############################################################
158 --echo # 6. Cleanup.
159 DROP TABLE t1;
160
161 --let $rpl_connection_name= server1
162 --source include/rpl_connection.inc
163 SET SESSION sql_log_bin = 0;
164 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Relay log read failure: Could not parse relay log event entry.*");
165 call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.");
166 call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
167 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
168 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
169 --source include/gtid_utils_end.inc
170 SET SESSION sql_log_bin= 1;
171 --let $rpl_connection_name= server2
172 --source include/rpl_connection.inc
173 SET SESSION sql_log_bin= 0;
174 --source include/gtid_utils_end.inc
175 SET SESSION sql_log_bin= 1;
176
177 --source include/group_replication_end.inc