| 1 |
############################################################################### |
| 2 |
# |
| 3 |
# When a member with a lower version is present all members shall use the old |
| 4 |
# primary election algorithm. |
| 5 |
# |
| 6 |
# Test: |
| 7 |
# 0. This test requires three servers |
| 8 |
# 1. Bootstrap group replication on server1 with 8.0.12 version. |
| 9 |
# 2. Configure server2 with 8.0.12 version, and start group replication |
| 10 |
# 3. Start group replication on server3 with a higher weight |
| 11 |
# 4. Stop group replication on server1 to force election of a new primary |
| 12 |
# 5. Check server3 is the primary and server2 the secondary |
| 13 |
# 6. Increase the weight on server2 |
| 14 |
# 7. Start group replication on server1 |
| 15 |
# 8. Stop group replication on server3 to force election of a new primary |
| 16 |
# 9. Check server2 is the primary and server1 the secondary |
| 17 |
# 10. Check the messages logged were for legacy elections. |
| 18 |
# 11. Check also that an action cannot be executed when a member with an |
| 19 |
# older version is present. |
| 20 |
# 12. Cleanup |
| 21 |
# |
| 22 |
############################################################################### |
| 23 |
|
| 24 |
--source include/big_test.inc |
| 25 |
--source include/have_debug.inc |
| 26 |
--source include/have_group_replication_plugin.inc |
| 27 |
--let $rpl_server_count= 3 |
| 28 |
--let $rpl_skip_group_replication_start= 1 |
| 29 |
--let $rpl_group_replication_single_primary_mode=1 |
| 30 |
--source include/group_replication.inc |
| 31 |
|
| 32 |
--echo |
| 33 |
--echo # 1. Bootstrap group replication on server1 with 8.0.12 version. |
| 34 |
|
| 35 |
set session sql_log_bin=0; |
| 36 |
call mtr.add_suppression("The function 'group_replication_switch_to_multi_primary_mode' failed. The group has a member with a version that does not support group coordinated operations."); |
| 37 |
set session sql_log_bin=1; |
| 38 |
SET @debug1_save= @@GLOBAL.DEBUG; |
| 39 |
# Make server1 lower version so others can join group, |
| 40 |
# since patch level is considered lower versions will not join later |
| 41 |
SET @@GLOBAL.DEBUG= '+d,group_replication_legacy_election_version'; |
| 42 |
--source include/start_and_bootstrap_group_replication.inc |
| 43 |
|
| 44 |
--echo |
| 45 |
--echo # 2. Configure server2 with 8.0.12 version, and start group replication |
| 46 |
|
| 47 |
--let $rpl_connection_name= server2 |
| 48 |
--source include/rpl_connection.inc |
| 49 |
|
| 50 |
set session sql_log_bin=0; |
| 51 |
call mtr.add_suppression("Error while executing a group configuration operation: The group has a member with a version that does not support group coordinated operations."); |
| 52 |
set session sql_log_bin=1; |
| 53 |
|
| 54 |
# Cause the member to broadcast and compare himself using a minor version |
| 55 |
SET @debug2_save= @@GLOBAL.DEBUG; |
| 56 |
SET @@GLOBAL.DEBUG= '+d,group_replication_legacy_election_version'; |
| 57 |
|
| 58 |
--source include/start_group_replication.inc |
| 59 |
|
| 60 |
--echo |
| 61 |
--echo # 3. Start group replication on server3 with a higher weight |
| 62 |
|
| 63 |
--let $rpl_connection_name= server3 |
| 64 |
--source include/rpl_connection.inc |
| 65 |
|
| 66 |
SET GLOBAL group_replication_member_weight= 90; |
| 67 |
# server1 started with legacy version, so server2 and server3 are read compatible |
| 68 |
set session sql_log_bin=0; |
| 69 |
call mtr.add_suppression("Member version is read compatible with the group."); |
| 70 |
set session sql_log_bin=1; |
| 71 |
|
| 72 |
--source include/start_group_replication.inc |
| 73 |
|
| 74 |
--echo |
| 75 |
--echo # 4. Stop group replication on server1 to force election of a new primary |
| 76 |
|
| 77 |
--let $rpl_connection_name= server1 |
| 78 |
--source include/rpl_connection.inc |
| 79 |
|
| 80 |
--source include/stop_group_replication.inc |
| 81 |
|
| 82 |
--echo |
| 83 |
--echo # 5. Check server3 is the primary and server2 the secondary |
| 84 |
|
| 85 |
--let $rpl_connection_name= server3 |
| 86 |
--source include/rpl_connection.inc |
| 87 |
|
| 88 |
--source include/gr_assert_primary_member.inc |
| 89 |
|
| 90 |
--let $rpl_connection_name= server2 |
| 91 |
--source include/rpl_connection.inc |
| 92 |
|
| 93 |
--source include/gr_assert_secondary_member.inc |
| 94 |
|
| 95 |
--echo |
| 96 |
--echo # 6. Increase the weight on server2 |
| 97 |
|
| 98 |
SET GLOBAL group_replication_member_weight= 95; |
| 99 |
|
| 100 |
--echo |
| 101 |
--echo # 7. Start group replication on server1 |
| 102 |
|
| 103 |
--let $rpl_connection_name= server1 |
| 104 |
--source include/rpl_connection.inc |
| 105 |
|
| 106 |
--source include/start_group_replication.inc |
| 107 |
|
| 108 |
--echo |
| 109 |
--echo # 8. Stop group replication on server3 to force election of a new primary |
| 110 |
|
| 111 |
--let $rpl_connection_name= server3 |
| 112 |
--source include/rpl_connection.inc |
| 113 |
|
| 114 |
--source include/stop_group_replication.inc |
| 115 |
|
| 116 |
--echo |
| 117 |
--echo # 9. Check server2 is the primary and server1 the secondary |
| 118 |
|
| 119 |
--let $rpl_connection_name= server2 |
| 120 |
--source include/rpl_connection.inc |
| 121 |
|
| 122 |
--source include/gr_assert_primary_member.inc |
| 123 |
|
| 124 |
--let $rpl_connection_name= server1 |
| 125 |
--source include/rpl_connection.inc |
| 126 |
|
| 127 |
--source include/gr_assert_secondary_member.inc |
| 128 |
|
| 129 |
--echo |
| 130 |
--echo # 10. Check the messages logged were for legacy elections. |
| 131 |
|
| 132 |
--sleep 1 |
| 133 |
|
| 134 |
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err |
| 135 |
--let $assert_count = 2 |
| 136 |
--let $assert_select = was elected. Enabling conflict detection until the new primary applies all relay logs. |
| 137 |
--let $assert_text = Found the messages for two elections |
| 138 |
--source include/assert_grep.inc |
| 139 |
|
| 140 |
--echo |
| 141 |
--echo # 11. Check also that an action cannot be executed |
| 142 |
--echo # when a member with an older version is present. |
| 143 |
|
| 144 |
--error ER_GRP_RPL_UDF_ERROR |
| 145 |
SELECT group_replication_switch_to_multi_primary_mode(); |
| 146 |
|
| 147 |
--echo |
| 148 |
--echo # 12. Cleanup |
| 149 |
|
| 150 |
SET @@GLOBAL.DEBUG= @debug1_save; |
| 151 |
|
| 152 |
--let $rpl_connection_name= server2 |
| 153 |
--source include/rpl_connection.inc |
| 154 |
|
| 155 |
--source include/stop_group_replication.inc |
| 156 |
|
| 157 |
SET @@GLOBAL.DEBUG= @debug2_save; |
| 158 |
SET @@GLOBAL.group_replication_member_weight= DEFAULT; |
| 159 |
|
| 160 |
--let $rpl_connection_name= server3 |
| 161 |
--source include/rpl_connection.inc |
| 162 |
|
| 163 |
SET @@GLOBAL.group_replication_member_weight= DEFAULT; |
| 164 |
|
| 165 |
--source include/group_replication_end.inc |