File: gr_autorejoin_spm.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 (180 lines) | stat: -rw-r--r-- 5,927 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
178
179
180
################################################################################
#
# The auto-rejoin process is a mechanism that allows a server that left the
# group due to flaky network (either on his side or on the other members) to
# try to join again up to group_replication_autorejoin_tries number of times.
#
# This test shall verify that upon a member expel, if auto-rejoin is enabled,
# the expelled member will try to rejoin the group up to
# group_replication_autorejoin_tries number of times. It will also verify that,
# if the rejoining member was a primary before being expelled, when that member
# is successfully rejoined to the group, it will remain a secondary.
#
# Test:
# 0) The test requires three servers (in single-primary mode).
# 1) Expel the primary.
# 2) Verify that the expelled member will try to rejoin the group the number of
#    times it is configured in group_replication_autorejoin_tries sysvar.
# 3) Verify that it manages to rejoin the group
# 4) Verify that the newly rejoined member is no longer the primary.
# 5) Cleanup.
#
################################################################################
--source include/big_test.inc
--source include/have_debug_sync.inc
--source include/linux.inc
--source include/have_group_replication_plugin.inc
#
# We manually start the group because we need to set the rejoin timeout before
# the START GROUP_REPLICATION command.
#
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count = 3
--let $rpl_group_replication_single_primary_mode=1
--source include/group_replication.inc

--echo
--echo ####
--echo # 0) The test requires three servers.
--echo ####
--echo
SET sql_log_bin = 0;
call mtr.add_suppression("Member was expelled from the group due to network failures, changing member status to ERROR.");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
call mtr.add_suppression("Started auto-rejoin procedure attempt*");
call mtr.add_suppression("Auto-rejoin procedure attempt*");
SET sql_log_bin = 1;

--source include/gr_autorejoin_monitoring.inc

SET @debug_saved = @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG='+d,group_replication_rejoin_short_retry';
SET @@GLOBAL.DEBUG='+d,group_replication_stop_before_rejoin';

--source include/start_and_bootstrap_group_replication.inc

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

--source include/start_group_replication.inc

--let $rpl_connection_name = server3
--source include/rpl_connection.inc

--source include/start_group_replication.inc

--echo
--echo ####
--echo # 1) Expel one of the members.
--echo ####
--echo
--let $rpl_connection_name = server1
--source include/rpl_connection.inc

# First, enable auto-rejoin
SET GLOBAL group_replication_autorejoin_tries = 1;

# Force expel on member 1
--let $member_id = `SELECT @@GLOBAL.server_uuid`
--source include/gr_expel_member_from_group.inc

--echo
--echo ####
--echo # 2) Verify that the expelled member will try to rejoin the group the
--echo # number of it is configured in group_replication_autorejoin_tries
--echo # sysvar.
--echo ####
--echo
--let $rpl_connection_name = server1
--source include/rpl_connection.inc

SET DEBUG_SYNC = "now WAIT_FOR signal.autorejoin_waiting";

# Wait for the group to stabilize and find a new primary
--let $rpl_connection_name = server2
--source include/rpl_connection.inc

--let $group_replication_number_of_members = 2
--source include/gr_wait_for_number_of_members.inc

--let $rpl_connection_name = server3
--source include/rpl_connection.inc

--let $group_replication_number_of_members = 2
--source include/gr_wait_for_number_of_members.inc

--source include/gr_find_a_primary.inc
if (!$group_replication_found_primary_out_var)
{
  --die "Should have found a primary after member expel!"
}

--let $rpl_connection_name = server1
--source include/rpl_connection.inc

# Verify that auto-rejoin is currently running
--let $assert_text = Auto-rejoin should be running
--let $assert_cond = [SELECT IS_AUTOREJOIN_RUNNING()] = TRUE
--source include/assert.inc

--let $assert_text= super_read_only should be enabled
--let $assert_cond= [SELECT @@GLOBAL.super_read_only] = 1;
--source include/assert.inc

# Verify that it attempted one try
--let $assert_text = We should have attempted 1 rejoin
--let $assert_cond = [SELECT GET_NUMBER_RETRIES()] = 1
--source include/assert.inc

SET DEBUG_SYNC = "now SIGNAL signal.autorejoin_continue";

# Verify that the auto-rejoin process has terminated
--let $wait_condition = SELECT IS_AUTOREJOIN_RUNNING() = FALSE
--source include/wait_condition_or_abort.inc

--echo
--echo ####
--echo # 3) Verify that it manages to rejoin the group.
--echo ####
--echo
--let $group_replication_member_state = ONLINE
--let $group_replication_member_id = $member_id
--source include/gr_wait_for_member_state.inc

--let $group_replication_number_of_members = 3
--source include/gr_wait_for_number_of_members.inc

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

--let $group_replication_number_of_members = 3
--source include/gr_wait_for_number_of_members.inc

--let $rpl_connection_name = server3
--source include/rpl_connection.inc

--let $group_replication_number_of_members = 3
--source include/gr_wait_for_number_of_members.inc

--echo
--echo ####
--echo # 4) Verify that the newly rejoined member is no longer the primary.
--echo ####
--echo
--let $rpl_connection_name = server1
--source include/rpl_connection.inc

--source include/gr_assert_secondary_member.inc

--echo
--echo ####
--echo # 5) Cleanup.
--echo ####
--echo
# Stop the GR plugin so that we leave super read-only mode and drop the auto-rejoin monitoring functions
--source include/stop_group_replication.inc

SET @@GLOBAL.DEBUG = @debug_saved;
SET @@GLOBAL.group_replication_autorejoin_tries = default;
--source include/gr_end_autorejoin_monitoring.inc
--source include/group_replication_end.inc