Debian Codegraph @

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

raw
1 ###############################################################################
2 #
3 # This testcase make sure correct messages are logged when member is not able
4 # to join the group due to a running group action configuration change.
5 #
6 # Test:
7 # 0. The test need two servers in multi primary mode
8 # 1. Activate debug point that will block the group action when changing
9 # to single primary mode
10 # 2. Execute action to change group to single primary mode
11 # 3. START GR on server2. Server2 will go in ERROR state.
12 # A new member cannot join group while an action is being executed.
13 # 4. Start replica on server 1. Replica will fail to start.
14 # Replica cannot start while an action is being executed.
15 # 5. Unlock the action on server 1 and reap the result.
16 # 6. Assert messages are present in the logs.
17 # 7. Cleanup
18 #
19 ###############################################################################
20
21 --source include/have_debug_sync.inc
22 --source include/have_group_replication_plugin.inc
23 --let $rpl_skip_group_replication_start= 1
24 --source include/group_replication.inc
25
26 --echo
27 --echo # 1. Activate debug point that will block the group action when changing
28 --echo # to single primary mode
29
30 set session sql_log_bin=0;
31 call mtr.add_suppression("A member is joining the group while a group configuration operation 'Change to single primary mode' is running*");
32 call mtr.add_suppression("Can't start SQL THREAD for channel 'ch1' when group replication is running a group configuration operation 'Change to single primary mode'*");
33 call mtr.add_suppression("Can't start IO THREAD for channel 'ch1' when group replication is running a group configuration operation 'Change to single primary mode'*");
34 call mtr.add_suppression("Run function 'thread_start' in plugin 'group_replication' failed");
35 call mtr.add_suppression("Replica I/O for channel 'ch1': Fatal error: Failed to run 'thread_start' hook, Error_code: MY-013117");
36 call mtr.add_suppression("Run function 'applier_start' in plugin 'group_replication' failed");
37 call mtr.add_suppression("Replica SQL for channel 'ch1': Fatal error: Failed to run 'applier_start' hook, Error_code: MY-013117");
38 set session sql_log_bin=1;
39
40 --replace_result $SERVER_MYPORT_2 SERVER_2_PORT
41 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_AUTO_POSITION=1, SOURCE_PORT=$SERVER_MYPORT_2, SOURCE_CONNECT_RETRY=1, SOURCE_RETRY_COUNT=1 FOR CHANNEL 'ch1'
42
43 SET @@GLOBAL.DEBUG= '+d,group_replication_block_group_action_stop';
44 --let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
45
46 --source include/start_and_bootstrap_group_replication.inc
47
48 --let $rpl_connection_name= server2
49 --source include/rpl_connection.inc
50
51 set session sql_log_bin=0;
52 call mtr.add_suppression("A member cannot join the group while a group configuration operation 'Change to single primary mode' is running initiated by *");
53 set session sql_log_bin=1;
54
55 --echo
56 --echo # 2. Execute action to change group to single primary mode
57
58 --let $rpl_connection_name= server1
59 --source include/rpl_connection.inc
60
61 --replace_result $server1_uuid MEMBER1_UUID
62 --send_eval SELECT group_replication_switch_to_single_primary_mode("$server1_uuid")
63
64 --let $rpl_connection_name= server_1
65 --source include/rpl_connection.inc
66
67 --let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch: waiting for%"
68 --source include/wait_condition.inc
69
70 --echo
71 --echo # 3. START GR on server2. Server2 will go in ERROR state.
72 --echo # A new member cannot join group while an action is being executed.
73
74 --let $rpl_connection_name= server2
75 --source include/rpl_connection.inc
76
77 --replace_result $group_replication_group_name GROUP_NAME
78 --eval SET GLOBAL group_replication_group_name= '$group_replication_group_name'
79
80 # Configure the member to use single-primary mode as server 1 is already configured
81 SET GLOBAL group_replication_enforce_update_everywhere_checks= FALSE;
82 SET GLOBAL group_replication_single_primary_mode= TRUE;
83 --error 0, ER_GROUP_REPLICATION_CONFIGURATION
84 START GROUP_REPLICATION;
85
86 --let $group_replication_number_of_members = 1
87 --source include/gr_wait_for_number_of_members.inc
88
89 --echo
90 --echo # 4. Start replica on server 1. Replica will fail to start.
91 --echo # Replica cannot start while an action is being executed.
92
93 --let $rpl_connection_name= server_1
94 --source include/rpl_connection.inc
95
96 START REPLICA FOR CHANNEL 'ch1';
97
98 --let $slave_io_errno= convert_error(ER_REPLICA_FATAL_ERROR)
99 --let $show_slave_io_error= 0
100
101 --let $slave_sql_errno= convert_error(ER_REPLICA_FATAL_ERROR)
102 --let $show_slave_sql_error= 0
103
104 --source include/wait_for_slave_io_error.inc
105 --source include/wait_for_slave_sql_error.inc
106
107 --echo
108 --echo # 5. Unlock the action on server 1 and reap the result.
109
110 SET @@GLOBAL.DEBUG= '-d,group_replication_block_group_action_stop';
111 SET DEBUG_SYNC= "now SIGNAL signal.action_stop_continue";
112
113 --let $rpl_connection_name= server1
114 --source include/rpl_connection.inc
115
116 --replace_result $server1_uuid MEMBER1_UUID
117 --reap
118
119 --echo
120 --echo # 6. Assert messages are present in the logs.
121
122 --let $rpl_connection_name= server1
123 --source include/rpl_connection.inc
124
125 --let $wait_condition= SELECT COUNT(*)>=1 FROM performance_schema.error_log WHERE error_code='MY-013208' AND data LIKE "%A member is joining the group while a group configuration operation 'Change to single primary mode' is running initiated by 'SELECT group_replication_switch_to_single_primary_mode()'. The member will now leave the group.%"
126 --source include/wait_condition.inc
127
128 --let $wait_condition= SELECT COUNT(*)>=1 FROM performance_schema.error_log WHERE error_code='MY-013209' AND data LIKE "%Can't start SQL THREAD for channel 'ch1' when group replication is running a group configuration operation 'Change to single primary mode' initiated by 'SELECT group_replication_switch_to_single_primary_mode()'.%"
129 --source include/wait_condition.inc
130
131 --let $wait_condition= SELECT COUNT(*)>=1 FROM performance_schema.error_log WHERE error_code='MY-013209' AND data LIKE "%Can't start IO THREAD for channel 'ch1' when group replication is running a group configuration operation 'Change to single primary mode' initiated by 'SELECT group_replication_switch_to_single_primary_mode()'.%"
132 --source include/wait_condition.inc
133
134 --let $rpl_connection_name= server2
135 --source include/rpl_connection.inc
136
137 --let $wait_condition= SELECT COUNT(*)>=1 FROM performance_schema.error_log WHERE error_code='MY-013207' AND data LIKE "%A member cannot join the group while a group configuration operation 'Change to single primary mode' is running initiated by 'SELECT group_replication_switch_to_single_primary_mode()'.%"
138 --source include/wait_condition.inc
139
140 --echo
141 --echo # 7. Cleanup
142
143 --let $rpl_connection_name= server1
144 --source include/rpl_connection.inc
145
146 RESET REPLICA ALL FOR CHANNEL 'ch1';
147
148 --let $rpl_group_replication_single_primary_mode=1
149 --let $rpl_group_replication_reset_persistent_vars=1
150 --source include/group_replication_end.inc