Debian Codegraph @

mysql-test/suite/clone/t/local_boundary.test

raw
1 # Test clone with different table types with debug sync
2
3 --source include/have_debug_sync.inc
4 --source include/count_sessions.inc
5 --source include/not_windows.inc
6
7 ## Install plugin
8 --let $CLONE_DATADIR = $MYSQL_TMP_DIR/data_new
9
10 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
11 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
12
13 ## Create test schema
14 --source ../include/create_schema.inc
15
16 # Insert 150 rows
17 call execute_dml(0, 0, 150, 150, 10, 0);
18
19 # Check base rows
20 SHOW CREATE TABLE t1;
21
22 SELECT count(*) from t1;
23 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
24 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
25
26 SHOW CREATE TABLE t2;
27 SELECT count(*) from t2;
28 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
29 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
30
31 ## Test-1: Clone with dirty pages and redo log [No zero copy/sendfile]
32
33 --echo # In connection default - Cloning database
34 SET GLOBAL DEBUG ="+d,clone_no_zero_copy";
35 SET DEBUG_SYNC = 'RESET';
36 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1';
37 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2';
38 --source ../include/clone_command_send.inc
39
40 --echo # In connection con1 - Running Update Random [0 - 150 Key Range]
41 connect (con1,localhost,root,,);
42 SET DEBUG_SYNC = 'now WAIT_FOR start_dml1';
43 START TRANSACTION;
44 CALL execute_dml(1, 0, 150, 200, 100, 1);
45 COMMIT;
46 --echo # Flush all dirty buffers
47 SET GLOBAL innodb_buf_flush_list_now = 1;
48 SET DEBUG_SYNC = 'now SIGNAL resume_clone1';
49
50 SET DEBUG_SYNC = 'now WAIT_FOR start_dml2';
51 START TRANSACTION;
52 CALL execute_dml(1, 0, 150, 200, 100, 1);
53 COMMIT;
54 SET DEBUG_SYNC = 'now SIGNAL resume_clone2';
55
56 connection default;
57 --echo # In connection default - Cloning database
58 --reap
59 SET GLOBAL DEBUG ="-d,clone_no_zero_copy";
60
61 disconnect con1;
62
63 --echo # Restart cloned database
64 --replace_result $CLONE_DATADIR CLONE_DATADIR
65 --let restart_parameters="restart: --datadir=$CLONE_DATADIR"
66 --source include/restart_mysqld.inc
67
68 # Check table in cloned database
69 SHOW CREATE TABLE t1;
70 SELECT count(*) from t1;
71 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
72 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
73
74 SHOW CREATE TABLE t2;
75 SELECT count(*) from t2;
76 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
77 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
78
79 # Execute procedure to delete all rows and insert
80 call execute_dml(3, 0, 1, 1, 1, 0);
81 call execute_dml(0, 0, 150, 150, 100, 0);
82
83 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
84 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
85
86 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
87 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
88
89 # Restart and Remove cloned directory
90 --let restart_parameters="restart:"
91 --source include/restart_mysqld.inc
92 --force-rmdir $CLONE_DATADIR
93
94 ## Test-2A: Clone with redo log ending at file boundary
95 SET GLOBAL innodb_redo_log_capacity = 100*1024*1024;
96 SET GLOBAL DEBUG ="+d,clone_arch_log_stop_file_end";
97 SET DEBUG_SYNC = 'RESET';
98 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1';
99 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2';
100 --source ../include/clone_command_send.inc
101
102 --echo # In connection con1 - Running Update Random [0 - 10 Key Range]
103 connect (con1,localhost,root,,);
104 SET DEBUG_SYNC = 'now WAIT_FOR start_dml1';
105 START TRANSACTION;
106 CALL execute_dml(1, 0, 10, 10, 10, 1);
107 COMMIT;
108
109 --echo # Flush all dirty buffers
110 SET GLOBAL innodb_buf_flush_list_now = 1;
111 SET DEBUG_SYNC = 'now SIGNAL resume_clone1';
112 SET DEBUG_SYNC = 'now WAIT_FOR start_dml2';
113
114 START TRANSACTION;
115 # Execute procedure to delete all rows and insert 150 rows
116 call execute_dml(3, 0, 1, 1, 1, 0);
117 call execute_dml(0, 0, 150, 150, 10, 0);
118 COMMIT;
119
120 SET DEBUG_SYNC = 'now SIGNAL resume_clone2';
121
122 connection default;
123 --echo # In connection default - Cloning database
124 --reap
125
126 SET GLOBAL DEBUG ="-d,clone_arch_log_stop_file_end";
127
128 # Removed cloned data
129 --force-rmdir $CLONE_DATADIR
130
131 ## Test-2B: Clone with redo log ending at file boundary + some bytes
132 SET GLOBAL innodb_redo_log_capacity = 100*1024*1024;
133 SET GLOBAL DEBUG ="+d,clone_arch_log_stop_file_end";
134 SET GLOBAL DEBUG ="+d,clone_arch_log_extra_bytes";
135 SET DEBUG_SYNC = 'RESET';
136 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1';
137 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2';
138 --source ../include/clone_command_send.inc
139
140 --echo # In connection con1 - Running Update Random [0 - 10 Key Range]
141 connection con1;
142 SET DEBUG_SYNC = 'now WAIT_FOR start_dml1';
143 START TRANSACTION;
144 CALL execute_dml(1, 0, 10, 10, 10, 1);
145 COMMIT;
146
147 --echo # Flush all dirty buffers
148 SET GLOBAL innodb_buf_flush_list_now = 1;
149 SET DEBUG_SYNC = 'now SIGNAL resume_clone1';
150 SET DEBUG_SYNC = 'now WAIT_FOR start_dml2';
151
152 START TRANSACTION;
153 # Execute procedure to delete all rows and insert 150 rows
154 call execute_dml(3, 0, 1, 1, 1, 0);
155 call execute_dml(0, 0, 150, 150, 10, 0);
156 COMMIT;
157
158 SET DEBUG_SYNC = 'now SIGNAL resume_clone2';
159
160 connection default;
161 --echo # In connection default - Cloning database
162 --reap
163
164 SET GLOBAL DEBUG ="-d,clone_arch_log_stop_file_end";
165 SET GLOBAL DEBUG ="-d,clone_arch_log_extra_bytes";
166
167 # Removed cloned data
168 --force-rmdir $CLONE_DATADIR
169
170 ## Test-3A: Shutdown while Clone in progress [FILE_COPY]
171 SET DEBUG_SYNC = 'RESET';
172 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1';
173 --source ../include/clone_command_send.inc
174
175 --echo # In connection con1 - Running Update Random [0 - 10 Key Range]
176 connection con1;
177 SET DEBUG_SYNC = 'now WAIT_FOR start_dml1';
178 START TRANSACTION;
179 CALL execute_dml(1, 0, 10, 10, 10, 1);
180 COMMIT;
181 --source include/shutdown_mysqld.inc
182
183 connection default;
184 # During shutdown it is possible to get "2013" - Lost connection to server
185 --echo # In connection default - Cloning database
186 --error ER_QUERY_INTERRUPTED,2013,ER_CLONE_DONOR
187 --reap
188
189 disconnect con1;
190
191 # Removed cloned data
192 --force-rmdir $CLONE_DATADIR
193 --source include/start_mysqld.inc
194
195 ## Test-3B: Shutdown while Clone in progress [PAGE_COPY]
196 SET DEBUG_SYNC = 'RESET';
197 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1';
198 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2';
199 --source ../include/clone_command_send.inc
200
201 --echo # In connection con1 - Running Update Random [0 - 10 Key Range]
202 connect (con1,localhost,root,,);
203 SET DEBUG_SYNC = 'now WAIT_FOR start_dml1';
204 START TRANSACTION;
205 CALL execute_dml(1, 0, 10, 10, 10, 1);
206 COMMIT;
207
208 --echo # Flush all dirty buffers
209 SET GLOBAL innodb_buf_flush_list_now = 1;
210 SET DEBUG_SYNC = 'now SIGNAL resume_clone1';
211 SET DEBUG_SYNC = 'now WAIT_FOR start_dml2';
212
213 START TRANSACTION;
214 # Execute procedure to delete all rows and insert 50 rows
215 call execute_dml(3, 0, 1, 1, 1, 0);
216 call execute_dml(0, 0, 50, 50, 10, 0);
217 COMMIT;
218 --source include/shutdown_mysqld.inc
219
220 connection default;
221 --echo # In connection default - Cloning database
222 --error ER_QUERY_INTERRUPTED,2013,ER_CLONE_DONOR
223 --reap
224
225 disconnect con1;
226
227 # Removed cloned data
228 --force-rmdir $CLONE_DATADIR
229 --source include/start_mysqld.inc
230
231 ## Test-3C: Shutdown while Clone in progress [REDO_COPY]
232 SET DEBUG_SYNC = 'RESET';
233 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1';
234 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2';
235 SET DEBUG_SYNC = 'clone_redo_copy SIGNAL start_dml3 WAIT_FOR resume_clone3';
236 --source ../include/clone_command_send.inc
237
238 --echo # In connection con1 - Running Update Random [0 - 10 Key Range]
239 connect (con1,localhost,root,,);
240 SET DEBUG_SYNC = 'now WAIT_FOR start_dml1';
241 START TRANSACTION;
242 CALL execute_dml(1, 0, 10, 10, 10, 1);
243 COMMIT;
244
245 --echo # Flush all dirty buffers
246 SET GLOBAL innodb_buf_flush_list_now = 1;
247 SET DEBUG_SYNC = 'now SIGNAL resume_clone1';
248 SET DEBUG_SYNC = 'now WAIT_FOR start_dml2';
249
250 START TRANSACTION;
251 # Execute procedure to delete all rows and insert 50 rows
252 call execute_dml(3, 0, 1, 1, 1, 0);
253 call execute_dml(0, 0, 50, 50, 10, 0);
254 COMMIT;
255
256 --echo # Flush all dirty buffers
257 SET GLOBAL innodb_buf_flush_list_now = 1;
258 SET DEBUG_SYNC = 'now SIGNAL resume_clone2';
259 SET DEBUG_SYNC = 'now WAIT_FOR start_dml3';
260
261 START TRANSACTION;
262 # Execute procedure to delete all rows and insert 50 rows
263 call execute_dml(3, 0, 1, 1, 1, 0);
264 call execute_dml(0, 0, 50, 50, 10, 0);
265 COMMIT;
266 --source include/shutdown_mysqld.inc
267
268 connection default;
269 --echo # In connection default - Cloning database
270 --error ER_QUERY_INTERRUPTED,2013,ER_CLONE_DONOR
271 --reap
272
273 disconnect con1;
274
275 # Removed cloned data
276 --force-rmdir $CLONE_DATADIR
277 --source include/start_mysqld.inc
278
279 #Cleanup
280 --source ../include/drop_schema.inc
281
282 UNINSTALL PLUGIN clone;
283 SET DEBUG_SYNC = 'RESET';
284
285 --source include/wait_until_count_sessions.inc