Debian Codegraph @

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

raw
1 ################################################################################
2 # Group Replication: cross-version policies
3 # This test-case makes sure:
4 # 1. Patch version is considered during primary election when all members are
5 # of version >= 8.0.17.
6 # 2. When patch versions are same, member weight is considered among lower
7 # versions members
8 # 3. When patch versions and member weight are same, UUID is considered
9 #
10 # Test:
11 # 0. The test requires four servers: M1, M2, M3, M4 in single primary mode.
12 # 1. Bootstrap M1 and start GR on M2.
13 # Set higher member weight on M3 and start GR with higher patch version.
14 # 2. Stop GR on M1.
15 # M2 becomes primary due to lower version rule.
16 # 3. Set higher member weight on M1 and start GR on M1 and M4.
17 # Stop GR primary member M2.
18 # M1 becomes primary due to lower version and higher member weight.
19 # 4. Start GR on M2.
20 # Stop GR primary member M1.
21 # Lowest server_uuid between M2 or M4 becomes primary.
22 # Server_uuid is considered among same version and member weight.
23 # 5. Cleanup.
24 #
25 ################################################################################
26
27 --source include/big_test.inc
28 --source include/have_debug.inc
29 --source include/have_group_replication_plugin.inc
30 --let $rpl_skip_group_replication_start= 1
31 --let $rpl_server_count= 4
32 --let $rpl_group_replication_single_primary_mode=1
33 --source include/group_replication.inc
34
35 --echo
36 --echo # 1. Bootstrap M1 and start GR on M2.
37 --echo # Set higher member weight on M3 and start GR with higher patch version.
38 --echo
39 --let $rpl_connection_name= server1
40 --source include/rpl_connection.inc
41 --let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
42
43 SET @debug1_save= @@GLOBAL.DEBUG;
44 --source include/start_and_bootstrap_group_replication.inc
45
46 --let $rpl_connection_name= server2
47 --source include/rpl_connection.inc
48 --let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
49 --source include/start_group_replication.inc
50
51 --let $rpl_connection_name= server3
52 --source include/rpl_connection.inc
53
54 --let $server3_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
55
56 SET @member_weight3_save= @@GLOBAL.group_replication_member_weight;
57 --eval SET GLOBAL group_replication_member_weight= 90
58 SET @debug3_save= @@GLOBAL.DEBUG;
59 SET @@GLOBAL.DEBUG= 'd,group_replication_compatibility_higher_patch_version';
60 SET SESSION sql_log_bin = 0;
61 call mtr.add_suppression("Member version is read compatible with the group.");
62 SET SESSION sql_log_bin = 1;
63 --source include/start_group_replication.inc
64
65 --echo
66 --echo # 2. Stop GR on M1.
67 --echo # M2 becomes primary due to lower version rule.
68 --echo
69
70 ## STATUS - ASSUMING 8.0.17 is original version
71 # Server - State - Version - Weight - R/W
72 # M1 - ON - 8.0.17 - 50 - P
73 # M2 - ON - 8.0.17 - 50 - S
74 # M3 - ON - 8.0.18 - 90 - S
75 # M4 - OFF - -.-.-- - 50 - S
76
77 --let $rpl_connection_name= server1
78 --source include/rpl_connection.inc
79
80 --source include/stop_group_replication.inc
81
82 --let $_primary_member_of_group= $server2_uuid
83 --source include/gr_assert_spm_consistency.inc
84
85
86 --echo
87 --echo # 3. Set higher member weight on M1 and start GR on M1 and M4.
88 --echo # Stop GR primary member M2.
89 --echo # M1 becomes primary due to lower version and higher member weight.
90 --echo
91
92 # Server - State - Version - Weight - R/W
93 # M1 - OFF - 8.0.17 - 50 - S
94 # M2 - ON - 8.0.17 - 50 - P (NEW)
95 # M3 - ON - 8.0.18 - 90 - S
96 # M4 - OFF - -.-.-- - 50 - S
97
98 --let $rpl_connection_name= server1
99 --source include/rpl_connection.inc
100
101 SET @member_weight1_save= @@GLOBAL.group_replication_member_weight;
102 --eval SET GLOBAL group_replication_member_weight= 60
103
104 --source include/start_group_replication.inc
105
106 --let $rpl_connection_name= server4
107 --source include/rpl_connection.inc
108
109 --source include/start_group_replication.inc
110
111 --let $rpl_connection_name= server2
112 --source include/rpl_connection.inc
113
114 --source include/stop_group_replication.inc
115
116 --let $_primary_member_of_group= $server1_uuid
117 --source include/gr_assert_spm_consistency.inc
118
119 --echo
120 --echo # 4. Start GR on M2.
121 --echo # Stop GR primary member M1.
122 --echo # Lowest server_uuid between M2 or M4 becomes primary.
123 --echo # Server_uuid is considered among same version and member weight.
124 --echo
125
126 # Server - State - Version - Weight - R/W
127 # M1 - ON - 8.0.17 - 60 - P (NEW)
128 # M2 - OFF - 8.0.17 - 50 - S
129 # M3 - ON - 8.0.18 - 90 - S
130 # M4 - ON - 8.0.17 - 50 - S
131
132 --let $rpl_connection_name= server2
133 --source include/rpl_connection.inc
134
135 --source include/start_group_replication.inc
136
137 --let $rpl_connection_name= server1
138 --source include/rpl_connection.inc
139
140 --source include/stop_group_replication.inc
141
142 --let $rpl_connection_name= server2
143 --source include/rpl_connection.inc
144
145 --let $_next_primary_uuid= query_get_value("SELECT Member_id FROM performance_schema.replication_group_members WHERE Member_id <> '$server3_uuid' ORDER BY Member_id ASC LIMIT 1", Member_id, 1)
146
147 --let $_primary_member_of_group= $_next_primary_uuid
148 --source include/gr_assert_spm_consistency.inc
149
150 --echo
151 --echo # 5. Cleanup.
152 --echo
153
154 # Server - State - Version - Weight - R/W
155 # M1 - OFF - 8.0.17 - 60 - S
156 # M2 - ON - 8.0.17 - 50 - P/S (CANDIDATE)
157 # M3 - ON - 8.0.18 - 90 - S
158 # M4 - ON - 8.0.17 - 50 - P/S (CANDIDATE)
159
160 --let $rpl_connection_name= server4
161 --source include/rpl_connection.inc
162 --source include/stop_group_replication.inc
163
164 --let $rpl_connection_name= server1
165 --source include/rpl_connection.inc
166 SET @@GLOBAL.DEBUG= @debug1_save;
167 SET @@GLOBAL.group_replication_member_weight = @member_weight1_save;
168
169 --let $rpl_connection_name= server2
170 --source include/rpl_connection.inc
171 --source include/stop_group_replication.inc
172
173 --let $rpl_connection_name= server3
174 --source include/rpl_connection.inc
175 # Stop GR because version is different.
176 --source include/stop_group_replication.inc
177 SET @@GLOBAL.group_replication_member_weight = @member_weight3_save;
178 SET @@GLOBAL.DEBUG= @debug3_save;
179
180 --let $rpl_group_replication_reset_persistent_vars=1
181 --source include/group_replication_end.inc