Debian Codegraph @

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

raw
1 ################################################################################
2 # This test intends to see if recovery can handle group updates under specific
3 # situations.
4 # It test recovery against group updates when:
5 # 1) There is no donor information, as Recovery did not choose yet a member
6 # of the group.
7 # 2) Recovery already ended its connection to the donor, and multiple members
8 # exited the group before the process is declared as finished.
9 #
10 # Test:
11 # 0. The test requires four servers: M1, M2, M3 and M4.
12 # 1. Bootstrap start GR on M1. Add some data. Start GR on M2 and M3.
13 # Phase1: Change the group when the Joiner did not yet choose a Donor.
14 # 2. Set the debug flag to block recovery on M4. Start GR on M4.
15 # 3. Stop GR on one of the other member(M2). The recovery process should not
16 # be affected. Check the server M2 is no longer member of the group.
17 # 4. Change the debug stop point for phase 2. Resume the recovery process on M4.
18 # Phase 2: Change the group after the state exchange in the Joiner ended.
19 # 5. Restart GR on the stopped member M2.
20 # 6. Stop 2 servers (M2 and M3) while recovery is not yet stopped.
21 # 7. Resume recovery on M4: All should be OK.
22 # 8. Test if the servers (M1 and M4) are working properly by replicating data.
23 # 9. Clean up.
24 ################################################################################
25
26 --source include/big_test.inc
27 --source include/have_debug.inc
28 --source include/have_debug_sync.inc
29 --let $group_replication_group_name= 850c2d00-edc7-11e4-b80c-0800200c9a66
30 --source include/have_group_replication_plugin.inc
31
32 --let $rpl_server_count= 4
33 --let $rpl_skip_group_replication_start= 1
34 --source include/group_replication.inc
35
36 --echo #
37 --echo # Start group replication on the three servers
38 --echo # Add some data in to the members
39 --echo #
40
41 --connection server1
42 --echo server1
43 --source include/start_and_bootstrap_group_replication.inc
44
45 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
46 INSERT INTO t1 VALUES (1);
47
48 --connection server2
49 --echo server2
50 --source include/start_group_replication.inc
51
52
53 --connection server3
54 --echo server3
55 --source include/start_group_replication.inc
56
57
58 --echo #
59 --echo # Phase 1: Change the group when the Joiner did not yet choose a Donor.
60 --echo #
61 --echo # Start group replication on server 4
62 --echo # Wait right after recovery is declared as running.
63 --echo #
64
65 --connection server4
66 --echo server4
67
68 SET @debug_save= @@GLOBAL.DEBUG;
69
70 --echo # Set the debug flag to block recovery
71 SET @@GLOBAL.DEBUG='d,recovery_thread_start_wait';
72
73 --let $group_replication_start_member_state= RECOVERING
74 --source include/start_group_replication.inc
75
76 #sleep to give time for the start to get stuck on recovery
77 --sleep 5
78
79 --echo #
80 --echo # Stop group replication in one of the other servers
81 --echo # The recovery process should not be affected.
82 --echo #
83
84 --connection server2
85 --echo server2
86 --source include/stop_group_replication.inc
87
88 #Get the member uuid
89 --let $group_member_id= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
90
91 --connection server4
92 --echo server4
93
94 #Check the server is no longer member of the group
95 let $wait_condition= SELECT COUNT(*)=0 FROM performance_schema.replication_group_members
96 WHERE member_id="$group_member_id";
97 --source include/wait_condition.inc
98
99 --echo #
100 --echo # Resume the recovery process.
101 --echo # The data should be there when declared online
102 --echo #
103
104 #Change the stop point for phase 2
105 SET @@GLOBAL.DEBUG= 'd,recovery_thread_wait_before_finish';
106 #Awake the recovery process
107 SET DEBUG_SYNC= "now SIGNAL signal.recovery_continue";
108
109 #Wait for the data to be there
110 let $wait_condition= SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't1';
111 --source include/wait_condition.inc
112 let $wait_condition= SELECT COUNT(*)=1 FROM t1;
113 --source include/wait_condition.inc
114
115 --echo #
116 --echo # Phase 2: Change the group after the state exchange in the Joiner ended.
117 --echo #
118 --echo # Restart group replication on the stopped member
119 --echo #
120
121 --connection server2
122 --echo server2
123 --source include/start_group_replication.inc
124
125 --echo #
126 --echo # Stop 2 servers while recovery is not yet stopped.
127 --echo #
128
129 --connection server2
130 --echo server2
131 --source include/stop_group_replication.inc
132
133 --connection server3
134 --echo server3
135 --source include/stop_group_replication.inc
136
137 --echo #
138 --echo # Resume recovery: All should be OK
139 --echo #
140
141 --connection server4
142 --echo server4
143
144 SET DEBUG_SYNC= "now SIGNAL signal.recovery_end";
145 SET @@GLOBAL.DEBUG= @debug_save;
146
147 --let $group_replication_member_state= ONLINE
148 --source include/gr_wait_for_member_state.inc
149
150 --echo #
151 --echo # Test if the servers are working properly
152 --echo #
153
154 --connection server1
155 --echo server1
156
157 INSERT INTO t1 VALUES (2);
158
159 #sync the servers
160 --source include/rpl_sync.inc
161
162 --connection server4
163 --echo server4
164
165 --let $assert_text= On the recovered member, the table should exist and have 1 elements;
166 --let $assert_cond= [select count(*) from t1] = 2;
167 --source include/assert.inc
168
169 --echo #
170 --echo # Clean up
171 --echo #
172
173 --connection server2
174 --echo server2
175 --source include/start_group_replication.inc
176
177 --connection server3
178 --echo server3
179 --source include/start_group_replication.inc
180
181 DROP TABLE t1;
182
183 --source include/group_replication_end.inc