File: gr_parallel_stop_dml.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (107 lines) | stat: -rw-r--r-- 3,864 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
################################################################################
# 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, ER_OPTION_PREVENTS_STATEMENT
--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