############################################################################### # # This testcase make sure correct messages are logged when member is not able # to join the group due to a running group action configuration change. # # Test: # 0. The test need two servers in multi primary mode # 1. Activate debug point that will block the group action when changing # to single primary mode # 2. Execute action to change group to single primary mode # 3. START GR on server2. Server2 will go in ERROR state. # A new member cannot join group while an action is being executed. # 4. Start replica on server 1. Replica will fail to start. # Replica cannot start while an action is being executed. # 5. Unlock the action on server 1 and reap the result. # 6. Assert messages are present in the logs. # 7. Cleanup # ############################################################################### --source include/have_debug_sync.inc --source include/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --source include/group_replication.inc --echo --echo # 1. Activate debug point that will block the group action when changing --echo # to single primary mode set session sql_log_bin=0; call mtr.add_suppression("A member is joining the group while a group configuration operation 'Change to single primary mode' is running*"); 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'*"); 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'*"); call mtr.add_suppression("Run function 'thread_start' in plugin 'group_replication' failed"); call mtr.add_suppression("Replica I/O for channel 'ch1': Fatal error: Failed to run 'thread_start' hook, Error_code: MY-013117"); call mtr.add_suppression("Run function 'applier_start' in plugin 'group_replication' failed"); call mtr.add_suppression("Replica SQL for channel 'ch1': Fatal error: Failed to run 'applier_start' hook, Error_code: MY-013117"); set session sql_log_bin=1; --replace_result $SERVER_MYPORT_2 SERVER_2_PORT --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' SET @@GLOBAL.DEBUG= '+d,group_replication_block_group_action_stop'; --let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) --source include/start_and_bootstrap_group_replication.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc set session sql_log_bin=0; call mtr.add_suppression("A member cannot join the group while a group configuration operation 'Change to single primary mode' is running initiated by *"); set session sql_log_bin=1; --echo --echo # 2. Execute action to change group to single primary mode --let $rpl_connection_name= server1 --source include/rpl_connection.inc --replace_result $server1_uuid MEMBER1_UUID --send_eval SELECT group_replication_switch_to_single_primary_mode("$server1_uuid") --let $rpl_connection_name= server_1 --source include/rpl_connection.inc --let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch: waiting for%" --source include/wait_condition.inc --echo --echo # 3. START GR on server2. Server2 will go in ERROR state. --echo # A new member cannot join group while an action is being executed. --let $rpl_connection_name= server2 --source include/rpl_connection.inc --replace_result $group_replication_group_name GROUP_NAME --eval SET GLOBAL group_replication_group_name= '$group_replication_group_name' # Configure the member to use single-primary mode as server 1 is already configured SET GLOBAL group_replication_enforce_update_everywhere_checks= FALSE; SET GLOBAL group_replication_single_primary_mode= TRUE; --error 0, ER_GROUP_REPLICATION_CONFIGURATION START GROUP_REPLICATION; --let $group_replication_number_of_members = 1 --source include/gr_wait_for_number_of_members.inc --echo --echo # 4. Start replica on server 1. Replica will fail to start. --echo # Replica cannot start while an action is being executed. --let $rpl_connection_name= server_1 --source include/rpl_connection.inc START REPLICA FOR CHANNEL 'ch1'; --let $slave_io_errno= convert_error(ER_REPLICA_FATAL_ERROR) --let $show_slave_io_error= 0 --let $slave_sql_errno= convert_error(ER_REPLICA_FATAL_ERROR) --let $show_slave_sql_error= 0 --source include/wait_for_slave_io_error.inc --source include/wait_for_slave_sql_error.inc --echo --echo # 5. Unlock the action on server 1 and reap the result. SET @@GLOBAL.DEBUG= '-d,group_replication_block_group_action_stop'; SET DEBUG_SYNC= "now SIGNAL signal.action_stop_continue"; --let $rpl_connection_name= server1 --source include/rpl_connection.inc --replace_result $server1_uuid MEMBER1_UUID --reap --echo --echo # 6. Assert messages are present in the logs. --let $rpl_connection_name= server1 --source include/rpl_connection.inc --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.%" --source include/wait_condition.inc --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()'.%" --source include/wait_condition.inc --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()'.%" --source include/wait_condition.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc --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()'.%" --source include/wait_condition.inc --echo --echo # 7. Cleanup --let $rpl_connection_name= server1 --source include/rpl_connection.inc RESET REPLICA ALL FOR CHANNEL 'ch1'; --let $rpl_group_replication_single_primary_mode=1 --let $rpl_group_replication_reset_persistent_vars=1 --source include/group_replication_end.inc