File: gr_recovery_updates.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 (183 lines) | stat: -rw-r--r-- 5,239 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
################################################################################
# This test intends to see if recovery can handle group updates under specific
# situations.
# It test recovery against group updates when:
#  1) There is no donor information, as Recovery did not choose yet a member
#     of the group.
#  2) Recovery already ended its connection to the donor, and multiple members
#     exited the group before the process is declared as finished.
#
# Test:
# 0. The test requires four servers: M1, M2, M3 and M4.
# 1. Bootstrap start GR on M1. Add some data. Start GR on M2 and M3.
# Phase1: Change the group when the Joiner did not yet choose a Donor.
# 2. Set the debug flag to block recovery on M4. Start GR on M4.
# 3. Stop GR on one of the other member(M2). The recovery process should not
#    be affected. Check the server M2 is no longer member of the group.
# 4. Change the debug stop point for phase 2. Resume the recovery process on M4.
# Phase 2: Change the group after the state exchange in the Joiner ended.
# 5. Restart GR on the stopped member M2.
# 6. Stop 2 servers (M2 and M3) while recovery is not yet stopped.
# 7. Resume recovery on M4: All should be OK.
# 8. Test if the servers (M1 and M4) are working properly by replicating data.
# 9. Clean up.
################################################################################

--source include/big_test.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $group_replication_group_name= 850c2d00-edc7-11e4-b80c-0800200c9a66
--source include/have_group_replication_plugin.inc

--let $rpl_server_count= 4
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc

--echo #
--echo # Start group replication on the three servers
--echo # Add some data in to the members
--echo #

--connection server1
--echo server1
--source include/start_and_bootstrap_group_replication.inc

CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);

--connection server2
--echo server2
--source include/start_group_replication.inc


--connection server3
--echo server3
--source include/start_group_replication.inc


--echo #
--echo # Phase 1: Change the group when the Joiner did not yet choose a Donor.
--echo #
--echo # Start group replication on server 4
--echo # Wait right after recovery is declared as running.
--echo #

--connection server4
--echo server4

SET @debug_save= @@GLOBAL.DEBUG;

--echo # Set the debug flag to block recovery
SET @@GLOBAL.DEBUG='d,recovery_thread_start_wait';

--let $group_replication_start_member_state= RECOVERING
--source include/start_group_replication.inc

#sleep to give time for the start to get stuck on recovery
--sleep 5

--echo #
--echo # Stop group replication in one of the other servers
--echo # The recovery process should not be affected.
--echo #

--connection server2
--echo server2
--source include/stop_group_replication.inc

#Get the member uuid
--let $group_member_id= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)

--connection server4
--echo server4

#Check the server is no longer member of the group
let $wait_condition= SELECT COUNT(*)=0 FROM performance_schema.replication_group_members
  WHERE member_id="$group_member_id";
--source include/wait_condition.inc

--echo #
--echo # Resume the recovery process.
--echo # The data should be there when declared online
--echo #

#Change the stop point for phase 2
SET @@GLOBAL.DEBUG= 'd,recovery_thread_wait_before_finish';
#Awake the recovery process
SET DEBUG_SYNC= "now SIGNAL signal.recovery_continue";

#Wait for the data to be there
let $wait_condition= SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't1';
--source include/wait_condition.inc
let $wait_condition= SELECT COUNT(*)=1 FROM t1;
--source include/wait_condition.inc

--echo #
--echo # Phase 2: Change the group after the state exchange in the Joiner ended.
--echo #
--echo # Restart group replication on the stopped member
--echo #

--connection server2
--echo server2
--source include/start_group_replication.inc

--echo #
--echo # Stop 2 servers while recovery is not yet stopped.
--echo #

--connection server2
--echo server2
--source include/stop_group_replication.inc

--connection server3
--echo server3
--source include/stop_group_replication.inc

--echo #
--echo # Resume recovery: All should be OK
--echo #

--connection server4
--echo server4

SET DEBUG_SYNC= "now SIGNAL signal.recovery_end";
SET @@GLOBAL.DEBUG= @debug_save;

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

--echo #
--echo # Test if the servers are working properly
--echo #

--connection server1
--echo server1

INSERT INTO t1 VALUES (2);

#sync the servers
--source include/rpl_sync.inc

--connection server4
--echo server4

--let $assert_text= On the recovered member, the table should exist and have 1 elements;
--let $assert_cond= [select count(*) from t1] = 2;
--source include/assert.inc

--echo #
--echo # Clean up
--echo #

--connection server2
--echo server2
--source include/start_group_replication.inc

--connection server3
--echo server3
--source include/start_group_replication.inc

DROP TABLE t1;

--source include/group_replication_end.inc