Debian Codegraph @

mysql-test/suite/clone/r/ddl_alter_inplace.result

raw
1 INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN';
2 SET GLOBAL innodb_ddl_threads = 1;
3 CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
4 CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB)
5 PARTITION BY KEY(col1) PARTITIONS 5;
6 CREATE PROCEDURE execute_dml(
7 p_dml_type INT,
8 p_key_min INT,
9 p_key_range INT,
10 p_loop_count INT,
11 p_frequency INT,
12 p_is_rand INT)
13 BEGIN
14 DECLARE v_idx INT DEFAULT 0;
15 DECLARE v_commit INT DEFAULT 0;
16 DECLARE v_key INT DEFAULT 0;
17 /* Loop and INSERT data at random position */
18 WHILE(v_idx < p_loop_count) DO
19 /* Generate key between 1 to p_loop_count */
20 IF p_is_rand = 1 THEN
21 SET v_key = p_key_min + FLOOR(RAND() * p_key_range);
22 ELSE
23 SET v_key = p_key_min + (v_idx % p_key_range);
24 END IF;
25 CASE p_dml_type
26 WHEN 0 THEN
27 SET @clol3_text = CONCAT('Clone Test Row - ', v_key);
28 INSERT INTO t1 (col1, col2, col3, col4) VALUES (
29 v_key, v_key * 10,
30 @clol3_text, REPEAT('Large Column Data ', 2048))
31 ON DUPLICATE KEY UPDATE col2 = col2 + 1;
32 INSERT INTO t2 (col1, col2, col3, col4) VALUES (
33 v_key, v_key * 10,
34 @clol3_text, REPEAT('Large Column Data ', 2048))
35 ON DUPLICATE KEY UPDATE col2 = col2 + 1;
36 WHEN 1 THEN
37 UPDATE t1 SET col2 = v_idx + 1 WHERE col1 = v_key;
38 UPDATE t2 SET col2 = v_idx + 1 WHERE col1 = v_key;
39 WHEN 2 THEN
40 DELETE FROM t1 WHERE col1 = v_key;
41 DELETE FROM t2 WHERE col1 = v_key;
42 ELSE
43 DELETE FROM t1;
44 DELETE FROM t2;
45 END CASE;
46 SET v_idx = v_idx + 1;
47 /* Commit or rollback work at specified frequency. */
48 IF v_idx % p_frequency = 0 THEN
49 SET v_commit = FLOOR(RAND() * 2);
50 IF v_commit = 0 AND p_is_rand = 1 THEN
51 ROLLBACK;
52 START TRANSACTION;
53 ELSE
54 COMMIT;
55 START TRANSACTION;
56 END IF;
57 END IF;
58 END WHILE;
59 COMMIT;
60 END|
61 call execute_dml(0, 0, 100, 100, 10, 0);
62 CREATE TABLE t SELECT * FROM t1;
63 CREATE TABLE t0 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
64 CREATE TABLE t01 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
65 CREATE TABLE t3 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
66 CREATE TABLE t11 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
67 CREATE TABLE t21 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
68 INSERT INTO t11 SELECT * FROM t;
69 INSERT INTO t21 SELECT * FROM t;
70 SHOW VARIABLES LIKE 'clone_ddl_timeout';
71 Variable_name Value
72 clone_ddl_timeout 300
73 SHOW VARIABLES LIKE 'clone_block_ddl';
74 Variable_name Value
75 clone_block_ddl OFF
76 # 1. ALTER TABLE ADD COLUMN while clone in progress
77 RESET MASTER;
78 SET GLOBAL DEBUG = '+d,local_release_clone_file_pin';
79 ALTER TABLE t0 ADD COLUMN col5 int, ALGORITHM=INPLACE ;
80 SET DEBUG_SYNC = 'clone_before_init_meta SIGNAL start_ddl_file_init WAIT_FOR resume_file_init';
81 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_ddl_file WAIT_FOR resume_file';
82 SET DEBUG_SYNC = 'clone_file_copy_end_before_ack SIGNAL start_ddl_file_ack WAIT_FOR resume_file_ack';
83 SET DEBUG_SYNC = 'clone_before_file_ddl_meta SIGNAL start_ddl_file_meta WAIT_FOR resume_file_meta';
84 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl_page WAIT_FOR resume_page';
85 SET DEBUG_SYNC = 'clone_before_page_ddl_meta SIGNAL start_ddl_page_meta WAIT_FOR resume_page_meta';
86 SET DEBUG_SYNC = 'clone_redo_copy SIGNAL start_ddl_redo WAIT_FOR resume_redo';
87 SET GLOBAL clone_autotune_concurrency = OFF;
88 SET GLOBAL clone_max_concurrency = 8;
89 CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR';
90 # In connection CON1
91 # Waiting for clone to reach 'Initial metadata transfer'
92 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_init';
93 # Wait finished
94 ALTER TABLE t01 ADD COLUMN col5 int, ALGORITHM=INPLACE ;
95 SET DEBUG_SYNC = 'now SIGNAL resume_file_init';
96 # Waiting for clone to reach 'file copy'
97 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file';
98 # Wait finished
99 ALTER TABLE t1 ADD COLUMN col5 int, ALGORITHM=INPLACE ;
100 CALL execute_dml(0, 0, 100, 100, 10, 0);
101 # Flush all dirty pages to track
102 SET GLOBAL innodb_buf_flush_list_now = 1;
103 SET DEBUG_SYNC = 'now SIGNAL resume_file';
104 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_ack';
105 SET DEBUG_SYNC = 'now SIGNAL resume_file_ack';
106 # Waiting for clone to reach DDL metadata for 'file copy'
107 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_meta';
108 # Wait finished
109 SET DEBUG_SYNC = 'now SIGNAL resume_file_meta';
110 # Waiting for clone to reach 'page copy'
111 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page';
112 # Wait finished
113 SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL resume_page';
114 ALTER TABLE t2 ADD COLUMN col5 int, ALGORITHM=INPLACE ;
115 CALL execute_dml(0, 0, 100, 100, 10, 0);
116 SET DEBUG_SYNC = 'now SIGNAL resume_page';
117 # Waiting for clone to reach DDL metadata for 'page copy'
118 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page_meta';
119 # Wait finished
120 ALTER TABLE t21 ADD COLUMN col5 int, ALGORITHM=INPLACE ;
121 INSERT INTO t21 SELECT col1, col2, col3, col4, col2 + 100 FROM t ON DUPLICATE KEY UPDATE col2 = t21.col2 + 1;;
122 SET DEBUG_SYNC = 'now SIGNAL resume_page_meta';
123 # Waiting for clone to reach 'redo copy'
124 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_redo';
125 # Wait finished
126 ALTER TABLE t3 ADD COLUMN col5 int, ALGORITHM=INPLACE ;
127 SET DEBUG_SYNC = 'now SIGNAL resume_redo';
128 # In connection DEFAULT
129 # Waiting for clone to complete
130 # Wait finished
131 SET GLOBAL DEBUG = '-d,local_release_clone_file_pin';
132 # Restart server on cloned data directory
133 # restart: --datadir=CLONE_DATADIR
134 # Check cloned data
135 SHOW TABLES;
136 Tables_in_test
137 t
138 t0
139 t01
140 t1
141 t11
142 t2
143 t21
144 t3
145 SHOW CREATE TABLE t1;
146 Table Create Table
147 t1 CREATE TABLE `t1` (
148 `col1` int NOT NULL,
149 `col2` int DEFAULT NULL,
150 `col3` varchar(64) DEFAULT NULL,
151 `col4` blob,
152 `col5` int DEFAULT NULL,
153 PRIMARY KEY (`col1`)
154 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
155 CHECK TABLE t1 EXTENDED;
156 Table Op Msg_type Msg_text
157 test.t1 check status OK
158 SELECT count(*) from t1;
159 count(*)
160 100
161 SELECT col1, col2, col3 FROM t1 ORDER BY col1 LIMIT 10;;
162 col1 col2 col3
163 0 1 Clone Test Row - 0
164 1 11 Clone Test Row - 1
165 2 21 Clone Test Row - 2
166 3 31 Clone Test Row - 3
167 4 41 Clone Test Row - 4
168 5 51 Clone Test Row - 5
169 6 61 Clone Test Row - 6
170 7 71 Clone Test Row - 7
171 8 81 Clone Test Row - 8
172 9 91 Clone Test Row - 9
173 SELECT col1, col2, col3 FROM t1 ORDER BY col1 DESC LIMIT 10;;
174 col1 col2 col3
175 99 991 Clone Test Row - 99
176 98 981 Clone Test Row - 98
177 97 971 Clone Test Row - 97
178 96 961 Clone Test Row - 96
179 95 951 Clone Test Row - 95
180 94 941 Clone Test Row - 94
181 93 931 Clone Test Row - 93
182 92 921 Clone Test Row - 92
183 91 911 Clone Test Row - 91
184 90 901 Clone Test Row - 90
185 SHOW CREATE TABLE t11;
186 Table Create Table
187 t11 CREATE TABLE `t11` (
188 `col1` int NOT NULL,
189 `col2` int DEFAULT NULL,
190 `col3` varchar(64) DEFAULT NULL,
191 `col4` blob,
192 PRIMARY KEY (`col1`)
193 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
194 CHECK TABLE t11 EXTENDED;
195 Table Op Msg_type Msg_text
196 test.t11 check status OK
197 SELECT count(*) from t11;
198 count(*)
199 100
200 SELECT col1, col2, col3 FROM t11 ORDER BY col1 LIMIT 10;;
201 col1 col2 col3
202 0 0 Clone Test Row - 0
203 1 10 Clone Test Row - 1
204 2 20 Clone Test Row - 2
205 3 30 Clone Test Row - 3
206 4 40 Clone Test Row - 4
207 5 50 Clone Test Row - 5
208 6 60 Clone Test Row - 6
209 7 70 Clone Test Row - 7
210 8 80 Clone Test Row - 8
211 9 90 Clone Test Row - 9
212 SELECT col1, col2, col3 FROM t11 ORDER BY col1 DESC LIMIT 10;;
213 col1 col2 col3
214 99 990 Clone Test Row - 99
215 98 980 Clone Test Row - 98
216 97 970 Clone Test Row - 97
217 96 960 Clone Test Row - 96
218 95 950 Clone Test Row - 95
219 94 940 Clone Test Row - 94
220 93 930 Clone Test Row - 93
221 92 920 Clone Test Row - 92
222 91 910 Clone Test Row - 91
223 90 900 Clone Test Row - 90
224 SHOW CREATE TABLE t2;
225 Table Create Table
226 t2 CREATE TABLE `t2` (
227 `col1` int NOT NULL,
228 `col2` int DEFAULT NULL,
229 `col3` varchar(64) DEFAULT NULL,
230 `col4` blob,
231 PRIMARY KEY (`col1`)
232 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
233 /*!50100 PARTITION BY KEY (col1)
234 PARTITIONS 5 */
235 CHECK TABLE t2 EXTENDED;
236 Table Op Msg_type Msg_text
237 test.t2 check status OK
238 SELECT count(*) from t2;
239 count(*)
240 100
241 SELECT col1, col2, col3 FROM t2 ORDER BY col1 LIMIT 10;;
242 col1 col2 col3
243 0 1 Clone Test Row - 0
244 1 11 Clone Test Row - 1
245 2 21 Clone Test Row - 2
246 3 31 Clone Test Row - 3
247 4 41 Clone Test Row - 4
248 5 51 Clone Test Row - 5
249 6 61 Clone Test Row - 6
250 7 71 Clone Test Row - 7
251 8 81 Clone Test Row - 8
252 9 91 Clone Test Row - 9
253 SELECT col1, col2, col3 FROM t2 ORDER BY col1 DESC LIMIT 10;;
254 col1 col2 col3
255 99 991 Clone Test Row - 99
256 98 981 Clone Test Row - 98
257 97 971 Clone Test Row - 97
258 96 961 Clone Test Row - 96
259 95 951 Clone Test Row - 95
260 94 941 Clone Test Row - 94
261 93 931 Clone Test Row - 93
262 92 921 Clone Test Row - 92
263 91 911 Clone Test Row - 91
264 90 901 Clone Test Row - 90
265 call execute_dml(1, 0, 100, 100, 10, 0);
266 # Restart server back on base data directory
267 # restart:
268 SET DEBUG_SYNC = 'RESET';
269 # 2. ALTER TABLE DROP COLUMN while clone in progress
270 RESET MASTER;
271 SET GLOBAL DEBUG = '+d,local_release_clone_file_pin';
272 ALTER TABLE t0 DROP COLUMN col5, ALGORITHM=INPLACE ;
273 SET DEBUG_SYNC = 'clone_before_init_meta SIGNAL start_ddl_file_init WAIT_FOR resume_file_init';
274 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_ddl_file WAIT_FOR resume_file';
275 SET DEBUG_SYNC = 'clone_file_copy_end_before_ack SIGNAL start_ddl_file_ack WAIT_FOR resume_file_ack';
276 SET DEBUG_SYNC = 'clone_before_file_ddl_meta SIGNAL start_ddl_file_meta WAIT_FOR resume_file_meta';
277 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl_page WAIT_FOR resume_page';
278 SET DEBUG_SYNC = 'clone_before_page_ddl_meta SIGNAL start_ddl_page_meta WAIT_FOR resume_page_meta';
279 SET DEBUG_SYNC = 'clone_redo_copy SIGNAL start_ddl_redo WAIT_FOR resume_redo';
280 SET GLOBAL clone_autotune_concurrency = OFF;
281 SET GLOBAL clone_max_concurrency = 8;
282 CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR';
283 # In connection CON1
284 # Waiting for clone to reach 'Initial metadata transfer'
285 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_init';
286 # Wait finished
287 ALTER TABLE t01 DROP COLUMN col5, ALGORITHM=INPLACE ;
288 SET DEBUG_SYNC = 'now SIGNAL resume_file_init';
289 # Waiting for clone to reach 'file copy'
290 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file';
291 # Wait finished
292 ALTER TABLE t1 DROP COLUMN col5, ALGORITHM=INPLACE ;
293 call execute_dml(1, 0, 100, 100, 10, 0);
294 # Flush all dirty pages to track
295 SET GLOBAL innodb_buf_flush_list_now = 1;
296 SET DEBUG_SYNC = 'now SIGNAL resume_file';
297 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_ack';
298 SET DEBUG_SYNC = 'now SIGNAL resume_file_ack';
299 # Waiting for clone to reach DDL metadata for 'file copy'
300 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_meta';
301 # Wait finished
302 SET DEBUG_SYNC = 'now SIGNAL resume_file_meta';
303 # Waiting for clone to reach 'page copy'
304 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page';
305 # Wait finished
306 SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL resume_page';
307 ALTER TABLE t2 DROP COLUMN col5, ALGORITHM=INPLACE ;
308 call execute_dml(1, 0, 100, 100, 10, 0);
309 SET DEBUG_SYNC = 'now SIGNAL resume_page';
310 # Waiting for clone to reach DDL metadata for 'page copy'
311 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page_meta';
312 # Wait finished
313 ALTER TABLE t21 DROP COLUMN col5, ALGORITHM=INPLACE ;
314 INSERT INTO t21 SELECT * FROM t ON DUPLICATE KEY UPDATE col2 = t21.col2 + 1;;
315 SET DEBUG_SYNC = 'now SIGNAL resume_page_meta';
316 # Waiting for clone to reach 'redo copy'
317 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_redo';
318 # Wait finished
319 ALTER TABLE t3 DROP COLUMN col5, ALGORITHM=INPLACE ;
320 SET DEBUG_SYNC = 'now SIGNAL resume_redo';
321 # In connection DEFAULT
322 # Waiting for clone to complete
323 # Wait finished
324 SET GLOBAL DEBUG = '-d,local_release_clone_file_pin';
325 # Restart server on cloned data directory
326 # restart: --datadir=CLONE_DATADIR
327 # Check cloned data
328 SHOW TABLES;
329 Tables_in_test
330 t
331 t0
332 t01
333 t1
334 t11
335 t2
336 t21
337 t3
338 SHOW CREATE TABLE t1;
339 Table Create Table
340 t1 CREATE TABLE `t1` (
341 `col1` int NOT NULL,
342 `col2` int DEFAULT NULL,
343 `col3` varchar(64) DEFAULT NULL,
344 `col4` blob,
345 PRIMARY KEY (`col1`)
346 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
347 CHECK TABLE t1 EXTENDED;
348 Table Op Msg_type Msg_text
349 test.t1 check status OK
350 SELECT count(*) from t1;
351 count(*)
352 100
353 SELECT col1, col2, col3 FROM t1 ORDER BY col1 LIMIT 10;;
354 col1 col2 col3
355 0 1 Clone Test Row - 0
356 1 2 Clone Test Row - 1
357 2 3 Clone Test Row - 2
358 3 4 Clone Test Row - 3
359 4 5 Clone Test Row - 4
360 5 6 Clone Test Row - 5
361 6 7 Clone Test Row - 6
362 7 8 Clone Test Row - 7
363 8 9 Clone Test Row - 8
364 9 10 Clone Test Row - 9
365 SELECT col1, col2, col3 FROM t1 ORDER BY col1 DESC LIMIT 10;;
366 col1 col2 col3
367 99 100 Clone Test Row - 99
368 98 99 Clone Test Row - 98
369 97 98 Clone Test Row - 97
370 96 97 Clone Test Row - 96
371 95 96 Clone Test Row - 95
372 94 95 Clone Test Row - 94
373 93 94 Clone Test Row - 93
374 92 93 Clone Test Row - 92
375 91 92 Clone Test Row - 91
376 90 91 Clone Test Row - 90
377 SHOW CREATE TABLE t11;
378 Table Create Table
379 t11 CREATE TABLE `t11` (
380 `col1` int NOT NULL,
381 `col2` int DEFAULT NULL,
382 `col3` varchar(64) DEFAULT NULL,
383 `col4` blob,
384 PRIMARY KEY (`col1`)
385 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
386 CHECK TABLE t11 EXTENDED;
387 Table Op Msg_type Msg_text
388 test.t11 check status OK
389 SELECT count(*) from t11;
390 count(*)
391 100
392 SELECT col1, col2, col3 FROM t11 ORDER BY col1 LIMIT 10;;
393 col1 col2 col3
394 0 0 Clone Test Row - 0
395 1 10 Clone Test Row - 1
396 2 20 Clone Test Row - 2
397 3 30 Clone Test Row - 3
398 4 40 Clone Test Row - 4
399 5 50 Clone Test Row - 5
400 6 60 Clone Test Row - 6
401 7 70 Clone Test Row - 7
402 8 80 Clone Test Row - 8
403 9 90 Clone Test Row - 9
404 SELECT col1, col2, col3 FROM t11 ORDER BY col1 DESC LIMIT 10;;
405 col1 col2 col3
406 99 990 Clone Test Row - 99
407 98 980 Clone Test Row - 98
408 97 970 Clone Test Row - 97
409 96 960 Clone Test Row - 96
410 95 950 Clone Test Row - 95
411 94 940 Clone Test Row - 94
412 93 930 Clone Test Row - 93
413 92 920 Clone Test Row - 92
414 91 910 Clone Test Row - 91
415 90 900 Clone Test Row - 90
416 SHOW CREATE TABLE t2;
417 Table Create Table
418 t2 CREATE TABLE `t2` (
419 `col1` int NOT NULL,
420 `col2` int DEFAULT NULL,
421 `col3` varchar(64) DEFAULT NULL,
422 `col4` blob,
423 `col5` int DEFAULT NULL,
424 PRIMARY KEY (`col1`)
425 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
426 /*!50100 PARTITION BY KEY (col1)
427 PARTITIONS 5 */
428 CHECK TABLE t2 EXTENDED;
429 Table Op Msg_type Msg_text
430 test.t2 check status OK
431 SELECT count(*) from t2;
432 count(*)
433 100
434 SELECT col1, col2, col3 FROM t2 ORDER BY col1 LIMIT 10;;
435 col1 col2 col3
436 0 1 Clone Test Row - 0
437 1 2 Clone Test Row - 1
438 2 3 Clone Test Row - 2
439 3 4 Clone Test Row - 3
440 4 5 Clone Test Row - 4
441 5 6 Clone Test Row - 5
442 6 7 Clone Test Row - 6
443 7 8 Clone Test Row - 7
444 8 9 Clone Test Row - 8
445 9 10 Clone Test Row - 9
446 SELECT col1, col2, col3 FROM t2 ORDER BY col1 DESC LIMIT 10;;
447 col1 col2 col3
448 99 100 Clone Test Row - 99
449 98 99 Clone Test Row - 98
450 97 98 Clone Test Row - 97
451 96 97 Clone Test Row - 96
452 95 96 Clone Test Row - 95
453 94 95 Clone Test Row - 94
454 93 94 Clone Test Row - 93
455 92 93 Clone Test Row - 92
456 91 92 Clone Test Row - 91
457 90 91 Clone Test Row - 90
458 call execute_dml(1, 0, 100, 100, 10, 0);
459 # Restart server back on base data directory
460 # restart:
461 SET DEBUG_SYNC = 'RESET';
462 # 3. ADD INDEX while clone in progress
463 SET GLOBAL innodb_ddl_threads = 1;
464 RESET MASTER;
465 SET GLOBAL DEBUG = '+d,local_release_clone_file_pin';
466 ALTER TABLE t0 ADD INDEX col2_idx(col2), ALGORITHM=INPLACE ;
467 SET DEBUG_SYNC = 'clone_before_init_meta SIGNAL start_ddl_file_init WAIT_FOR resume_file_init';
468 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_ddl_file WAIT_FOR resume_file';
469 SET DEBUG_SYNC = 'clone_file_copy_end_before_ack SIGNAL start_ddl_file_ack WAIT_FOR resume_file_ack';
470 SET DEBUG_SYNC = 'clone_before_file_ddl_meta SIGNAL start_ddl_file_meta WAIT_FOR resume_file_meta';
471 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl_page WAIT_FOR resume_page';
472 SET DEBUG_SYNC = 'clone_before_page_ddl_meta SIGNAL start_ddl_page_meta WAIT_FOR resume_page_meta';
473 SET DEBUG_SYNC = 'clone_redo_copy SIGNAL start_ddl_redo WAIT_FOR resume_redo';
474 SET GLOBAL clone_autotune_concurrency = OFF;
475 SET GLOBAL clone_max_concurrency = 8;
476 CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR';
477 # In connection CON1
478 # Waiting for clone to reach 'Initial metadata transfer'
479 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_init';
480 # Wait finished
481 ALTER TABLE t01 ADD INDEX col2_idx(col2), ALGORITHM=INPLACE ;
482 SET DEBUG_SYNC = 'now SIGNAL resume_file_init';
483 # Waiting for clone to reach 'file copy'
484 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file';
485 # Wait finished
486 ALTER TABLE t1 ADD INDEX col2_idx(col2), ALGORITHM=INPLACE ;
487 CALL execute_dml(0, 0, 100, 100, 10, 0);
488 # Flush all dirty pages to track
489 SET GLOBAL innodb_buf_flush_list_now = 1;
490 SET DEBUG_SYNC = 'now SIGNAL resume_file';
491 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_ack';
492 SET DEBUG_SYNC = 'now SIGNAL resume_file_ack';
493 # Waiting for clone to reach DDL metadata for 'file copy'
494 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_meta';
495 # Wait finished
496 SET DEBUG_SYNC = 'now SIGNAL resume_file_meta';
497 # Waiting for clone to reach 'page copy'
498 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page';
499 # Wait finished
500 SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL resume_page';
501 ALTER TABLE t2 ADD INDEX col2_idx(col2), ALGORITHM=INPLACE ;
502 CALL execute_dml(0, 0, 100, 100, 10, 0);
503 SET DEBUG_SYNC = 'now SIGNAL resume_page';
504 # Waiting for clone to reach DDL metadata for 'page copy'
505 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page_meta';
506 # Wait finished
507 ALTER TABLE t21 ADD INDEX col2_idx(col2), ALGORITHM=INPLACE ;
508 INSERT INTO t21 SELECT * FROM t ON DUPLICATE KEY UPDATE col2 = t21.col2 + 1;;
509 SET DEBUG_SYNC = 'now SIGNAL resume_page_meta';
510 # Waiting for clone to reach 'redo copy'
511 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_redo';
512 # Wait finished
513 ALTER TABLE t3 ADD INDEX col2_idx(col2), ALGORITHM=INPLACE ;
514 SET DEBUG_SYNC = 'now SIGNAL resume_redo';
515 # In connection DEFAULT
516 # Waiting for clone to complete
517 # Wait finished
518 SET GLOBAL DEBUG = '-d,local_release_clone_file_pin';
519 # Restart server on cloned data directory
520 # restart: --datadir=CLONE_DATADIR
521 # Check cloned data
522 SHOW TABLES;
523 Tables_in_test
524 t
525 t0
526 t01
527 t1
528 t11
529 t2
530 t21
531 t3
532 SHOW CREATE TABLE t1;
533 Table Create Table
534 t1 CREATE TABLE `t1` (
535 `col1` int NOT NULL,
536 `col2` int DEFAULT NULL,
537 `col3` varchar(64) DEFAULT NULL,
538 `col4` blob,
539 PRIMARY KEY (`col1`),
540 KEY `col2_idx` (`col2`)
541 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
542 CHECK TABLE t1 EXTENDED;
543 Table Op Msg_type Msg_text
544 test.t1 check status OK
545 SELECT count(*) from t1;
546 count(*)
547 100
548 SELECT col1, col2, col3 FROM t1 ORDER BY col1 LIMIT 10;;
549 col1 col2 col3
550 0 2 Clone Test Row - 0
551 1 3 Clone Test Row - 1
552 2 4 Clone Test Row - 2
553 3 5 Clone Test Row - 3
554 4 6 Clone Test Row - 4
555 5 7 Clone Test Row - 5
556 6 8 Clone Test Row - 6
557 7 9 Clone Test Row - 7
558 8 10 Clone Test Row - 8
559 9 11 Clone Test Row - 9
560 SELECT col1, col2, col3 FROM t1 ORDER BY col1 DESC LIMIT 10;;
561 col1 col2 col3
562 99 101 Clone Test Row - 99
563 98 100 Clone Test Row - 98
564 97 99 Clone Test Row - 97
565 96 98 Clone Test Row - 96
566 95 97 Clone Test Row - 95
567 94 96 Clone Test Row - 94
568 93 95 Clone Test Row - 93
569 92 94 Clone Test Row - 92
570 91 93 Clone Test Row - 91
571 90 92 Clone Test Row - 90
572 SHOW CREATE TABLE t11;
573 Table Create Table
574 t11 CREATE TABLE `t11` (
575 `col1` int NOT NULL,
576 `col2` int DEFAULT NULL,
577 `col3` varchar(64) DEFAULT NULL,
578 `col4` blob,
579 PRIMARY KEY (`col1`)
580 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
581 CHECK TABLE t11 EXTENDED;
582 Table Op Msg_type Msg_text
583 test.t11 check status OK
584 SELECT count(*) from t11;
585 count(*)
586 100
587 SELECT col1, col2, col3 FROM t11 ORDER BY col1 LIMIT 10;;
588 col1 col2 col3
589 0 0 Clone Test Row - 0
590 1 10 Clone Test Row - 1
591 2 20 Clone Test Row - 2
592 3 30 Clone Test Row - 3
593 4 40 Clone Test Row - 4
594 5 50 Clone Test Row - 5
595 6 60 Clone Test Row - 6
596 7 70 Clone Test Row - 7
597 8 80 Clone Test Row - 8
598 9 90 Clone Test Row - 9
599 SELECT col1, col2, col3 FROM t11 ORDER BY col1 DESC LIMIT 10;;
600 col1 col2 col3
601 99 990 Clone Test Row - 99
602 98 980 Clone Test Row - 98
603 97 970 Clone Test Row - 97
604 96 960 Clone Test Row - 96
605 95 950 Clone Test Row - 95
606 94 940 Clone Test Row - 94
607 93 930 Clone Test Row - 93
608 92 920 Clone Test Row - 92
609 91 910 Clone Test Row - 91
610 90 900 Clone Test Row - 90
611 SHOW CREATE TABLE t2;
612 Table Create Table
613 t2 CREATE TABLE `t2` (
614 `col1` int NOT NULL,
615 `col2` int DEFAULT NULL,
616 `col3` varchar(64) DEFAULT NULL,
617 `col4` blob,
618 PRIMARY KEY (`col1`)
619 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
620 /*!50100 PARTITION BY KEY (col1)
621 PARTITIONS 5 */
622 CHECK TABLE t2 EXTENDED;
623 Table Op Msg_type Msg_text
624 test.t2 check status OK
625 SELECT count(*) from t2;
626 count(*)
627 100
628 SELECT col1, col2, col3 FROM t2 ORDER BY col1 LIMIT 10;;
629 col1 col2 col3
630 0 2 Clone Test Row - 0
631 1 3 Clone Test Row - 1
632 2 4 Clone Test Row - 2
633 3 5 Clone Test Row - 3
634 4 6 Clone Test Row - 4
635 5 7 Clone Test Row - 5
636 6 8 Clone Test Row - 6
637 7 9 Clone Test Row - 7
638 8 10 Clone Test Row - 8
639 9 11 Clone Test Row - 9
640 SELECT col1, col2, col3 FROM t2 ORDER BY col1 DESC LIMIT 10;;
641 col1 col2 col3
642 99 101 Clone Test Row - 99
643 98 100 Clone Test Row - 98
644 97 99 Clone Test Row - 97
645 96 98 Clone Test Row - 96
646 95 97 Clone Test Row - 95
647 94 96 Clone Test Row - 94
648 93 95 Clone Test Row - 93
649 92 94 Clone Test Row - 92
650 91 93 Clone Test Row - 91
651 90 92 Clone Test Row - 90
652 call execute_dml(1, 0, 100, 100, 10, 0);
653 # Restart server back on base data directory
654 # restart:
655 SET DEBUG_SYNC = 'RESET';
656 # 4. DROP INDEX while clone in progress
657 RESET MASTER;
658 SET GLOBAL DEBUG = '+d,local_release_clone_file_pin';
659 ALTER TABLE t0 DROP INDEX col2_idx, ALGORITHM=INPLACE ;
660 SET DEBUG_SYNC = 'clone_before_init_meta SIGNAL start_ddl_file_init WAIT_FOR resume_file_init';
661 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_ddl_file WAIT_FOR resume_file';
662 SET DEBUG_SYNC = 'clone_file_copy_end_before_ack SIGNAL start_ddl_file_ack WAIT_FOR resume_file_ack';
663 SET DEBUG_SYNC = 'clone_before_file_ddl_meta SIGNAL start_ddl_file_meta WAIT_FOR resume_file_meta';
664 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl_page WAIT_FOR resume_page';
665 SET DEBUG_SYNC = 'clone_before_page_ddl_meta SIGNAL start_ddl_page_meta WAIT_FOR resume_page_meta';
666 SET DEBUG_SYNC = 'clone_redo_copy SIGNAL start_ddl_redo WAIT_FOR resume_redo';
667 SET GLOBAL clone_autotune_concurrency = OFF;
668 SET GLOBAL clone_max_concurrency = 8;
669 CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR';
670 # In connection CON1
671 # Waiting for clone to reach 'Initial metadata transfer'
672 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_init';
673 # Wait finished
674 ALTER TABLE t01 DROP INDEX col2_idx, ALGORITHM=INPLACE ;
675 SET DEBUG_SYNC = 'now SIGNAL resume_file_init';
676 # Waiting for clone to reach 'file copy'
677 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file';
678 # Wait finished
679 ALTER TABLE t1 DROP INDEX col2_idx, ALGORITHM=INPLACE ;
680 CALL execute_dml(0, 0, 100, 100, 10, 0);
681 # Flush all dirty pages to track
682 SET GLOBAL innodb_buf_flush_list_now = 1;
683 SET DEBUG_SYNC = 'now SIGNAL resume_file';
684 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_ack';
685 SET DEBUG_SYNC = 'now SIGNAL resume_file_ack';
686 # Waiting for clone to reach DDL metadata for 'file copy'
687 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_meta';
688 # Wait finished
689 SET DEBUG_SYNC = 'now SIGNAL resume_file_meta';
690 # Waiting for clone to reach 'page copy'
691 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page';
692 # Wait finished
693 SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL resume_page';
694 ALTER TABLE t2 DROP INDEX col2_idx, ALGORITHM=INPLACE ;
695 CALL execute_dml(0, 0, 100, 100, 10, 0);
696 SET DEBUG_SYNC = 'now SIGNAL resume_page';
697 # Waiting for clone to reach DDL metadata for 'page copy'
698 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page_meta';
699 # Wait finished
700 ALTER TABLE t21 DROP INDEX col2_idx, ALGORITHM=INPLACE ;
701 INSERT INTO t21 SELECT * FROM t ON DUPLICATE KEY UPDATE col2 = t21.col2 + 1;;
702 SET DEBUG_SYNC = 'now SIGNAL resume_page_meta';
703 # Waiting for clone to reach 'redo copy'
704 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_redo';
705 # Wait finished
706 ALTER TABLE t3 DROP INDEX col2_idx, ALGORITHM=INPLACE ;
707 SET DEBUG_SYNC = 'now SIGNAL resume_redo';
708 # In connection DEFAULT
709 # Waiting for clone to complete
710 # Wait finished
711 SET GLOBAL DEBUG = '-d,local_release_clone_file_pin';
712 # Restart server on cloned data directory
713 # restart: --datadir=CLONE_DATADIR
714 # Check cloned data
715 SHOW TABLES;
716 Tables_in_test
717 t
718 t0
719 t01
720 t1
721 t11
722 t2
723 t21
724 t3
725 SHOW CREATE TABLE t1;
726 Table Create Table
727 t1 CREATE TABLE `t1` (
728 `col1` int NOT NULL,
729 `col2` int DEFAULT NULL,
730 `col3` varchar(64) DEFAULT NULL,
731 `col4` blob,
732 PRIMARY KEY (`col1`)
733 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
734 CHECK TABLE t1 EXTENDED;
735 Table Op Msg_type Msg_text
736 test.t1 check status OK
737 SELECT count(*) from t1;
738 count(*)
739 100
740 SELECT col1, col2, col3 FROM t1 ORDER BY col1 LIMIT 10;;
741 col1 col2 col3
742 0 5 Clone Test Row - 0
743 1 6 Clone Test Row - 1
744 2 7 Clone Test Row - 2
745 3 8 Clone Test Row - 3
746 4 9 Clone Test Row - 4
747 5 10 Clone Test Row - 5
748 6 11 Clone Test Row - 6
749 7 12 Clone Test Row - 7
750 8 13 Clone Test Row - 8
751 9 14 Clone Test Row - 9
752 SELECT col1, col2, col3 FROM t1 ORDER BY col1 DESC LIMIT 10;;
753 col1 col2 col3
754 99 104 Clone Test Row - 99
755 98 103 Clone Test Row - 98
756 97 102 Clone Test Row - 97
757 96 101 Clone Test Row - 96
758 95 100 Clone Test Row - 95
759 94 99 Clone Test Row - 94
760 93 98 Clone Test Row - 93
761 92 97 Clone Test Row - 92
762 91 96 Clone Test Row - 91
763 90 95 Clone Test Row - 90
764 SHOW CREATE TABLE t11;
765 Table Create Table
766 t11 CREATE TABLE `t11` (
767 `col1` int NOT NULL,
768 `col2` int DEFAULT NULL,
769 `col3` varchar(64) DEFAULT NULL,
770 `col4` blob,
771 PRIMARY KEY (`col1`)
772 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
773 CHECK TABLE t11 EXTENDED;
774 Table Op Msg_type Msg_text
775 test.t11 check status OK
776 SELECT count(*) from t11;
777 count(*)
778 100
779 SELECT col1, col2, col3 FROM t11 ORDER BY col1 LIMIT 10;;
780 col1 col2 col3
781 0 0 Clone Test Row - 0
782 1 10 Clone Test Row - 1
783 2 20 Clone Test Row - 2
784 3 30 Clone Test Row - 3
785 4 40 Clone Test Row - 4
786 5 50 Clone Test Row - 5
787 6 60 Clone Test Row - 6
788 7 70 Clone Test Row - 7
789 8 80 Clone Test Row - 8
790 9 90 Clone Test Row - 9
791 SELECT col1, col2, col3 FROM t11 ORDER BY col1 DESC LIMIT 10;;
792 col1 col2 col3
793 99 990 Clone Test Row - 99
794 98 980 Clone Test Row - 98
795 97 970 Clone Test Row - 97
796 96 960 Clone Test Row - 96
797 95 950 Clone Test Row - 95
798 94 940 Clone Test Row - 94
799 93 930 Clone Test Row - 93
800 92 920 Clone Test Row - 92
801 91 910 Clone Test Row - 91
802 90 900 Clone Test Row - 90
803 SHOW CREATE TABLE t2;
804 Table Create Table
805 t2 CREATE TABLE `t2` (
806 `col1` int NOT NULL,
807 `col2` int DEFAULT NULL,
808 `col3` varchar(64) DEFAULT NULL,
809 `col4` blob,
810 PRIMARY KEY (`col1`)
811 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
812 /*!50100 PARTITION BY KEY (col1)
813 PARTITIONS 5 */
814 CHECK TABLE t2 EXTENDED;
815 Table Op Msg_type Msg_text
816 test.t2 check status OK
817 SELECT count(*) from t2;
818 count(*)
819 100
820 SELECT col1, col2, col3 FROM t2 ORDER BY col1 LIMIT 10;;
821 col1 col2 col3
822 0 5 Clone Test Row - 0
823 1 6 Clone Test Row - 1
824 2 7 Clone Test Row - 2
825 3 8 Clone Test Row - 3
826 4 9 Clone Test Row - 4
827 5 10 Clone Test Row - 5
828 6 11 Clone Test Row - 6
829 7 12 Clone Test Row - 7
830 8 13 Clone Test Row - 8
831 9 14 Clone Test Row - 9
832 SELECT col1, col2, col3 FROM t2 ORDER BY col1 DESC LIMIT 10;;
833 col1 col2 col3
834 99 104 Clone Test Row - 99
835 98 103 Clone Test Row - 98
836 97 102 Clone Test Row - 97
837 96 101 Clone Test Row - 96
838 95 100 Clone Test Row - 95
839 94 99 Clone Test Row - 94
840 93 98 Clone Test Row - 93
841 92 97 Clone Test Row - 92
842 91 96 Clone Test Row - 91
843 90 95 Clone Test Row - 90
844 call execute_dml(1, 0, 100, 100, 10, 0);
845 # Restart server back on base data directory
846 # restart:
847 SET DEBUG_SYNC = 'RESET';
848 # Cleanup
849 DROP TABLE t;
850 DROP TABLE t1;
851 DROP TABLE t2;
852 DROP PROCEDURE execute_dml;
853 DROP TABLE t0;
854 DROP TABLE t01;
855 DROP TABLE t3;
856 DROP TABLE t11;
857 DROP TABLE t21;
858 SET GLOBAL innodb_ddl_threads = default;
859 # Uninstall clone
860 UNINSTALL PLUGIN clone;