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 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
|
################################################################################
#
# This test shall verify that the group_replication_paxos_single_leader system
# variable correctly enables/disables the single-leader behavior introduced in
# WL#9149 and also that a member with a different value on this system variable
# cannot join the group.
#
# Test:
# 0) Verify that the default value of group_replication_paxos_single_leader is
# true
# 1) The test requires three servers.
# 2) Verify that the UUID present in WRITE_CONSENSUS_LEADERS_MEMBER_ID_PREFERRED
# and in WRITE_CONSENSUS_LEADERS_MEMBER_ID_ACTIVE is the UUID of the primary
# 3) Change the value of group_replication_paxos_single_leader to false
# 4) Verify that the value of the new sysvar is false
# 5) The group should still be using single-leader
# 6) Reboot the plugin (add only 2 of the members)
# 7) Verify that the UUIDs contained in
# WRITE_CONSENSUS_LEADERS_MEMBER_ID_PREFERRED and in
# WRITE_CONSENSUS_LEADERS_MEMBER_ID_ACTIVE contain all the UUIDs of all the
# members in the group
# 8) Change the sysvar value on the third member to true
# 9) Try to add the third member
# 9.1) Adding the third member should fail
# 10) Cleanup.
#
################################################################################
--source include/big_test.inc
--source include/have_debug.inc
--source include/linux.inc
--source include/have_group_replication_plugin.inc
--let $rpl_server_count = 3
--let $rpl_group_replication_single_primary_mode=1
--let $rpl_skip_group_replication_start=1
--source include/group_replication.inc
--let $rpl_connection_name = server3
--source include/rpl_connection.inc
SET sql_log_bin = 0;
call mtr.add_suppression("This member is configured with a group_replication_paxos_single_leader option value of*");
SET sql_log_bin = 1;
--echo
--echo ####
--echo # 0) Verify that the default value of
--echo # group_replication_paxos_single_leader is true
--echo ####
--echo
--let $rpl_connection_name = server1
--source include/rpl_connection.inc
SET @@GLOBAL.group_replication_paxos_single_leader = default;
--let $assert_text = The default of group_replication_paxos_single_leader should be 0
--let $assert_cond = [SELECT @@GLOBAL.group_replication_paxos_single_leader] = 0
--source include/assert.inc
--echo
--echo ####
--echo # 1) The test requires three servers.
--echo ####
--echo
SET @@GLOBAL.group_replication_paxos_single_leader = 1;
--source include/start_and_bootstrap_group_replication.inc
--let $rpl_connection_name = server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--let $rpl_connection_name = server3
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--echo
--echo ####
--echo # 2) Verify that the UUID present in
--echo # WRITE_CONSENSUS_LEADERS_MEMBER_ID_PREFERRED and in
--echo # WRITE_CONSENSUS_LEADERS_MEMBER_ID_ACTIVE is the UUID of the primary
--echo ####
--echo
--let $rpl_connection_name = server1
--source include/rpl_connection.inc
--let $server1_uuid = `SELECT @@server_uuid`
# Verify preferred and active members of member 1
--let $assert_text = The first server's UUID should be the only UUID in WRITE_CONSENSUS_LEADERS_PREFERRED
--let $assert_cond = "[SELECT WRITE_CONSENSUS_LEADERS_PREFERRED FROM performance_schema.replication_group_communication_information]" = "$server1_uuid"
--source include/assert.inc
--let $assert_text = The first server's UUID should be the only UUID in WRITE_CONSENSUS_LEADERS_ACTUAL
--let $assert_cond = "[SELECT WRITE_CONSENSUS_LEADERS_ACTUAL from performance_schema.replication_group_communication_information]" = "$server1_uuid"
--source include/assert.inc
--let $assert_text = Single Leader must be enabled
--let $assert_cond = "[SELECT WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE from performance_schema.replication_group_communication_information]" = "1"
--source include/assert.inc
# Verify preferred and active members of member 2
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text = The first server's UUID should be the only UUID in WRITE_CONSENSUS_LEADERS_PREFERRED
--let $assert_cond = "[SELECT WRITE_CONSENSUS_LEADERS_PREFERRED from performance_schema.replication_group_communication_information]" = "$server1_uuid"
--source include/assert.inc
--let $assert_text = The first server's UUID should be the only UUID in WRITE_CONSENSUS_LEADERS_ACTUAL
--let $assert_cond = "[SELECT WRITE_CONSENSUS_LEADERS_ACTUAL from performance_schema.replication_group_communication_information]" = "$server1_uuid"
--source include/assert.inc
--let $assert_text = Single Leader must be enabled
--let $assert_cond = "[SELECT WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE from performance_schema.replication_group_communication_information]" = "1"
--source include/assert.inc
# Verify preferred and active members of member 3
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $assert_text = The first server's UUID should be the only UUID in WRITE_CONSENSUS_LEADERS_PREFERRED
--let $assert_cond = "[SELECT WRITE_CONSENSUS_LEADERS_PREFERRED from performance_schema.replication_group_communication_information]" = "$server1_uuid"
--source include/assert.inc
--let $assert_text = The first server's UUID should be the only UUID in WRITE_CONSENSUS_LEADERS_ACTUAL
--let $assert_cond = "[SELECT WRITE_CONSENSUS_LEADERS_ACTUAL from performance_schema.replication_group_communication_information]" = "$server1_uuid"
--source include/assert.inc
--let $assert_text = Single Leader must be enabled
--let $assert_cond = "[SELECT WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE from performance_schema.replication_group_communication_information]" = "1"
--source include/assert.inc
--echo
--echo ####
--echo # 3) Change the value of group_replication_paxos_single_leader to false
--echo ####
--echo
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET GLOBAL group_replication_paxos_single_leader = 0;
--echo
--echo ####
--echo # 4) Verify that the value of the new sysvar is false
--echo ####
--echo
--let $assert_text = The value of group_replication_paxos_single_leader should be 0
--let $assert_cond = [SELECT @@GLOBAL.group_replication_paxos_single_leader] = 0
--source include/assert.inc
--echo
--echo ####
--echo # 5) The group should still be using single-leader
--echo ####
--echo
--let $server1_uuid = `SELECT @@server_uuid`
# Verify preferred and active members of member 1
--let $assert_text = The first server's UUID should be the only UUID in WRITE_CONSENSUS_LEADERS_PREFERRED
--let $assert_cond = "[SELECT WRITE_CONSENSUS_LEADERS_PREFERRED FROM performance_schema.replication_group_communication_information]" = "$server1_uuid"
--source include/assert.inc
--let $assert_text = The first server's UUID should be the only UUID in WRITE_CONSENSUS_LEADERS_ACTUAL
--let $assert_cond = "[SELECT WRITE_CONSENSUS_LEADERS_ACTUAL from performance_schema.replication_group_communication_information]" = "$server1_uuid"
--source include/assert.inc
--let $assert_text = Single Leader must be enabled
--let $assert_cond = "[SELECT WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE from performance_schema.replication_group_communication_information]" = "1"
--source include/assert.inc
# Verify preferred and active members of member 2
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text = The first server's UUID should be the only UUID in WRITE_CONSENSUS_LEADERS_PREFERRED
--let $assert_cond = "[SELECT WRITE_CONSENSUS_LEADERS_PREFERRED from performance_schema.replication_group_communication_information]" = "$server1_uuid"
--source include/assert.inc
--let $assert_text = The first server's UUID should be the only UUID in WRITE_CONSENSUS_LEADERS_ACTUAL
--let $assert_cond = "[SELECT WRITE_CONSENSUS_LEADERS_ACTUAL from performance_schema.replication_group_communication_information]" = "$server1_uuid"
--source include/assert.inc
--let $assert_text = Single Leader must be enabled
--let $assert_cond = "[SELECT WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE from performance_schema.replication_group_communication_information]" = "1"
--source include/assert.inc
# Verify preferred and active members of member 3
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $assert_text = The first server's UUID should be the only UUID in WRITE_CONSENSUS_LEADERS_PREFERRED
--let $assert_cond = "[SELECT WRITE_CONSENSUS_LEADERS_PREFERRED from performance_schema.replication_group_communication_information]" = "$server1_uuid"
--source include/assert.inc
--let $assert_text = The first server's UUID should be the only UUID in WRITE_CONSENSUS_LEADERS_ACTUAL
--let $assert_cond = "[SELECT WRITE_CONSENSUS_LEADERS_ACTUAL from performance_schema.replication_group_communication_information]" = "$server1_uuid"
--source include/assert.inc
--let $assert_text = Single Leader must be enabled
--let $assert_cond = "[SELECT WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE from performance_schema.replication_group_communication_information]" = "1"
--source include/assert.inc
--echo
--echo ####
--echo # 6) Reboot the plugin (add only 2 of the members)
--echo ####
--echo
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $server3_uuid = `SELECT @@GLOBAL.server_uuid`
--source include/stop_group_replication.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--source include/start_and_bootstrap_group_replication.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET GLOBAL group_replication_paxos_single_leader = 0;
--source include/start_group_replication.inc
--echo
--echo ####
--echo # 7) Verify that the UUIDs contained in
--echo # WRITE_CONSENSUS_LEADERS_MEMBER_ID_PREFERRED and in
--echo # WRITE_CONSENSUS_LEADERS_MEMBER_ID_ACTIVE contain all the UUIDs of all
--echo # the members in the group
--echo ####
--echo
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
# Verify preferred and active members of member 1
--let $assert_text = All members should be in WRITE_CONSENSUS_LEADERS_PREFERRED
--let $num_rows = `SELECT COUNT(*) FROM performance_schema.replication_group_communication_information WHERE WRITE_CONSENSUS_LEADERS_PREFERRED LIKE '%$server1_uuid%' AND WRITE_CONSENSUS_LEADERS_PREFERRED LIKE '%$server2_uuid%'`
--let $assert_cond = "$num_rows" = "1"
--source include/assert.inc
--let $assert_text = All members should be in WRITE_CONSENSUS_LEADERS_ACTUAL
--let $num_rows = `SELECT COUNT(*) FROM performance_schema.replication_group_communication_information WHERE WRITE_CONSENSUS_LEADERS_ACTUAL LIKE '%$server1_uuid%' AND WRITE_CONSENSUS_LEADERS_ACTUAL LIKE '%$server2_uuid%'`
--let $assert_cond = "$num_rows" = "1"
--source include/assert.inc
--let $assert_text = Single Leader must be disabled
--let $assert_cond = "[SELECT WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE from performance_schema.replication_group_communication_information]" = "0"
--source include/assert.inc
# Verify preferred and active members of member 2
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text = All members should be in WRITE_CONSENSUS_LEADERS_PREFERRED
--let $num_rows = `SELECT COUNT(*) FROM performance_schema.replication_group_communication_information WHERE WRITE_CONSENSUS_LEADERS_PREFERRED LIKE '%$server1_uuid%' AND WRITE_CONSENSUS_LEADERS_PREFERRED LIKE '%$server2_uuid%'`
--let $assert_cond = "$num_rows" = "1"
--source include/assert.inc
--let $assert_text = All members should be in WRITE_CONSENSUS_LEADERS_ACTUAL
--let $num_rows = `SELECT COUNT(*) FROM performance_schema.replication_group_communication_information WHERE WRITE_CONSENSUS_LEADERS_ACTUAL LIKE '%$server1_uuid%' AND WRITE_CONSENSUS_LEADERS_ACTUAL LIKE '%$server2_uuid%'`
--let $assert_cond = "$num_rows" = "1"
--source include/assert.inc
--let $assert_text = Single Leader must be disabled
--let $assert_cond = "[SELECT WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE from performance_schema.replication_group_communication_information]" = "0"
--source include/assert.inc
--echo
--echo ####
--echo # 8) Change the sysvar value on the third member to true
--echo ####
--echo
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
SET GLOBAL group_replication_paxos_single_leader = 1;
--echo
--echo ####
--echo # 9) Try to add the third member
--echo ####
--echo
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
# The third member should not have been added
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $assert_text = All members should be in WRITE_CONSENSUS_LEADERS_PREFERRED
--let $num_rows = `SELECT COUNT(*) FROM performance_schema.replication_group_communication_information WHERE WRITE_CONSENSUS_LEADERS_PREFERRED LIKE '%$server1_uuid%' AND WRITE_CONSENSUS_LEADERS_PREFERRED LIKE '%$server2_uuid%'`
--let $assert_cond = "$num_rows" = "1"
--source include/assert.inc
--let $assert_text = All members should be in WRITE_CONSENSUS_LEADERS_ACTUAL
--let $num_rows = `SELECT COUNT(*) FROM performance_schema.replication_group_communication_information WHERE WRITE_CONSENSUS_LEADERS_ACTUAL LIKE '%$server1_uuid%' AND WRITE_CONSENSUS_LEADERS_ACTUAL LIKE '%$server2_uuid%'`
--let $assert_cond = "$num_rows" = "1"
--source include/assert.inc
--let $assert_text = Member 3 should not have been added to the group
--let $num_rows = `SELECT COUNT(*) FROM performance_schema.replication_group_members WHERE MEMBER_ID LIKE '%$server3_uuid%'`
--let $assert_cond = "$num_rows" = "0"
--source include/assert.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text = All members should be in WRITE_CONSENSUS_LEADERS_PREFERRED
--let $num_rows = `SELECT COUNT(*) FROM performance_schema.replication_group_communication_information WHERE WRITE_CONSENSUS_LEADERS_PREFERRED LIKE '%$server1_uuid%' AND WRITE_CONSENSUS_LEADERS_PREFERRED LIKE '%$server2_uuid%'`
--let $assert_cond = "$num_rows" = "1"
--source include/assert.inc
--let $assert_text = All members should be in WRITE_CONSENSUS_LEADERS_ACTUAL
--let $num_rows = `SELECT COUNT(*) FROM performance_schema.replication_group_communication_information WHERE WRITE_CONSENSUS_LEADERS_ACTUAL LIKE '%$server1_uuid%' AND WRITE_CONSENSUS_LEADERS_ACTUAL LIKE '%$server2_uuid%'`
--let $assert_cond = "$num_rows" = "1"
--source include/assert.inc
--let $assert_text = Member 3 should not have been added to the group
--let $num_rows = `SELECT COUNT(*) FROM performance_schema.replication_group_members WHERE MEMBER_ID LIKE '%$server3_uuid%'`
--let $assert_cond = "$num_rows" = "0"
--source include/assert.inc
--echo
--echo ####
--echo # 10) Cleanup.
--echo ####
--echo
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET GLOBAL group_replication_paxos_single_leader = 1;
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET GLOBAL group_replication_paxos_single_leader = 1;
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
SET GLOBAL group_replication_paxos_single_leader = 1;
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/group_replication_end.inc
|