Debian Codegraph @

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

raw
1 ################################################################################
2 # Verify that when a member is blocked on a minority and waiting on a blocked
3 # query, group replication can be stopped.
4 # Steps:
5 # 0) The test requires three servers: M1, M2 and M3.
6 # 1) Create a group with 3 members.
7 # 2) Create a minority situation with only 1 member alive: M1
8 # Assert M2 and M3 are unreachable
9 # 3) Execute a query on M1 that will block
10 # 4) Stop group replication on M1.
11 # The query should be killed.
12 # 5) Clean up.
13 ################################################################################
14 # Don't test this under valgrind, memory leaks will occur
15 --source include/not_valgrind.inc
16 --source include/big_test.inc
17 --source include/force_restart.inc
18 --source include/have_group_replication_plugin.inc
19
20
21 --echo #
22 --echo # 1. Create a group with 3 members
23 --echo # Extract each server uuid
24 --echo # Create a table on it.
25 --echo #
26
27 --let $rpl_server_count= 3
28 --source include/group_replication.inc
29
30 --let $rpl_connection_name= server1
31 --source include/rpl_connection.inc
32 --let $member1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
33
34 --let $rpl_connection_name= server2
35 --source include/rpl_connection.inc
36 --let $member2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
37
38 --let $rpl_connection_name= server3
39 --source include/rpl_connection.inc
40 --let $member3_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
41
42 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
43 --source include/rpl_sync.inc
44
45 --echo #
46 --echo # 2. Crash server 2 and server 3
47 --echo # Check they are marked as unreachable
48 --echo #
49 # We do kill the servers, using shutdown_server 0, and then MTR will
50 # follow the expect file and restart the server, but we do not wait
51 # for the server restart.
52 # Since the servers loose its GCS configuration them will not rejoin
53 # the group.
54
55 --let $rpl_connection_name= server2
56 --source include/rpl_connection.inc
57 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
58 --shutdown_server 0
59 --source include/wait_until_disconnected.inc
60
61 --let $rpl_connection_name= server3
62 --source include/rpl_connection.inc
63 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
64 --shutdown_server 0
65 --source include/wait_until_disconnected.inc
66
67 --let $rpl_connection_name= server1
68 --source include/rpl_connection.inc
69
70 --let $group_replication_member_state= UNREACHABLE
71 --let $group_replication_member_id= $member2_uuid
72 --source include/gr_wait_for_member_state.inc
73
74 --let $group_replication_member_state= UNREACHABLE
75 --let $group_replication_member_id= $member3_uuid
76 --source include/gr_wait_for_member_state.inc
77
78 --let $group_replication_member_id= $member1_uuid
79
80 --echo #
81 --echo # 3. Execute a query that will block
82 --echo #
83
84 --send INSERT INTO t1 VALUES (2)
85
86 #Sleep 2 seconds for the query to block
87 --sleep 2
88
89 --echo #
90 --echo # 4. Stop Group Replication on server 1
91 --echo # The pending query should die
92 --echo #
93
94 --let $rpl_connection_name= server_1
95 --source include/rpl_connection.inc
96
97 --let $$wait_timeout= 120
98 --source include/stop_group_replication.inc
99
100 --let $rpl_connection_name= server1
101 --source include/rpl_connection.inc
102
103 --error ER_RUN_HOOK_ERROR
104 --reap
105
106 --echo #
107 --echo # 5. Clean up.
108 --echo #
109
110 --let $rpl_connection_name= server1
111 --source include/rpl_connection.inc
112 DROP TABLE t1;
113
114 set session sql_log_bin=0;
115 call mtr.add_suppression("The member lost contact with a majority of the members in the group. Until the network is restored.*");
116 call mtr.add_suppression("Due to a plugin error, some transactions were unable to be certified and will now rollback.");
117 call mtr.add_suppression("Timeout while waiting for the group communication engine to exit!");
118 call mtr.add_suppression("The member has failed to gracefully leave the group.");
119 call mtr.add_suppression("read failed");
120 call mtr.add_suppression("Error while waiting for conflict detection procedure to finish on session .*");
121 call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
122 set session sql_log_bin=1;
123
124 --let $rpl_connection_name= server_2
125 --source include/rpl_connection.inc
126 --let $rpl_server_number= 2
127 --source include/rpl_reconnect.inc
128 DROP TABLE t1;
129
130 --let $rpl_connection_name= server_3
131 --source include/rpl_connection.inc
132 --let $rpl_server_number= 3
133 --source include/rpl_reconnect.inc
134 DROP TABLE t1;
135
136 --source include/group_replication_end.inc