Debian Codegraph @

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