Debian Codegraph @

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

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