File: gr_stop_when_unreachable.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 (136 lines) | stat: -rw-r--r-- 4,452 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
################################################################################
# Verify that when a member is blocked on a minority and waiting on a blocked
# query, group replication can be stopped.
# Steps:
#   0) The test requires three servers: M1, M2 and M3.
#   1) Create a group with 3 members.
#   2) Create a minority situation with only 1 member alive: M1
#      Assert M2 and M3 are unreachable
#   3) Execute a query on M1 that will block
#   4) Stop group replication on M1.
#      The query should be killed.
#   5) Clean up.
################################################################################
# Don't test this under valgrind, memory leaks will occur
--source include/not_valgrind.inc
--source include/big_test.inc
--source include/force_restart.inc
--source include/have_group_replication_plugin.inc


--echo #
--echo # 1. Create a group with 3 members
--echo #    Extract each server uuid
--echo #    Create a table on it.
--echo #

--let $rpl_server_count= 3
--source include/group_replication.inc

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $member1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $member2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $member3_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)

CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
--source include/rpl_sync.inc

--echo #
--echo # 2. Crash server 2 and server 3
--echo # Check they are marked as unreachable
--echo #
# We do kill the servers, using shutdown_server 0, and then MTR will
# follow the expect file and restart the server, but we do not wait
# for the server restart.
# Since the servers loose its GCS configuration them will not rejoin
# the group.

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--shutdown_server 0
--source include/wait_until_disconnected.inc

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
--shutdown_server 0
--source include/wait_until_disconnected.inc

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

--let $group_replication_member_state= UNREACHABLE
--let $group_replication_member_id= $member2_uuid
--source include/gr_wait_for_member_state.inc

--let $group_replication_member_state= UNREACHABLE
--let $group_replication_member_id= $member3_uuid
--source include/gr_wait_for_member_state.inc

--let $group_replication_member_id= $member1_uuid

--echo #
--echo # 3. Execute a query that will block
--echo #

--send INSERT INTO t1 VALUES (2)

#Sleep 2 seconds for the query to block
--sleep 2

--echo #
--echo # 4. Stop Group Replication on server 1
--echo #    The pending query should die
--echo #

--let $rpl_connection_name= server_1
--source include/rpl_connection.inc

--let $$wait_timeout= 120
--source include/stop_group_replication.inc

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

--error ER_RUN_HOOK_ERROR
--reap

--echo #
--echo # 5. Clean up.
--echo #

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
DROP TABLE t1;

set session sql_log_bin=0;
call mtr.add_suppression("The member lost contact with a majority of the members in the group. Until the network is restored.*");
call mtr.add_suppression("Due to a plugin error, some transactions were unable to be certified and will now rollback.");
call mtr.add_suppression("Timeout while waiting for the group communication engine to exit!");
call mtr.add_suppression("The member has failed to gracefully leave the group.");
call mtr.add_suppression("read failed");
call mtr.add_suppression("Error while waiting for conflict detection procedure to finish on session .*");
call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
set session sql_log_bin=1;

--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--let $rpl_server_number= 2
--source include/rpl_reconnect.inc
DROP TABLE t1;

--let $rpl_connection_name= server_3
--source include/rpl_connection.inc
--let $rpl_server_number= 3
--source include/rpl_reconnect.inc
DROP TABLE t1;

--source include/group_replication_end.inc