File: gr_force_member_expel.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 (129 lines) | stat: -rw-r--r-- 4,525 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
################################################################################
# Validate that when a member is expelled from a group, its state is properly
# updated.
#
# Test:
# 0. The test requires three servers.
# 1. Suspend server 1 by sending a signal SIGSTOP to it.
#    This will make server 1 to not answer to "I am alive"
#    GCS messages and it will be expelled from the group.
# 2. Wait until group expel server 1.
# 3. Resume server 1 by sending a signal SIGCONT to it.
#    Server will notice that was expelled from the group,
#    will change to ERROR state and enabled super_read_only
#    mode.
# 4. Stop and start server 1, it will be back to normal.
# 5. Check data.
# 6. Clean up.
################################################################################


# Test involves sending SIGSTOP and SIGCONT signals using kill Linux command.
--source include/not_valgrind.inc
--source include/linux.inc
--source include/big_test.inc
--source include/force_restart.inc
--source include/have_group_replication_plugin.inc
--let $rpl_server_count= 3
--source include/group_replication.inc


--echo
--echo ############################################################
--echo # 0. Error suppressions.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Member was expelled from the group due to network failures, changing member status to ERROR.");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
call mtr.add_suppression("\\[GCS\\] Unable to resolve peer address.");
SET SESSION sql_log_bin= 1;


--echo
--echo ############################################################
--echo # 1. Suspend server 1 by sending a signal SIGSTOP to it.
--echo #    This will make server 1 to not answer to "I am alive"
--echo #    GCS messages and it will be expelled from the group.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc

--echo # Get server pid.
SET SESSION sql_log_bin= 0;
CREATE TABLE pid_table(pid_no INT);
--let $pid_file= `SELECT @@GLOBAL.pid_file`
--replace_result $pid_file pid_file
--eval LOAD DATA LOCAL INFILE '$pid_file' INTO TABLE pid_table
--let $server_pid=`SELECT pid_no FROM pid_table`
DROP TABLE pid_table;
SET SESSION sql_log_bin= 1;

--echo # Send signal SIGSTOP to server 1.
--exec kill -19 $server_pid


--echo
--echo ############################################################
--echo # 2. Wait until group expel server 1.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $group_replication_number_of_members= 2
--source include/gr_wait_for_number_of_members.inc

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $group_replication_number_of_members= 2
--source include/gr_wait_for_number_of_members.inc


--echo
--echo ############################################################
--echo # 3. Resume server 1 by sending a signal SIGCONT to it.
--echo #    Server will notice that was expelled from the group,
--echo #    will change to ERROR state and enabled super_read_only
--echo #    mode.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--echo # Send signal SIGCONT to server 1.
--exec kill -18 $server_pid

--let $group_replication_member_state= ERROR
--source include/gr_wait_for_member_state.inc

--let $group_replication_number_of_members= 1
--source include/gr_wait_for_number_of_members.inc

--let $wait_condition= SELECT @@GLOBAL.super_read_only = '1'
--source include/wait_condition.inc

--error ER_OPTION_PREVENTS_STATEMENT
CREATE TABLE te (c1 INT NOT NULL PRIMARY KEY);


--echo
--echo ############################################################
--echo # 4. Stop and start server 1, it will be back to normal.
--source include/stop_group_replication.inc
--source include/start_group_replication.inc

CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
INSERT INTO t1 VALUES (1);
--source include/rpl_sync.inc


--echo
--echo ############################################################
--echo # 5. Check data.
--let $assert_text= 'There is a value 1 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
--source include/assert.inc

--let $diff_tables= server1:test.t1, server2:test.t1, server3:test.t1
--source include/diff_tables.inc


--echo
--echo ############################################################
--echo # 6. Clean up.
DROP TABLE t1;
--source include/group_replication_end.inc