polardbxengine/mysql-test/suite/group_replication/t/gr_parallel_stop_dml.test

108 lines
3.7 KiB
Plaintext

################################################################################
# BUG 21649247 - DML(INSERT) WITH STOP AND START GR RESULTS INTO CRASH POST
# 'BEFORE_COMMIT' ERROR
#
# The test verifies that the concurrent execution of START/STOP
# GROUP_REPLICATION and DML executing does not crash.
#
# Test:
# 0) The test requires two servers: M1 and M2.
# 1) With both members ONLINE. Create table t1 on M1. Then, block the stop
# group_replication after recovery module termination using DEBUG point.
# 2) Execute a DML to check if it crashes.
# 3) Check if the DML executing is blocked at this point.
# 4) Signal the waiting thread on stop group_replication.
# 5) Check for consistency on the two servers.
# 6) Clean up.
################################################################################
--source include/big_test.inc
--source include/have_debug_sync.inc
--source include/have_group_replication_plugin.inc
--source include/group_replication.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Transaction cannot be executed while Group Replication is stopping.");
call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
SET SESSION sql_log_bin= 1;
CREATE TABLE t1 (c1 INT PRIMARY KEY);
--source include/rpl_sync.inc
# Adding debug point to block the stop group_replication after recovery module termination.
--echo # Add a debug sync point in the code.
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
SET @@GLOBAL.DEBUG= @debug_save;
SET @@GLOBAL.DEBUG= 'd,group_replication_after_recovery_module_terminated';
--send STOP GROUP_REPLICATION
# Execute a DML to check if it crashes.
--echo # Inserting the DML which was causing crash.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: now'
--source include/wait_condition.inc
--send INSERT INTO t1 VALUES(1)
# Signal the waiting thread on stop group_replication.
--let $rpl_connection_name= server_1_1
--source include/rpl_connection.inc
--echo # Signal the waiting thread on connection server_1 to resume.
SET DEBUG_SYNC= "now SIGNAL signal.termination_continue";
SET @@GLOBAL.DEBUG= @debug_save;
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--reap
--echo # Asserting that the member here is offline.
--let $group_replication_member_state= OFFLINE
--source include/gr_wait_for_member_state.inc
--source include/assert_and_disable_read_only.inc
# Check for data on the two servers.
--echo # Asserting that only 1 member exists in the group.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $group_replication_number_of_members= 1
--source include/gr_wait_for_number_of_members.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--error ER_RUN_HOOK_ERROR
--reap
--echo # Asserting that no row exist in table t1 on server1.
--let $assert_text= The table should have 0 row inserted.
--let $assert_cond= `SELECT COUNT(*)=0 FROM t1`
--source include/assert.inc
--echo # Asserting that no row exist in table t1 on server2.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= The table should have 0 row inserted.
--let $assert_cond= `SELECT COUNT(*)=0 FROM t1`
--source include/assert.inc
# Rejoin server 1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/start_group_replication.inc
# Check for consistency on the two servers.
--let $diff_tables= server1:test.t1, server2:test.t1
--source include/diff_tables.inc
# Cleanup
--echo # Cleanup
DROP TABLE t1;
--source include/group_replication_end.inc