File: gr_stop_with_gtid_gaps_applier.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (177 lines) | stat: -rw-r--r-- 7,552 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
################################################################################
# Validate that when a member is stopped with holes on applier
# relay log gtids, those holes will be filled by the next
# transactions.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. Bootstrap start a group on M1. Start GR on M2.
# 2. Block applier channel in order to delay the execution of remote transactions
#    on M1.
# 3. Create a table on M2 with a specified GTID. GTID_EXECUTED must contain a
#    hole on M2. Wait until statement reaches M1 relay log.
# 4. Shutdown the group before applying the received transactions on server1.
#  - M2: Drop table t1, remove applier thread channel and reset master.
# 5. Bootstrap start a group on M1. GTID_EXECUTED must contain no holes.
#  - UUID_GROUP:3 is used for the view on M1.
#  - M1: Assert check events sequence in binlog.
#  - M1: Check received_transaction_set must contain no holes.
#  - M2: gtid_executed must be empty.
#  - M2: Start GR. Then, gtid_executed must contain no holes.
# 6. Clean up.
################################################################################
--source include/big_test.inc
--source include/have_debug_sync.inc
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc

# The sequence of events that make up a View Change
--let $vcle_seq= Gtid # Query/BEGIN # View_change # Query/COMMIT

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET SESSION sql_log_bin= 0;
--source include/gtid_utils.inc
SET SESSION sql_log_bin= 1;
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET SESSION sql_log_bin= 0;
--source include/gtid_utils.inc
SET SESSION sql_log_bin= 1;


--echo
--echo ############################################################
--echo # 1. Start a group with two members on which server 1 is the
--echo #    bootstrap member.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/start_and_bootstrap_group_replication.inc

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc


--echo
--echo ############################################################
--echo # 2. Block applier channel in order to delay the execution of
--echo #    remote transactions on member 1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET @@GLOBAL.DEBUG='+d,block_applier_updates';

--echo
--echo ############################################################
--echo # 3. Create a table on member 2 with a specified GTID.
--echo #    This statement will not be applied on member 1.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc

--let $assert_text= GTID_EXECUTED must contain two transactions from the members join
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-2")
--source include/assert.inc

--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GTID_NEXT= "$group_replication_group_name:4"
CREATE TABLE t1 (i INT PRIMARY KEY);
SET GTID_NEXT="AUTOMATIC";

--let $assert_text= GTID_EXECUTED must contain a hole
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-2:4")
--source include/assert.inc

# Wait until statement reaches member 1 relay log.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--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";
--source include/wait_condition.inc


--echo
--echo ############################################################
--echo # 4. Shutdown the group before applying the received transactions on server1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET @@GLOBAL.DEBUG='-d,block_applier_updates';
SET @@GLOBAL.DEBUG='+d,force_sql_thread_error';
SET DEBUG_SYNC = "now SIGNAL resume_applier_read";
--let $group_replication_member_state= ERROR
--source include/gr_wait_for_member_state.inc
SET @@GLOBAL.DEBUG='-d,force_sql_thread_error';
SET DEBUG_SYNC= 'RESET';

--source include/stop_group_replication.inc

# Server 2 will contain one more GTID then server 1, which will fill
# the GTID hole, to test this scenario we will assume that server 2
# did crash and group was bootstrap from server 1.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
DROP TABLE t1;
RESET SLAVE ALL FOR CHANNEL "group_replication_applier";
RESET MASTER;


--echo
--echo ############################################################
--echo # 5. Bootstrap the group again.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc

--source include/start_and_bootstrap_group_replication.inc
--let $assert_text= GTID_EXECUTED must contain no holes
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-4")
--source include/assert.inc

# GTID group_replication_group_name:3 was used for the view on
# which server1 did bootstrap the group again.
# View change (s1) # View change (s2) # Create table # View change (s1)
--let $event_sequence= $vcle_seq # $vcle_seq # !Gtid_transaction # $vcle_seq
--source include/assert_binlog_events.inc

--let $received_set= `SELECT received_transaction_set FROM performance_schema.replication_connection_status WHERE channel_name="group_replication_applier"`
--let $assert_text= gtid received set must contain no holes
--let $assert_cond= GTID_IS_EQUAL("$received_set","$group_replication_group_name:1-4")
--source include/assert.inc

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= GTID_EXECUTED must be empty
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"")
--source include/assert.inc

--source include/start_group_replication.inc
--let $assert_text= GTID_EXECUTED must contain no holes
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-5")
--source include/assert.inc

# View change (s1) # View change (s2) # Create table # View change (s1) # View change (s2)
--let $event_sequence= $vcle_seq # $vcle_seq # !Gtid_transaction # $vcle_seq # $vcle_seq
--source include/assert_binlog_events.inc


--echo
--echo ############################################################
--echo # 6. Cleanup.
DROP TABLE t1;

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET SESSION sql_log_bin = 0;
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Relay log read failure: Could not parse relay log event entry.*");
call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.");
call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
--source include/gtid_utils_end.inc
SET SESSION sql_log_bin= 1;
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET SESSION sql_log_bin= 0;
--source include/gtid_utils_end.inc
SET SESSION sql_log_bin= 1;

--source include/group_replication_end.inc