Debian Codegraph @

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

raw
1 ################################################################################
2 #
3 # The auto-rejoin process is a mechanism that allows a server that left the
4 # group due to flaky network (either on his side or on the other members) to
5 # try to join again up to group_replication_autorejoin_tries number of times.
6 #
7 # This test shall verify that the group_replication_autorejoin_tries sysvar
8 # behaves as required, i.e. has a well-defined domain of possible values, can
9 # enable or disable the auto-rejoin process and can be updated while the plugin
10 # is running.
11 #
12 # Test:
13 # 0) The test requires three servers.
14 # 1) Verify that the default is 0.
15 # 2) Verify that only positive values are accepted.
16 # 3) Verify that when it is 0, the auto-rejoin process isn't run.
17 # 4) Verify that when it is greater than 0, the auto-rejoin process is run.
18 # 5) Verify that you can't update the group_replication_autorejoin_tries sysvar
19 # when an auto-rejoin is ongoing.
20 # 6) Cleanup.
21 #
22 ################################################################################
23 --source include/big_test.inc
24 --source include/have_debug.inc
25 --source include/linux.inc
26 --source include/have_group_replication_plugin.inc
27 --let $rpl_server_count = 3
28 --source include/group_replication.inc
29
30 --echo
31 --echo ####
32 --echo # 0) The test requires three servers.
33 --echo ####
34 --echo
35 --let $rpl_connection_name = server2
36 --source include/rpl_connection.inc
37
38 SET sql_log_bin = 0;
39 call mtr.add_suppression("Member was expelled from the group due to network failures, changing member status to ERROR.");
40 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
41 call mtr.add_suppression("\\[GCS\\] The member has left the group but the new view will not be installed*");
42 call mtr.add_suppression("Started auto-rejoin procedure attempt*");
43 call mtr.add_suppression("Auto-rejoin procedure attempt*");
44 call mtr.add_suppression("Unable to confirm whether the server has left the group or not. Check performance_schema.replication_group_members to check group membership information.");
45 SET sql_log_bin = 1;
46
47 --source include/gr_autorejoin_monitoring.inc
48
49 --echo
50 --echo ####
51 --echo # 1) Verify that the default is 3.
52 --echo ####
53 --echo
54 SET @@GLOBAL.group_replication_autorejoin_tries = default;
55 --let $assert_text = The default of group_replication_autorejoin_tries should be 3
56 --let $assert_cond = [SELECT @@GLOBAL.group_replication_autorejoin_tries] = 3
57 --source include/assert.inc
58
59 --echo
60 --echo ####
61 --echo # 2) Verify that only positive values are accepted.
62 --echo ####
63 --echo
64 --error ER_WRONG_TYPE_FOR_VAR
65 SET GLOBAL group_replication_autorejoin_tries = 0.5;
66 --error ER_WRONG_TYPE_FOR_VAR
67 SET GLOBAL group_replication_autorejoin_tries = "string";
68 --error ER_WRONG_TYPE_FOR_VAR
69 SET GLOBAL group_replication_autorejoin_tries = on;
70 --error ER_WRONG_VALUE_FOR_VAR
71 SET GLOBAL group_replication_autorejoin_tries = -1;
72 SET GLOBAL group_replication_autorejoin_tries = 2016;
73 --error ER_WRONG_VALUE_FOR_VAR
74 SET GLOBAL group_replication_autorejoin_tries = 2017;
75
76 --echo
77 --echo ####
78 --echo # 3) Verify that when it is 0, the auto-rejoin process isn't run.
79 --echo ####
80 --echo
81 SET GLOBAL group_replication_autorejoin_tries = 0;
82
83 # Force an expel on member 2
84 --let $member_id = `SELECT @@GLOBAL.server_uuid`
85 --source include/gr_expel_member_from_group.inc
86
87 # Verify that no auto-rejoin process was run
88 --let $assert_text = Auto-rejoin should not have been executed
89 --let $assert_cond = [SELECT GET_COUNT_AUTOREJOIN()] = 0
90 --source include/assert.inc
91
92 --echo
93 --echo ####
94 --echo # 4) Verify that when it is greater than 0, the auto-rejoin process is
95 --echo # run.
96 --echo ####
97 --echo
98 --source include/stop_group_replication.inc
99
100 SET @debug_saved = @@GLOBAL.DEBUG;
101 SET @@GLOBAL.DEBUG='+d,group_replication_stop_before_rejoin_loop';
102
103 --source include/start_group_replication.inc
104 SET GLOBAL group_replication_autorejoin_tries = 3;
105
106
107 # Force an expel on member 2
108 --source include/gr_expel_member_from_group.inc
109
110 SET DEBUG_SYNC = "now WAIT_FOR signal.autorejoin_entering_loop";
111
112 # Verify that it is currently running
113 --let $assert_text = Auto-rejoin should be running
114 --let $assert_cond = [SELECT IS_AUTOREJOIN_RUNNING()] = TRUE
115 --source include/assert.inc
116
117 --echo
118 --echo ####
119 --echo # 5) Verify that you can't update the group_replication_autorejoin_tries
120 --echo # sysvar when an auto-rejoin is ongoing.
121 --echo ####
122 --echo
123 --error ER_DA_GRP_RPL_STARTED_AUTO_REJOIN
124 SET GLOBAL group_replication_autorejoin_tries = 1;
125
126 SET DEBUG_SYNC = "now SIGNAL signal.autorejoin_enter_loop";
127
128 # Reset GR so we stop the auto-rejoin and leave super_read_only mode
129 --source include/stop_group_replication.inc
130
131 SET @@GLOBAL.DEBUG='+d,group_replication_rejoin_short_retry';
132
133 --source include/start_group_replication.inc
134
135 #
136 # Verify that you can update the group_replication_autorejoin_tries sysvar when
137 # the auto-rejoin is not running.
138 #
139 SET @@GLOBAL.DEBUG='+d,group_replication_fail_rejoin';
140 SET @@GLOBAL.DEBUG='-d,group_replication_stop_before_rejoin_loop';
141 SET @@GLOBAL.DEBUG='+d,group_replication_stop_before_rejoin';
142 SET GLOBAL group_replication_autorejoin_tries = 2;
143
144 --source include/gr_expel_member_from_group.inc
145
146 SET DEBUG_SYNC = "now WAIT_FOR signal.autorejoin_waiting";
147
148 # Verify that it is currently running
149 --let $assert_text = Auto-rejoin should be running
150 --let $assert_cond = [SELECT IS_AUTOREJOIN_RUNNING()] = TRUE
151 --source include/assert.inc
152
153 --let $assert_text= super_read_only should be enabled
154 --let $assert_cond= [SELECT @@GLOBAL.super_read_only] = 1;
155 --source include/assert.inc
156
157 # Verify that it attempted one try
158 --let $assert_text = We should have attempted 1 rejoin
159 --let $assert_cond = [SELECT GET_NUMBER_RETRIES()] = 1
160 --source include/assert.inc
161
162 SET DEBUG_SYNC = "now SIGNAL signal.autorejoin_continue";
163
164 #
165 # Now we remove the group_replication_fail_rejoin debug sync point so that the
166 # rejoin is completed with success and we can cleanup the test.
167 #
168 SET DEBUG_SYNC = "now WAIT_FOR signal.autorejoin_waiting";
169 SET @@GLOBAL.DEBUG='-d,group_replication_fail_rejoin';
170 SET DEBUG_SYNC = "now SIGNAL signal.autorejoin_continue";
171
172 # Verify that the auto-rejoin process has terminated
173 --let $wait_condition = SELECT IS_AUTOREJOIN_RUNNING() = FALSE
174 --source include/wait_condition_or_abort.inc
175
176 # The member should have rejoined successfully
177 --let $group_replication_member_state = ONLINE
178 --let $group_replication_member_id = $member_id
179 --source include/gr_wait_for_member_state.inc
180
181 --echo
182 --echo ####
183 --echo # 6) Cleanup.
184 --echo ####
185 --echo
186 --source include/gr_end_autorejoin_monitoring.inc
187 SET @@GLOBAL.DEBUG = @debug_saved;
188 SET GLOBAL group_replication_autorejoin_tries = default;
189 --source include/group_replication_end.inc