Debian Codegraph @

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

raw
1 ###############################################################################
2 #
3 # When changing to single primary mode, if more than one member
4 # contains running slave channels, the configuration change shall
5 # abort.
6 #
7 # Test:
8 #
9 # 0. This test requires 4 servers
10 # 1. server1 start group replication and server2 join
11 # 2. server1 have a slave connection to server3
12 # 3. server2 have a slave connection to server4
13 # 4. Execute action to single primary mode. It shall fail as more than
14 # one server has slave connections
15 # 5. Cleanup
16 #
17 ###############################################################################
18
19 --source include/have_group_replication_plugin.inc
20 --let $rpl_skip_group_replication_start= 1
21 --let $rpl_server_count= 4
22 --source include/group_replication.inc
23
24 --echo
25 --echo # 1. server1 start group replication and server2 join
26
27 --source include/start_and_bootstrap_group_replication.inc
28
29 --let $rpl_connection_name= server2
30 --source include/rpl_connection.inc
31 --source include/start_group_replication.inc
32
33 --echo
34 --echo # 2. server1 have a slave connection to server3
35
36 --let $rpl_connection_name= server1
37 --source include/rpl_connection.inc
38 --replace_result $SERVER_MYPORT_3 SERVER_3_PORT
39 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='localhost', SOURCE_USER='root', SOURCE_PORT=$SERVER_MYPORT_3 for channel 'ch3_1'
40
41 --let $rpl_channel_name='ch3_1'
42 --source include/start_slave.inc
43 --let $rpl_channel_name=
44
45 --echo #
46 --echo # 3. server2 have a slave connection to server4
47
48 --let $rpl_connection_name= server2
49 --source include/rpl_connection.inc
50 --replace_result $SERVER_MYPORT_4 SERVER_4_PORT
51 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='localhost', SOURCE_USER='root', SOURCE_PORT=$SERVER_MYPORT_4 for channel 'ch4_2'
52
53 --let $rpl_channel_name='ch4_2'
54 --source include/start_slave.inc
55 --let $rpl_channel_name=
56
57 --echo
58 --echo # 4. Execute action to single primary mode. It shall fail as more than
59 --echo # one server has slave connections
60
61 --let $rpl_connection_name= server2
62 --source include/rpl_connection.inc
63
64 --error ER_GRP_RPL_UDF_ERROR
65 SELECT group_replication_switch_to_single_primary_mode();
66
67 --source include/gr_assert_multi_primary_mode.inc
68
69 --let $rpl_connection_name= server1
70 --source include/rpl_connection.inc
71
72 --source include/gr_assert_multi_primary_mode.inc
73
74 --echo
75 --echo # 5. Cleanup
76
77 STOP SLAVE FOR CHANNEL 'ch3_1';
78 RESET SLAVE ALL FOR CHANNEL 'ch3_1';
79
80 set session sql_log_bin=0;
81 call mtr.add_suppression("Error while executing a group configuration operation: There is more than a member in the group with running replica channels*");
82 set session sql_log_bin=1;
83
84 --let $rpl_connection_name= server2
85 --source include/rpl_connection.inc
86 STOP SLAVE FOR CHANNEL 'ch4_2';
87 RESET SLAVE ALL FOR CHANNEL 'ch4_2';
88
89 set session sql_log_bin=0;
90 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*");
91 set session sql_log_bin=1;
92
93 --source include/group_replication_end.inc