Debian Codegraph @

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

raw
1 ################################################################################
2 # BUG 21649247 - DML(INSERT) WITH STOP AND START GR RESULTS INTO CRASH POST
3 # 'BEFORE_COMMIT' ERROR
4 #
5 # The test verifies that the concurrent execution of START/STOP
6 # GROUP_REPLICATION and DML executing does not crash.
7 #
8 # Test:
9 # 0) The test requires two servers: M1 and M2.
10 # 1) With both members ONLINE. Create table t1 on M1. Then, block the stop
11 # group_replication after recovery module termination using DEBUG point.
12 # 2) Execute a DML to check if it crashes.
13 # 3) Check if the DML executing is blocked at this point.
14 # 4) Signal the waiting thread on stop group_replication.
15 # 5) Check for consistency on the two servers.
16 # 6) Clean up.
17 ################################################################################
18
19 --source include/big_test.inc
20 --source include/have_debug_sync.inc
21 --source include/have_group_replication_plugin.inc
22 --source include/group_replication.inc
23
24 --let $rpl_connection_name= server1
25 --source include/rpl_connection.inc
26 SET SESSION sql_log_bin= 0;
27 call mtr.add_suppression("Transaction cannot be executed while Group Replication is stopping.");
28 call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
29 SET SESSION sql_log_bin= 1;
30
31 CREATE TABLE t1 (c1 INT PRIMARY KEY);
32 --source include/rpl_sync.inc
33
34 # Adding debug point to block the stop group_replication after recovery module termination.
35
36 --echo # Add a debug sync point in the code.
37 --let $rpl_connection_name= server_1
38 --source include/rpl_connection.inc
39 SET @@GLOBAL.DEBUG= @debug_save;
40 SET @@GLOBAL.DEBUG= 'd,group_replication_after_recovery_module_terminated';
41
42 --send STOP GROUP_REPLICATION
43
44 # Execute a DML to check if it crashes.
45 --echo # Inserting the DML which was causing crash.
46 --let $rpl_connection_name= server1
47 --source include/rpl_connection.inc
48 --let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: now'
49 --source include/wait_condition.inc
50
51 --send INSERT INTO t1 VALUES(1)
52
53 # Signal the waiting thread on stop group_replication.
54 --let $rpl_connection_name= server_1_1
55 --source include/rpl_connection.inc
56 --echo # Signal the waiting thread on connection server_1 to resume.
57 SET DEBUG_SYNC= "now SIGNAL signal.termination_continue";
58 SET @@GLOBAL.DEBUG= @debug_save;
59
60 --let $rpl_connection_name= server_1
61 --source include/rpl_connection.inc
62 --reap
63
64 --echo # Asserting that the member here is offline.
65 --let $group_replication_member_state= OFFLINE
66 --source include/gr_wait_for_member_state.inc
67 --source include/assert_and_disable_read_only.inc
68
69 # Check for data on the two servers.
70
71 --echo # Asserting that only 1 member exists in the group.
72 --let $rpl_connection_name= server2
73 --source include/rpl_connection.inc
74 --let $group_replication_number_of_members= 1
75 --source include/gr_wait_for_number_of_members.inc
76
77 --let $rpl_connection_name= server1
78 --source include/rpl_connection.inc
79 --error ER_RUN_HOOK_ERROR, ER_OPTION_PREVENTS_STATEMENT
80 --reap
81
82 --echo # Asserting that no row exist in table t1 on server1.
83 --let $assert_text= The table should have 0 row inserted.
84 --let $assert_cond= `SELECT COUNT(*)=0 FROM t1`
85 --source include/assert.inc
86
87 --echo # Asserting that no row exist in table t1 on server2.
88 --let $rpl_connection_name= server2
89 --source include/rpl_connection.inc
90 --let $assert_text= The table should have 0 row inserted.
91 --let $assert_cond= `SELECT COUNT(*)=0 FROM t1`
92 --source include/assert.inc
93
94 # Rejoin server 1.
95 --let $rpl_connection_name= server1
96 --source include/rpl_connection.inc
97 --source include/start_group_replication.inc
98
99 # Check for consistency on the two servers.
100
101 --let $diff_tables= server1:test.t1, server2:test.t1
102 --source include/diff_tables.inc
103
104 # Cleanup
105 --echo # Cleanup
106 DROP TABLE t1;
107 --source include/group_replication_end.inc