Debian Codegraph @

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

raw
1 ################################################################################
2 # When we try to shutdown server through mysqladmin and GR plugin is
3 # busy (in deleted state), it returns and error that STOP GROUP_REPLICATION
4 # need to be executed before that.
5 # Executing mysqladmin shutdown will shutdown the server.
6 #
7 # Test:
8 # 0. The test requires two servers
9 # 1. Kill and restart server 2
10 # 2. Wait until server2 is marked as UNREACHABLE
11 # 3. Execute query that will be blocked and leave the group plugin busy
12 # 4. Uninstall plugin will return error due plugin being in use
13 # 5. Call mysqladmin to shutdown server
14 # 6. Clean up
15
16 # This test does crashes servers, hence we skip it on asan and valgrind.
17 --source include/not_asan.inc
18 --source include/not_valgrind.inc
19 --source include/big_test.inc
20 --source include/have_group_replication_plugin.inc
21
22 --let $rpl_server_count= 2
23 --source include/group_replication.inc
24
25 --let $rpl_connection_name= server1
26 --source include/rpl_connection.inc
27
28
29 # Create table
30 CREATE TABLE t1 (a INT PRIMARY KEY);
31 --source include/rpl_sync.inc
32
33 --let $rpl_connection_name= server2
34 --source include/rpl_connection.inc
35
36 # Save the variables, for server restart.
37 --let $member2_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
38 --let $group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
39 --let $group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack`
40 --let $member2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
41
42 --echo
43 --echo # 1. Kill and restart server 2
44 --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
45 --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
46 --source include/kill_and_restart_mysqld.inc
47
48 --let $rpl_server_number= 2
49 --source include/rpl_reconnect.inc
50
51 --let $rpl_connection_name= server1
52 --source include/rpl_connection.inc
53
54 --echo
55 --echo # 2. Wait until server2 is marked as UNREACHABLE
56 --let $group_replication_member_state= UNREACHABLE
57 --let $group_replication_member_id= $member2_uuid
58 --source include/gr_wait_for_member_state.inc
59
60 --echo
61 --echo # 3. Execute query that will be blocked and leave the group plugin busy
62 --send INSERT INTO test.t1 VALUES(11)
63
64 --let $rpl_connection_name= server_1
65 --source include/rpl_connection.inc
66
67 set session sql_log_bin=0;
68 call mtr.add_suppression("Group Replication plugin is busy, it cannot be uninstalled. To force");
69 call mtr.add_suppression("Timeout while waiting for the group communication engine to exit!");
70 call mtr.add_suppression("The member has failed to gracefully leave the group.");
71 call mtr.add_suppression("read failed");
72 call mtr.add_suppression("Due to a plugin error, some transactions were unable to be certified and will now rollback.");
73 call mtr.add_suppression("The member lost contact with a majority of the members in the group. Until the network is restored.*");
74 call mtr.add_suppression("Plugin group_replication reported: 'Error while waiting for conflict detection procedure to finish on session.*");
75 call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
76 set session sql_log_bin=1;
77
78 # Wait for INSERT to be blocked
79 --let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='waiting for handler commit' AND info='INSERT INTO test.t1 VALUES(11)'
80 --source include/wait_condition.inc
81
82 --echo
83 --echo # 4. Uninstall plugin will return error due plugin being in use
84 --error ER_PLUGIN_CANNOT_BE_UNINSTALLED
85 UNINSTALL PLUGIN group_replication;
86
87 --echo
88 --echo # 5. Call mysqladmin to shutdown server
89 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
90 --disable_result_log
91 --replace_regex /.*mysqladmin.*: /mysqladmin: /
92 --exec $MYSQLADMIN -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT shutdown 2>&1
93 --enable_result_log
94
95 --source include/wait_until_disconnected.inc
96
97 --echo
98 --echo # 6. Clean-up
99 --let $rpl_connection_name= server1
100 --source include/rpl_connection.inc
101
102 # terminate send calling reap
103 --echo # CR_SERVER_LOST, CR_SERVER_GONE_ERROR or Rollback
104 --error 2006,2013,3100
105 --reap
106
107 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
108 --let $rpl_server_number= 1
109 --source include/rpl_start_server.inc
110
111 --let $rpl_server_number= 1
112 --source include/rpl_reconnect.inc
113
114 --let $rpl_connection_name= server2
115 --source include/rpl_connection.inc
116 DROP TABLE test.t1;
117
118 --let $rpl_connection_name= server_1
119 --source include/rpl_connection.inc
120 DROP TABLE test.t1;
121
122 --source include/group_replication_end.inc