File: gr_recovery_connection_options.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 (195 lines) | stat: -rw-r--r-- 7,723 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
################################################################################
# Recovery donor connection options test
# This test checks the user options used for donor connection during recovery.
#
# Test:
#   0) The test requires three servers.
#   1) Start server1 to boot the group. Insert some data for recovery. Create
#      the recovery user for the donor connection.
#   2) Start server2 after changing the connection credentials using the
#      change master for the server. See that the recovery is successful.
#   3) On server3 set incorrect password. Keep recovery retry count to low.
#   4) Set DEBUG point to verify member is in RECOVERY state. Start server3.
#      Check that members is recovering. Then, recovery failed causing the
#      member to go to ERROR state.
#   5) On server3 set master_user to empty user.
#   6) Set DEBUG point to verify member is in RECOVERY state. Start server3.
#      Check that members is recovering. Then, recovery failed causing the
#      member to go to ERROR state.
#   7) On server3 set master_user to non-existing user.
#   8) Set DEBUG point to verify member is in RECOVERY state. Start server3.
#      Check that members is recovering. Then, recovery failed causing the
#      member to go to ERROR state.
#   9) Do the cleanup in the end.
################################################################################

--source include/big_test.inc
--source include/have_debug.inc
--source include/have_group_replication_xcom_communication_stack.inc
--let $group_replication_group_name= b5eb4110-a3a2-11e3-a5e2-0800200c9a66
--source include/set_privilege_checks_user_as_system_user.inc
--let $rpl_privilege_checks_user_grant_option = 1
--source include/have_group_replication_plugin.inc

--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 3
--source include/group_replication.inc

--let $recovery_user= recovery_user
--let $recovery_password= recovery_password
--let $recovery_bad_password= recovery_bad_password

--echo #
--echo # Start the donor member
--echo #

--connection server1
--source include/start_and_bootstrap_group_replication.inc

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

#insert some data
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);

--echo #
--echo # Install a rpl user for the donor connection
--echo #

--eval CREATE USER "$recovery_user" IDENTIFIED BY "$recovery_password"
--eval GRANT REPLICATION SLAVE ON *.* TO "$recovery_user"
FLUSH PRIVILEGES;

--connection server2

--echo #
--echo # Set valid options
--echo #

--disable_warnings
--eval CHANGE REPLICATION SOURCE TO SOURCE_USER='$recovery_user', SOURCE_PASSWORD='$recovery_password' FOR CHANNEL 'group_replication_recovery';
--enable_warnings

--echo #
--echo # Start the joiner member with the given credentials and check if it is OK
--echo #

--source include/start_group_replication.inc

let $assert_text= On the recovered member, the table should contain 1 elements;
let $assert_cond= [select count(*) from t1] = 1;
source include/assert.inc;

--echo #
--echo # Create a new member and give it a bad password, watching it fail
--echo #

SET @debug_save= @@GLOBAL.DEBUG;

--connection server3
set session sql_log_bin=0;
call mtr.add_suppression("There was an error when connecting to the donor*");
call mtr.add_suppression("For details please check performance_schema.replication_connection_status table and error log messages of Replica I/O for channel group_replication_recovery.");
call mtr.add_suppression("Maximum number of retries when*");
call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will 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("The member is leaving a group without being on one");
call mtr.add_suppression("The member is already leaving or joining a group.");
call mtr.add_suppression("Error leaving the group");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
call mtr.add_suppression(".*Invalid .* username when attempting to connect to the source server.*");
set session sql_log_bin=1;

--let $debug_save_count= `SELECT @@GLOBAL.group_replication_recovery_retry_count`
--let $debug_save_rec_int= `SELECT @@GLOBAL.group_replication_recovery_reconnect_interval`

SET @debug_save= @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG='d,recovery_thread_wait_before_finish';

--disable_warnings
CHANGE REPLICATION SOURCE TO SOURCE_USER='$recovery_user', SOURCE_PASSWORD='$recovery_bad_password' FOR CHANNEL 'group_replication_recovery';
--enable_warnings

--echo # Set the retry count to try only twice. One time for each member.
--eval SET GLOBAL group_replication_recovery_retry_count= 2;
--echo # Set the reconnect interval to one. To prevent timeout on recovery.
--eval SET GLOBAL group_replication_recovery_reconnect_interval= 1;

--let $assert_text= The value of the recovery retry count should be equal to 2
--let $assert_cond= "[SELECT @@group_replication_recovery_retry_count]" = "2"
--source include/assert.inc

--echo # Start recovery and wait to verify the member is in recovery
--let $group_replication_start_member_state= RECOVERING
--source include/start_group_replication.inc

--echo # The member should error out as it can't connect
SET DEBUG_SYNC= "now SIGNAL signal.recovery_end";
--let $group_replication_member_state= ERROR
--source include/gr_wait_for_member_state.inc

--echo #
--echo # Set MASTER_USER to an empty user name, watching it fail
--echo #

--source include/stop_group_replication.inc

CHANGE REPLICATION SOURCE TO SOURCE_USER= '', SOURCE_PASSWORD= '' FOR CHANNEL 'group_replication_recovery';

--echo # Start recovery and wait to verify the member is in recovery
--let $group_replication_start_member_state= RECOVERING
--source include/start_group_replication.inc

SET DEBUG_SYNC= "now SIGNAL signal.recovery_end";
--let $group_replication_member_state= ERROR
--source include/gr_wait_for_member_state.inc

--echo # Verify that the show slave status shows specific IO_error
--let $rpl_channel_name= 'group_replication_recovery'
--let $slave_io_errno= convert_error(ER_REPLICA_FATAL_ERROR)
--source include/wait_for_slave_io_error.inc

--source include/stop_group_replication.inc

--echo #
--echo # Set MASTER_USER to non existing user, watching it fail
--echo #

CHANGE REPLICATION SOURCE TO SOURCE_USER= 'parveez', SOURCE_PASSWORD= 'me' FOR CHANNEL 'group_replication_recovery';

--echo # Start recovery and wait to verify the member is in recovery
--let $group_replication_start_member_state= RECOVERING
--source include/start_group_replication.inc

SET DEBUG_SYNC= "now SIGNAL signal.recovery_end";
--let $group_replication_member_state= ERROR
--source include/gr_wait_for_member_state.inc

--echo # Verify that show slave status shows specific IO_ERROR
let $show_statement= SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery';
let $field= Last_IO_Errno;
let $condition= = '1045';
--source include/wait_show_condition.inc

--source include/stop_group_replication.inc

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

--echo #
--echo # Clean up
--echo #

--eval DROP USER "$recovery_user"
--connection server3
SET DEBUG_SYNC='RESET';
SET @@GLOBAL.DEBUG = @debug_save;
--eval SET GLOBAL group_replication_recovery_retry_count= $debug_save_count
--eval SET GLOBAL group_replication_recovery_reconnect_interval= $debug_save_rec_int

--connection server2
DROP TABLE t1;

--source include/group_replication_end.inc