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
|
###############################################################################
#
# When changing to single primary mode, if more than one member
# contains running slave channels, the configuration change shall
# abort.
#
# Test:
#
# 0. This test requires 4 servers
# 1. server1 start group replication and server2 join
# 2. server1 have a slave connection to server3
# 3. server2 have a slave connection to server4
# 4. Execute action to single primary mode. It shall fail as more than
# one server has slave connections
# 5. Cleanup
#
###############################################################################
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 4
--source include/group_replication.inc
--echo
--echo # 1. server1 start group replication and server2 join
--source include/start_and_bootstrap_group_replication.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--echo
--echo # 2. server1 have a slave connection to server3
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--replace_result $SERVER_MYPORT_3 SERVER_3_PORT
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='localhost', SOURCE_USER='root', SOURCE_PORT=$SERVER_MYPORT_3 for channel 'ch3_1'
--let $rpl_channel_name='ch3_1'
--source include/start_slave.inc
--let $rpl_channel_name=
--echo #
--echo # 3. server2 have a slave connection to server4
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--replace_result $SERVER_MYPORT_4 SERVER_4_PORT
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='localhost', SOURCE_USER='root', SOURCE_PORT=$SERVER_MYPORT_4 for channel 'ch4_2'
--let $rpl_channel_name='ch4_2'
--source include/start_slave.inc
--let $rpl_channel_name=
--echo
--echo # 4. Execute action to single primary mode. It shall fail as more than
--echo # one server has slave connections
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--error ER_GRP_RPL_UDF_ERROR
SELECT group_replication_switch_to_single_primary_mode();
--source include/gr_assert_multi_primary_mode.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/gr_assert_multi_primary_mode.inc
--echo
--echo # 5. Cleanup
STOP SLAVE FOR CHANNEL 'ch3_1';
RESET SLAVE ALL FOR CHANNEL 'ch3_1';
set session sql_log_bin=0;
call mtr.add_suppression("Error while executing a group configuration operation: There is more than a member in the group with running replica channels*");
set session sql_log_bin=1;
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
STOP SLAVE FOR CHANNEL 'ch4_2';
RESET SLAVE ALL FOR CHANNEL 'ch4_2';
set session sql_log_bin=0;
call mtr.add_suppression("The function 'group_replication_switch_to_single_primary_mode' failed. There is more than a member in the group with running replica channels*");
set session sql_log_bin=1;
--source include/group_replication_end.inc
|