| 1 |
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); |
| 2 |
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue."); |
| 3 |
SET GLOBAL innodb_compression_algorithm = 1; |
| 4 |
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=4; |
| 5 |
show warnings; |
| 6 |
Level Code Message |
| 7 |
create table t2(c1 bigint not null, b char(200)) engine=innodb page_compressed=1 encrypted=yes encryption_key_id=4; |
| 8 |
show warnings; |
| 9 |
Level Code Message |
| 10 |
create table t3(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=4; |
| 11 |
show warnings; |
| 12 |
Level Code Message |
| 13 |
create table t4(c1 bigint not null, b char(200)) engine=innodb page_compressed=1; |
| 14 |
show warnings; |
| 15 |
Level Code Message |
| 16 |
create procedure innodb_insert_proc (repeat_count int) |
| 17 |
begin |
| 18 |
declare current_num int; |
| 19 |
set current_num = 0; |
| 20 |
while current_num < repeat_count do |
| 21 |
insert into t1 values(current_num, repeat('foobar',30)); |
| 22 |
insert into t2 values(current_num, repeat('barfoo',30)); |
| 23 |
insert into t3 values(current_num, repeat('tmpres',30)); |
| 24 |
insert into t4 values(current_num, repeat('mysql',30)); |
| 25 |
set current_num = current_num + 1; |
| 26 |
end while; |
| 27 |
end// |
| 28 |
commit; |
| 29 |
set autocommit=0; |
| 30 |
call innodb_insert_proc(2000); |
| 31 |
commit; |
| 32 |
set autocommit=1; |
| 33 |
select count(*) from t1; |
| 34 |
count(*) |
| 35 |
2000 |
| 36 |
select count(*) from t2; |
| 37 |
count(*) |
| 38 |
2000 |
| 39 |
select count(*) from t3; |
| 40 |
count(*) |
| 41 |
2000 |
| 42 |
select count(*) from t4; |
| 43 |
count(*) |
| 44 |
2000 |
| 45 |
FLUSH TABLE t1,t2,t3,t4 FOR EXPORT; |
| 46 |
# List before copying files |
| 47 |
db.opt |
| 48 |
t1.cfg |
| 49 |
t1.frm |
| 50 |
t1.ibd |
| 51 |
t2.cfg |
| 52 |
t2.frm |
| 53 |
t2.ibd |
| 54 |
t3.cfg |
| 55 |
t3.frm |
| 56 |
t3.ibd |
| 57 |
t4.cfg |
| 58 |
t4.frm |
| 59 |
t4.ibd |
| 60 |
backup: t1 |
| 61 |
backup: t2 |
| 62 |
backup: t3 |
| 63 |
backup: t4 |
| 64 |
db.opt |
| 65 |
t1.cfg |
| 66 |
t1.frm |
| 67 |
t1.ibd |
| 68 |
t2.cfg |
| 69 |
t2.frm |
| 70 |
t2.ibd |
| 71 |
t3.cfg |
| 72 |
t3.frm |
| 73 |
t3.ibd |
| 74 |
t4.cfg |
| 75 |
t4.frm |
| 76 |
t4.ibd |
| 77 |
UNLOCK TABLES; |
| 78 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 79 |
ALTER TABLE t2 DISCARD TABLESPACE; |
| 80 |
ALTER TABLE t3 DISCARD TABLESPACE; |
| 81 |
ALTER TABLE t4 DISCARD TABLESPACE; |
| 82 |
restore: t1 .ibd and .cfg files |
| 83 |
restore: t2 .ibd and .cfg files |
| 84 |
restore: t3 .ibd and .cfg files |
| 85 |
restore: t4 .ibd and .cfg files |
| 86 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 87 |
SHOW CREATE TABLE t1; |
| 88 |
Table Create Table |
| 89 |
t1 CREATE TABLE `t1` ( |
| 90 |
`c1` bigint(20) NOT NULL, |
| 91 |
`b` char(200) DEFAULT NULL |
| 92 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci `encrypted`=yes `encryption_key_id`=4 |
| 93 |
SELECT COUNT(*) FROM t1; |
| 94 |
COUNT(*) |
| 95 |
2000 |
| 96 |
ALTER TABLE t2 IMPORT TABLESPACE; |
| 97 |
SHOW CREATE TABLE t2; |
| 98 |
Table Create Table |
| 99 |
t2 CREATE TABLE `t2` ( |
| 100 |
`c1` bigint(20) NOT NULL, |
| 101 |
`b` char(200) DEFAULT NULL |
| 102 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci `page_compressed`=1 `encrypted`=yes `encryption_key_id`=4 |
| 103 |
SELECT COUNT(*) FROM t2; |
| 104 |
COUNT(*) |
| 105 |
2000 |
| 106 |
ALTER TABLE t3 IMPORT TABLESPACE; |
| 107 |
SHOW CREATE TABLE t3; |
| 108 |
Table Create Table |
| 109 |
t3 CREATE TABLE `t3` ( |
| 110 |
`c1` bigint(20) NOT NULL, |
| 111 |
`b` char(200) DEFAULT NULL |
| 112 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ROW_FORMAT=COMPRESSED `encrypted`=yes `encryption_key_id`=4 |
| 113 |
SELECT COUNT(*) FROM t3; |
| 114 |
COUNT(*) |
| 115 |
2000 |
| 116 |
ALTER TABLE t4 IMPORT TABLESPACE; |
| 117 |
SHOW CREATE TABLE t4; |
| 118 |
Table Create Table |
| 119 |
t4 CREATE TABLE `t4` ( |
| 120 |
`c1` bigint(20) NOT NULL, |
| 121 |
`b` char(200) DEFAULT NULL |
| 122 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci `page_compressed`=1 |
| 123 |
SELECT COUNT(*) FROM t4; |
| 124 |
COUNT(*) |
| 125 |
2000 |
| 126 |
# tables should be still either encrypted and/or compressed |
| 127 |
# t1 yes on expecting NOT FOUND |
| 128 |
NOT FOUND /foobar/ in t1.ibd |
| 129 |
# t2 yes on expecting NOT FOUND |
| 130 |
NOT FOUND /barfoo/ in t2.ibd |
| 131 |
# t3 yes on expecting NOT FOUND |
| 132 |
NOT FOUND /tmpres/ in t3.ibd |
| 133 |
# t4 yes on expecting NOT FOUND |
| 134 |
NOT FOUND /mysql/ in t4.ibd |
| 135 |
DROP PROCEDURE innodb_insert_proc; |
| 136 |
DROP TABLE t1,t2,t3,t4; |