Debian Codegraph @

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

raw
1 ################################################################################
2 # Group Replication: cross-version policies
3 # This test verifies compatibility is rechecked post recovery.
4 # Lower member version may leave during recovery.
5 #
6 # Test:
7 # 0. The test requires three servers: M1, M2 and M3.
8 # 1. Bootstrap M1 with lower patch version.
9 # Start GR on M2 with higher patch version.
10 # 2. Block slave thread of applier on M1.
11 # 3. Send Start GR on M3 with base version.
12 # 4. Stop GR on M1 so M3 has no member to recover from.
13 # Set allow_local_lower_version_join on M3 so M3 uses M2 as donor.
14 # 5. Verify M3 is ONLINE and writable since its new lowest version.
15 # 6. Cleanup.
16 #
17 ################################################################################
18
19 --source include/big_test.inc
20 --source include/have_debug.inc
21 --source include/have_debug_sync.inc
22 --source include/have_group_replication_plugin.inc
23 --let $rpl_skip_group_replication_start= 1
24 --let $rpl_server_count= 3
25 --source include/group_replication.inc
26
27 --echo
28 --echo # 1. Bootstrap M1 with lower patch version.
29 --echo # Start GR on M2 with higher patch version.
30 --echo
31 --let $rpl_connection_name= server1
32 --source include/rpl_connection.inc
33 SET @debug1_save= @@GLOBAL.DEBUG;
34 SET @@GLOBAL.DEBUG= 'd,group_replication_compatibility_lower_patch_version';
35 --source include/start_and_bootstrap_group_replication.inc
36
37 --let $rpl_connection_name= server2
38 --source include/rpl_connection.inc
39
40 SET @debug2_save= @@GLOBAL.DEBUG;
41 SET @@GLOBAL.DEBUG= 'd,group_replication_compatibility_higher_patch_version';
42 SET SESSION sql_log_bin=0;
43 call mtr.add_suppression("Member version is read compatible with the group.");
44 SET SESSION sql_log_bin=1;
45
46 --source include/start_group_replication.inc
47
48 # server1 is 8.0.34, thence LTS rules do not apply.
49 --let $assert_text= The super_read_only mode should be 1 on server2.
50 --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 1;
51 --source include/assert.inc
52
53 --echo
54 --echo # 2. Block slave thread of applier on M1.
55 --echo
56
57 ## STATUS - ASSUMING 8.0.17 is original version
58 # Server - State - Version - Weight - R/W
59 # M1 - ON - 8.0.16 - 50 - W
60 # M2 - ON - 8.0.18 - 50 - W
61 # M3 - OFF - 8.0.17 - 50 - R
62
63 --let $rpl_connection_name= server1
64 --source include/rpl_connection.inc
65 SET @@GLOBAL.DEBUG='+d,block_applier_updates';
66
67 --echo
68 --echo # 3. Send Start GR on M3 with base version.
69 --echo
70
71 --let $rpl_connection_name= server3
72 --source include/rpl_connection.inc
73 SET SESSION sql_log_bin=0;
74 call mtr.add_suppression("Member version is read compatible with the group.");
75 SET SESSION sql_log_bin=1;
76
77 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
78 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
79 --let $server3_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
80 --send START GROUP_REPLICATION;
81
82 --echo
83 --echo # 4. Stop GR on M1 so M3 has no member to recover from.
84 --echo # Set allow_local_lower_version_join on M3 so M3 uses M2 as donor.
85 --echo
86
87 --let $rpl_connection_name= server1
88 --source include/rpl_connection.inc
89
90 --let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="RECOVERING" AND MEMBER_ID = '$server3_uuid'
91 --source include/wait_condition.inc
92
93 # Inject a error on the applier to avoid the received transactions
94 # to be committed.
95 # The member will leave the group and change to ERROR state.
96 SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked";
97 SET @@GLOBAL.DEBUG='-d,block_applier_updates';
98 SET @@GLOBAL.DEBUG='+d,force_sql_thread_error';
99 SET DEBUG_SYNC = "now SIGNAL resume_applier_read";
100 --let $group_replication_member_state= ERROR
101 --source include/gr_wait_for_member_state.inc
102 SET @@GLOBAL.DEBUG='-d,force_sql_thread_error';
103 --source include/stop_group_replication.inc
104
105 --let $rpl_connection_name= server_3
106 --source include/rpl_connection.inc
107 SET @@GLOBAL.group_replication_allow_local_lower_version_join=1;
108
109 --let $rpl_connection_name= server3
110 --source include/rpl_connection.inc
111 --reap
112
113 --echo
114 --echo # 5. Verify M3 is ONLINE and writable since its new lowest version.
115 --echo
116
117 # Increase wait_timeout since old donor connection will be dropped
118 # and new donor will be selected
119 --let $wait_timeout= 120
120 --let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE" AND MEMBER_ID = '$server3_uuid'
121 --source include/wait_condition.inc
122
123 --let $assert_text= The super_read_only mode should be 0 on server3.
124 --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0;
125 --source include/assert.inc
126
127 --let $rpl_connection_name= server2
128 --source include/rpl_connection.inc
129
130 # When server2 joined, server1 was 8.0.34, thence super_read_only was enabled.
131 --let $assert_text= The super_read_only mode should be 1 on server2.
132 --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 1;
133 --source include/assert.inc
134
135 --echo
136 --echo # 6. Cleanup.
137 --echo
138
139 SET @@GLOBAL.DEBUG= @debug2_save;
140 --source include/stop_group_replication.inc
141
142 --let $rpl_connection_name= server1
143 --source include/rpl_connection.inc
144 SET @@GLOBAL.DEBUG= @debug1_save;
145 SET DEBUG_SYNC= 'RESET';
146 SET SESSION sql_log_bin = 0;
147 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Relay log read failure: Could not parse relay log event entry.*");
148 call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.");
149 call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
150 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
151 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
152 SET SESSION sql_log_bin = 1;
153
154 --let $rpl_connection_name= server3
155 --source include/rpl_connection.inc
156 SET @@GLOBAL.group_replication_allow_local_lower_version_join= 0;
157
158 --source include/group_replication_end.inc