Debian Codegraph @

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

raw
1 ################################################################################
2 # This test verifies that recovery aborts successfully if
3 # group_replication_recovery_retry_count is made smaller then connection
4 # retry count in middle of recovery donor connection attempts.
5 #
6 # Test:
7 # 0. The test requires two servers: M1 and M2.
8 # 1. Bootstrap start a group on M1.
9 # 2. Setup environment to fail donor connection and start GR on M2.
10 # Set DEBUG on M2 to block donor connection attempt when count reaches 3.
11 # Verify M2 is in recovery state.
12 # 3. Reset group_replication_recovery_retry_count to 2.
13 # Signal donor connection attempt to continue.
14 # 4. Verification.
15 # 5. Clean up.
16 ################################################################################
17 --source include/have_debug_sync.inc
18 --source include/have_group_replication_plugin.inc
19 --let $rpl_skip_group_replication_start= 1
20 --source include/group_replication.inc
21
22 --let $error_file = $MYSQLTEST_VARDIR/tmp/gr_recovery_lower_max_retry_count.2.err
23
24 --echo
25 --echo # 1. Bootstrap start a group on M1.
26 --echo
27
28 --let $rpl_connection_name= server1
29 --source include/rpl_connection.inc
30
31 SET sql_log_bin=0;
32 CREATE USER 'user_with_no_priv_s1'@'%';
33 GRANT GROUP_REPLICATION_STREAM ON *.* TO 'user_with_no_priv_s1'@'%';
34 FLUSH PRIVILEGES;
35 SET sql_log_bin=1;
36
37 --source include/start_and_bootstrap_group_replication.inc
38
39 --echo
40 --echo # 2. Setup environment to fail donor connection and start GR on M2.
41 --echo # Set DEBUG on M2 to block donor connection attempt when count reaches 3.
42 --echo # Verify M2 is in recovery state.
43 --echo
44
45 --let $rpl_connection_name= server2
46 --source include/rpl_connection.inc
47
48 SET @debug_save= @@GLOBAL.DEBUG;
49 SET @recovery_reconnect_interval_save= @@GLOBAL.GROUP_REPLICATION_RECOVERY_RECONNECT_INTERVAL;
50 SET @recovery_retry_count_save= @@GLOBAL.group_replication_recovery_retry_count;
51 --disable_warnings
52 SET sql_log_bin=0;
53 CREATE USER 'user_with_no_priv_s1'@'%';
54 GRANT GROUP_REPLICATION_STREAM ON *.* TO 'user_with_no_priv_s1'@'%';
55 FLUSH PRIVILEGES;
56 SET sql_log_bin=1;
57 CHANGE REPLICATION SOURCE TO SOURCE_USER="user_with_no_priv_s1" FOR CHANNEL "group_replication_recovery";
58 --enable_warnings
59
60 SET SESSION sql_log_bin = 0;
61 call mtr.add_suppression("Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery.");
62 call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
63 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
64 SET SESSION sql_log_bin = 1;
65 SET @@GLOBAL.DEBUG='+d,gr_reset_max_connection_attempts_to_donors';
66
67 SET GLOBAL group_replication_recovery_reconnect_interval= 2;
68
69 --let $group_replication_start_member_state= RECOVERING
70 --source include/start_group_replication.inc
71
72 --echo
73 --echo # 3. Reset group_replication_recovery_retry_count to 2.
74 --echo # Signal donor connection attempt to continue.
75 --echo
76 SET DEBUG_SYNC= "now WAIT_FOR signal.connection_attempt_3";
77
78 SET GLOBAL group_replication_recovery_retry_count= 2;
79
80 SET DEBUG_SYNC= "now SIGNAL signal.reset_recovery_retry_count_done";
81
82 --echo
83 --echo # 4. Verification.
84 --echo
85
86 --let $group_replication_member_state= ERROR
87 --source include/gr_wait_for_member_state.inc
88
89 --let $assert_file = $error_file
90 --let $assert_text = 3 donor connections attempts were made.
91 --let $assert_select = Retrying group recovery connection with another donor. Attempt 3/10
92 --let $assert_count = 1
93 --source include/assert_grep.inc
94
95 --let $assert_file = $error_file
96 --let $assert_text = Post change of group_replication_recovery_retry_count, 4th donor connection attempt was not made.
97 --let $assert_select = Retrying group recovery connection with another donor. Attempt 4
98 --let $assert_count = 0
99 --source include/assert_grep.inc
100
101 --let $assert_file = $error_file
102 --let $assert_text = Recovery process aborted.
103 --let $assert_select = Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery.
104 --let $assert_count = 1
105 --source include/assert_grep.inc
106
107 --echo
108 --echo # 5. Clean up.
109 --echo
110 SET @@GLOBAL.DEBUG= @debug_save;
111 SET @@GLOBAL.GROUP_REPLICATION_RECOVERY_RECONNECT_INTERVAL= @recovery_reconnect_interval_save;
112 SET @@GLOBAL.group_replication_recovery_retry_count= @recovery_retry_count_save;
113
114 SET sql_log_bin=0;
115 SET GLOBAL super_read_only = 0;
116 DROP USER user_with_no_priv_s1;
117 SET sql_log_bin=1;
118
119 --connection server1
120 SET sql_log_bin=0;
121 SET GLOBAL super_read_only = 0;
122 DROP USER user_with_no_priv_s1;
123 SET sql_log_bin=1;
124
125 --source include/group_replication_end.inc