File: gr_uninstall_while_network_blocked.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 (122 lines) | stat: -rw-r--r-- 4,977 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
################################################################################
# When we try to shutdown server through mysqladmin and GR plugin is
# busy (in deleted state), it returns and error that STOP GROUP_REPLICATION
# need to be executed before that.
# Executing mysqladmin shutdown will shutdown the server.
#
# Test:
# 0. The test requires two servers
# 1. Kill and restart server 2
# 2. Wait until server2 is marked as UNREACHABLE
# 3. Execute query that will be blocked and leave the group plugin busy
# 4. Uninstall plugin will return error due plugin being in use
# 5. Call mysqladmin to shutdown server
# 6. Clean up

# This test does crashes servers, hence we skip it on asan and valgrind.
--source include/not_asan.inc
--source include/not_valgrind.inc
--source include/big_test.inc
--source include/have_group_replication_plugin.inc

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

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


# Create table
CREATE TABLE t1 (a INT PRIMARY KEY);
--source include/rpl_sync.inc

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

# Save the variables, for server restart.
--let $member2_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
--let $group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
--let $group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack`
--let $member2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)

--echo
--echo # 1. Kill and restart server 2
--let $restart_parameters=restart:--group_replication_local_address=$member2_group_replication_local_address --group_replication_group_seeds=$group_replication_group_seeds --group_replication_group_name=$group_replication_group_name --group_replication_communication_stack=$group_replication_comm_stack
--replace_result $member2_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS2 $group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $group_replication_comm_stack GROUP_REPLICATION_COMMUNICATION_STACK
--source include/kill_and_restart_mysqld.inc

--let $rpl_server_number= 2
--source include/rpl_reconnect.inc

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

--echo
--echo # 2. Wait until server2 is marked as UNREACHABLE
--let $group_replication_member_state= UNREACHABLE
--let $group_replication_member_id= $member2_uuid
--source include/gr_wait_for_member_state.inc

--echo
--echo # 3. Execute query that will be blocked and leave the group plugin busy
--send INSERT INTO test.t1 VALUES(11)

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

set session sql_log_bin=0;
call mtr.add_suppression("Group Replication plugin is busy, it cannot be uninstalled. To force");
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("Due to a plugin error, some transactions were unable to be certified and will now rollback.");
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("Plugin group_replication reported: '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;

# Wait for INSERT to be blocked
--let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='waiting for handler commit' AND info='INSERT INTO test.t1 VALUES(11)'
--source include/wait_condition.inc

--echo
--echo # 4. Uninstall plugin will return error due plugin being in use
--error ER_PLUGIN_CANNOT_BE_UNINSTALLED
UNINSTALL PLUGIN group_replication;

--echo
--echo # 5. Call mysqladmin to shutdown server
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--disable_result_log
--replace_regex /.*mysqladmin.*: /mysqladmin: /
--exec $MYSQLADMIN -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT shutdown 2>&1
--enable_result_log

--source include/wait_until_disconnected.inc

--echo
--echo # 6. Clean-up
--let $rpl_connection_name= server1
--source include/rpl_connection.inc

# terminate send calling reap
--echo # CR_SERVER_LOST, CR_SERVER_GONE_ERROR or Rollback
--error 2006,2013,3100
--reap

--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--let $rpl_server_number= 1
--source include/rpl_start_server.inc

--let $rpl_server_number= 1
--source include/rpl_reconnect.inc

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

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

--source include/group_replication_end.inc