################################################################################ # Validate that when the "Group replication applier module" thread is killed, on # the next event that goes through it, the member moves to ERROR state. # # Test: # 0. The test requires two servers M1 & M2 # 1. Create a table t1 on the group. # 2. Kill the "Group replication applier module" thread on # 3. Commit a transaction on server2. # Once the transaction message is delivered to server1, # the applier module will be awaken and it will detect # that its thread was killed, which will move the # member to ERROR state. # 4. Server1 will move to ERROR state. # 5. Server2 is ONLINE and alone on the group. # 6. Clean up ################################################################################ --source include/have_group_replication_plugin.inc --source include/group_replication.inc --echo --echo ############################################################ --echo # 1. Create a table t1 on the group. --let $rpl_connection_name= server1 --source include/rpl_connection.inc SET sql_log_bin=0; call mtr.add_suppression("The group replication applier thread has received KILL request."); call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group."); call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); call mtr.add_suppression("Error writing relay log configuration."); call mtr.add_suppression("Failed to stop the group replication applier thread."); SET sql_log_bin=1; CREATE TABLE test.t1 (c1 INT NOT NULL PRIMARY KEY); --source include/rpl_sync.inc --echo --echo ############################################################ --echo # 2. Kill the "Group replication applier module" thread on --echo # server1. --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $processlist_id= `SELECT PROCESSLIST_ID FROM performance_schema.threads WHERE NAME="thread/group_rpl/THD_applier_module_receiver"` --replace_result $processlist_id PROCESSLIST_ID --eval KILL $processlist_id --echo --echo ############################################################ --echo # 3. Commit a transaction on server2. --echo # Once the transaction message is delivered to server1, --echo # the applier module will be awaken and it will detect --echo # that its thread was killed, which will move the --echo # member to ERROR state. --let $rpl_connection_name= server2 --source include/rpl_connection.inc INSERT INTO t1 VALUES (1); --echo --echo ############################################################ --echo # 4. Server1 will move to ERROR state. --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $group_replication_member_state = ERROR --source include/gr_wait_for_member_state.inc --let $wait_condition=SELECT COUNT(*)=0 FROM performance_schema.threads WHERE NAME="thread/group_rpl/THD_applier_module_receiver" --source include/wait_condition.inc # Assert that the expected entry is in the error log during KILL command --let $assert_text= Assert that the expected entry is in the error log during KILL command --let $assert_file=$MYSQLTEST_VARDIR/log/mysqld.1.err --let $assert_only_after = Received SQL KILL from user --let $assert_select= The group replication applier thread has received KILL request --let $assert_count= 1 --source include/assert_grep.inc --echo --echo ############################################################ --echo # 5. Server2 is ONLINE and alone on the group. --let $rpl_connection_name= server2 --source include/rpl_connection.inc --let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE" --source include/wait_condition.inc --echo --echo ############################################################ --echo # 6. Clean up. --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source include/stop_group_replication.inc --source include/start_group_replication.inc DROP TABLE t1; --source include/group_replication_end.inc