Debian Codegraph @

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

raw
1 ###############################################################################
2 #
3 # When a configuration change involving primary election is
4 # running no slave channels can be start in the group members.
5 #
6 # Test:
7 # 0. This test need 3 servers
8 # 1. server1 start group replication and server2 join
9 # 2. Activate debug point that will block the group action when changing
10 # to single primary mode
11 # 3. Execute action to change group to single primary mode
12 # 4. Start a slave connection on server1 to server3.
13 # It should fail, since a group action is ongoing.
14 # 5. Verify occurrence of error message
15 # 6. Unlock the action
16 # 7. Clean up
17 #
18 ###############################################################################
19
20 --source include/have_debug_sync.inc
21 --source include/have_group_replication_plugin.inc
22 --let $rpl_skip_group_replication_start= 1
23 --let $rpl_server_count= 3
24 --source include/group_replication.inc
25
26 --echo
27 --echo # 1. server1 start group replication and server2 join
28
29 set session sql_log_bin=0;
30 call mtr.add_suppression("Can't start IO THREAD for channel 'ch3_1' when group replication is running a group configuration operation 'Change to single primary mode'*");
31 call mtr.add_suppression("Run function 'thread_start' in plugin 'group_replication' failed");
32 call mtr.add_suppression("Replica I/O for channel 'ch3_1': Fatal error: Failed to run 'thread_start' hook, Error_code:*");
33 call mtr.add_suppression("Can't start SQL THREAD for channel 'ch3_1' when group replication is running a group configuration operation 'Change to single primary mode'*");
34 call mtr.add_suppression("Run function 'applier_start' in plugin 'group_replication' failed");
35 call mtr.add_suppression("Replica SQL for channel 'ch3_1': Fatal error: Failed to run 'applier_start' hook, Error_code:*");
36 set session sql_log_bin=1;
37
38 --source include/start_and_bootstrap_group_replication.inc
39
40 --let $rpl_connection_name= server2
41 --source include/rpl_connection.inc
42 --source include/start_group_replication.inc
43
44 --echo
45 --echo # 2. Activate debug point that will block the group action when changing
46 --echo # to single primary mode
47
48 SET @@GLOBAL.DEBUG= '+d,group_replication_block_group_action';
49 --let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
50
51 --echo
52 --echo # 3. Execute action to change group to single primary mode
53
54 --replace_result $server2_uuid MEMBER1_UUID
55 --send_eval SELECT group_replication_switch_to_single_primary_mode("$server2_uuid")
56
57 --echo
58 --echo # 4. Start a slave connection on server1 to server3. Should fail, action
59 --echo # is ongoing
60
61 --let $rpl_connection_name= server1
62 --source include/rpl_connection.inc
63
64 --let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch: checking group pre-conditions%"
65 --source include/wait_condition.inc
66
67 --replace_result $SERVER_MYPORT_3 SERVER_3_PORT
68 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='localhost', SOURCE_USER='root', SOURCE_PORT=$SERVER_MYPORT_3 for channel 'ch3_1'
69
70 --let $rpl_channel_name='ch3_1'
71
72 --let $slave_io_errno= convert_error(ER_REPLICA_FATAL_ERROR)
73 --let $show_slave_io_error= 0
74 --let $slave_io_error_replace= / at [0-9]*/ at XXX/
75
76 --let $slave_sql_errno= convert_error(ER_REPLICA_FATAL_ERROR)
77 --let $show_slave_sql_error= 0
78 --let $slave_sql_error_replace= / at [0-9]*/ at XXX/
79
80 START SLAVE FOR CHANNEL 'ch3_1';
81 --source include/wait_for_slave_io_error.inc
82 --source include/wait_for_slave_sql_error.inc
83
84 --let $rpl_channel_name=
85
86 --echo
87 --echo # 5. Verify occurrence of error message
88
89 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
90 --let $assert_count = 1
91 --let $assert_select = Can't start IO THREAD for channel 'ch3_1' when group replication is running a group configuration operation
92 --let $assert_text = Found the expected error about failure to start slave IO THREAD.
93 --source include/assert_grep.inc
94
95 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
96 --let $assert_count = 1
97 --let $assert_select = Can't start SQL THREAD for channel 'ch3_1' when group replication is running a group configuration operation
98 --let $assert_text = Found the expected error about failure to start slave SQL THREAD.
99 --source include/assert_grep.inc
100
101 --echo
102 --echo # 6. Unlock the action
103
104 --let $rpl_connection_name= server_2
105 --source include/rpl_connection.inc
106
107 SET DEBUG_SYNC= "now SIGNAL signal.action_continue";
108
109 --let $rpl_connection_name= server2
110 --source include/rpl_connection.inc
111
112 --replace_result $server2_uuid MEMBER1_UUID
113 --reap
114
115 --echo
116 --echo # 7. Clean up
117
118 --let $rpl_connection_name= server1
119 --source include/rpl_connection.inc
120
121 RESET SLAVE ALL FOR CHANNEL 'ch3_1';
122
123 --let $rpl_connection_name= server2
124 --source include/rpl_connection.inc
125
126 SET @@GLOBAL.DEBUG= '-d,group_replication_block_group_action';
127
128 --let $rpl_group_replication_single_primary_mode=1
129 --let $rpl_group_replication_reset_persistent_vars=1
130 --source include/group_replication_end.inc