File: gr_recovery_lower_max_retry_count.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 (125 lines) | stat: -rw-r--r-- 4,660 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
################################################################################
# This test verifies that recovery aborts successfully if
# group_replication_recovery_retry_count is made smaller then connection
# retry count in middle of recovery donor connection attempts.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. Bootstrap start a group on M1.
# 2. Setup environment to fail donor connection and start GR on M2.
#    Set DEBUG on M2 to block donor connection attempt when count reaches 3.
#    Verify M2 is in recovery state.
# 3. Reset group_replication_recovery_retry_count to 2.
#    Signal donor connection attempt to continue.
# 4. Verification.
# 5. Clean up.
################################################################################
--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

--let $error_file = $MYSQLTEST_VARDIR/tmp/gr_recovery_lower_max_retry_count.2.err

--echo
--echo # 1. Bootstrap start a group on M1.
--echo

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

SET sql_log_bin=0;
CREATE USER 'user_with_no_priv_s1'@'%';
GRANT GROUP_REPLICATION_STREAM ON *.* TO 'user_with_no_priv_s1'@'%';
FLUSH PRIVILEGES;
SET sql_log_bin=1;

--source include/start_and_bootstrap_group_replication.inc

--echo
--echo # 2. Setup environment to fail donor connection and start GR on M2.
--echo #    Set DEBUG on M2 to block donor connection attempt when count reaches 3.
--echo #    Verify M2 is in recovery state.
--echo

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

SET @debug_save= @@GLOBAL.DEBUG;
SET @recovery_reconnect_interval_save= @@GLOBAL.GROUP_REPLICATION_RECOVERY_RECONNECT_INTERVAL;
SET @recovery_retry_count_save= @@GLOBAL.group_replication_recovery_retry_count;
--disable_warnings
SET sql_log_bin=0;
CREATE USER 'user_with_no_priv_s1'@'%';
GRANT GROUP_REPLICATION_STREAM ON *.* TO 'user_with_no_priv_s1'@'%';
FLUSH PRIVILEGES;
SET sql_log_bin=1;
CHANGE REPLICATION SOURCE TO SOURCE_USER="user_with_no_priv_s1" FOR CHANNEL "group_replication_recovery";
--enable_warnings

SET SESSION sql_log_bin = 0;
call mtr.add_suppression("Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery.");
call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
SET SESSION sql_log_bin = 1;
SET @@GLOBAL.DEBUG='+d,gr_reset_max_connection_attempts_to_donors';

SET GLOBAL group_replication_recovery_reconnect_interval= 2;

--let $group_replication_start_member_state= RECOVERING
--source include/start_group_replication.inc

--echo
--echo # 3. Reset group_replication_recovery_retry_count to 2.
--echo #    Signal donor connection attempt to continue.
--echo
SET DEBUG_SYNC= "now WAIT_FOR signal.connection_attempt_3";

SET GLOBAL group_replication_recovery_retry_count= 2;

SET DEBUG_SYNC= "now SIGNAL signal.reset_recovery_retry_count_done";

--echo
--echo # 4. Verification.
--echo

--let $group_replication_member_state= ERROR
--source include/gr_wait_for_member_state.inc

--let $assert_file = $error_file
--let $assert_text = 3 donor connections attempts were made.
--let $assert_select = Retrying group recovery connection with another donor. Attempt 3/10
--let $assert_count = 1
--source include/assert_grep.inc

--let $assert_file = $error_file
--let $assert_text = Post change of group_replication_recovery_retry_count, 4th donor connection attempt was not made.
--let $assert_select = Retrying group recovery connection with another donor. Attempt 4
--let $assert_count = 0
--source include/assert_grep.inc

--let $assert_file = $error_file
--let $assert_text = Recovery process aborted.
--let $assert_select = Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery.
--let $assert_count = 1
--source include/assert_grep.inc

--echo
--echo # 5. Clean up.
--echo
SET @@GLOBAL.DEBUG= @debug_save;
SET @@GLOBAL.GROUP_REPLICATION_RECOVERY_RECONNECT_INTERVAL= @recovery_reconnect_interval_save;
SET @@GLOBAL.group_replication_recovery_retry_count= @recovery_retry_count_save;

SET sql_log_bin=0;
SET GLOBAL super_read_only = 0;
DROP USER user_with_no_priv_s1;
SET sql_log_bin=1;

--connection server1
SET sql_log_bin=0;
SET GLOBAL super_read_only = 0;
DROP USER user_with_no_priv_s1;
SET sql_log_bin=1;

--source include/group_replication_end.inc