################################################################################ # Validate Group Replication can be stopped even when replication channels are # committing transactions concurrently. # # Test: # 0. This test requires 2 servers: # server1: group member # server2: single server # 1. Deploy a group on server1. # 2. Configure a channel on server1 that replicates from # server2. # 3. Stop group on server1, through debug sync block the stop # after acquiring `shared_plugin_stop` lock. # 4. Commit a transaction on server2 which will be replicated # to server1 through channel 'ch1'. # Channel 'ch1' will fail since the plugin is stopping. # 5. Resume STOP GROUP_REPLICATION on server1. # 6. Clean up. ############################################################################### --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 ############################################################ --echo # 1. Deploy a group on server1. --let $rpl_connection_name= server1 --source include/rpl_connection.inc SET SESSION sql_log_bin = 0; call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed"); call mtr.add_suppression("Replica SQL for channel 'ch1': Worker 1 failed executing transaction.*"); call mtr.add_suppression("Replica SQL for channel 'ch1': ... The replica coordinator and worker threads are stopped.*"); call mtr.add_suppression("Replica SQL for channel 'ch1': Error 'Error on observer while running replication hook 'before_commit'.'.*"); call mtr.add_suppression("Replica: Error on observer while running replication hook 'before_commit'. Error_code: MY-003100"); SET SESSION sql_log_bin = 1; --source include/start_and_bootstrap_group_replication.inc --echo --echo ############################################################ --echo # 2. Configure a channel on server1 that replicates from --echo # server2. --let $rpl_connection_name= server1 --source include/rpl_connection.inc --replace_result $SERVER_MYPORT_2 SERVER_2_PORT --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_PORT=$SERVER_MYPORT_2, SOURCE_AUTO_POSITION=1 FOR CHANNEL 'ch1' --let $rpl_channel_name='ch1' --source include/start_slave.inc --echo --echo ############################################################ --echo # 3. Stop group on server1, through debug sync block the stop --echo # after acquiring `shared_plugin_stop` lock. --let $rpl_connection_name= server_1 --source include/rpl_connection.inc SET @@GLOBAL.DEBUG= '+d,group_replication_hold_stop_before_leave_the_group'; --send STOP GROUP_REPLICATION --let $rpl_connection_name= server1 --source include/rpl_connection.inc SET DEBUG_SYNC='now wait_for signal.stopping_before_leave_the_group'; --echo --echo ############################################################ --echo # 4. Commit a transaction on server2 which will be replicated --echo # to server1 through channel 'ch1'. --echo # Channel 'ch1' will fail since the plugin is stopping. --let $rpl_connection_name= server2 --source include/rpl_connection.inc CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY); --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $slave_sql_errno= convert_error(ER_RUN_HOOK_ERROR) --let $rpl_channel_name= 'ch1' --source include/wait_for_slave_sql_error.inc --echo --echo ############################################################ --echo # 5. Resume STOP GROUP_REPLICATION on server1. --let $rpl_connection_name= server1 --source include/rpl_connection.inc SET @@GLOBAL.DEBUG= '-d,group_replication_hold_stop_before_leave_the_group'; SET DEBUG_SYNC='now signal signal.resume_stop_before_leave_the_group'; --let $rpl_connection_name= server_1 --source include/rpl_connection.inc --reap --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $group_replication_member_state = OFFLINE --source include/gr_wait_for_member_state.inc SET DEBUG_SYNC= 'RESET'; --let $assert_text= 'There is no table t1 on server1' --let $assert_cond= [SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_SCHEMA=\"test\" AND TABLE_NAME=\"t1\"] = 0 --source include/assert.inc --echo --echo ############################################################ --echo # 6. Clean up. --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $rpl_channel_name='ch1' --let $rpl_multi_source= 1 --let $rpl_reset_slave_all= 1 --source include/rpl_reset_slave.inc --let $rpl_channel_name= --let $rpl_multi_source= --let $rpl_connection_name= server2 --source include/rpl_connection.inc DROP TABLE t1; --source include/group_replication_end.inc