| 1 |
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded"); |
| 2 |
SET GLOBAL innodb_compression_algorithm = 1; |
| 3 |
create table t1(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=4; |
| 4 |
create table t2(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=1; |
| 5 |
create table t3(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb page_compressed=yes; |
| 6 |
create table t4(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb page_compressed=yes encrypted=yes encryption_key_id=4; |
| 7 |
create table t5(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb; |
| 8 |
insert into t1 values (NULL, 'verysecretmessage'); |
| 9 |
insert into t1(b) select b from t1; |
| 10 |
insert into t1(b) select b from t1; |
| 11 |
insert into t1(b) select b from t1; |
| 12 |
insert into t1(b) select b from t1; |
| 13 |
insert into t1(b) select b from t1; |
| 14 |
insert into t1(b) select b from t1; |
| 15 |
insert into t1(b) select b from t1; |
| 16 |
insert into t1(b) select b from t1; |
| 17 |
insert into t2 select * from t1; |
| 18 |
insert into t3 select * from t1; |
| 19 |
insert into t4 select * from t1; |
| 20 |
insert into t5 select * from t1; |
| 21 |
FLUSH TABLE t1,t2,t3,t4,t5 FOR EXPORT; |
| 22 |
backup: t1 |
| 23 |
backup: t2 |
| 24 |
backup: t3 |
| 25 |
backup: t4 |
| 26 |
backup: t5 |
| 27 |
db.opt |
| 28 |
t1.cfg |
| 29 |
t1.frm |
| 30 |
t1.ibd |
| 31 |
t2.cfg |
| 32 |
t2.frm |
| 33 |
t2.ibd |
| 34 |
t3.cfg |
| 35 |
t3.frm |
| 36 |
t3.ibd |
| 37 |
t4.cfg |
| 38 |
t4.frm |
| 39 |
t4.ibd |
| 40 |
t5.cfg |
| 41 |
t5.frm |
| 42 |
t5.ibd |
| 43 |
UNLOCK TABLES; |
| 44 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 45 |
ALTER TABLE t2 DISCARD TABLESPACE; |
| 46 |
ALTER TABLE t3 DISCARD TABLESPACE; |
| 47 |
ALTER TABLE t4 DISCARD TABLESPACE; |
| 48 |
ALTER TABLE t5 DISCARD TABLESPACE; |
| 49 |
DROP TABLE t1; |
| 50 |
DROP TABLE t3; |
| 51 |
DROP TABLE t4; |
| 52 |
DROP TABLE t5; |
| 53 |
create table t6(a int) engine=innodb; |
| 54 |
create table t5(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb; |
| 55 |
create table t3(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb page_compressed=yes; |
| 56 |
create table t1(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=4; |
| 57 |
create table t4(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb page_compressed=yes encrypted=yes encryption_key_id=4; |
| 58 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 59 |
ALTER TABLE t3 DISCARD TABLESPACE; |
| 60 |
ALTER TABLE t4 DISCARD TABLESPACE; |
| 61 |
ALTER TABLE t5 DISCARD TABLESPACE; |
| 62 |
restore: t1 .ibd and .cfg files |
| 63 |
restore: t2 .ibd and .cfg files |
| 64 |
restore: t3 .ibd and .cfg files |
| 65 |
restore: t4 .ibd and .cfg files |
| 66 |
restore: t5 .ibd and .cfg files |
| 67 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 68 |
SHOW CREATE TABLE t1; |
| 69 |
Table Create Table |
| 70 |
t1 CREATE TABLE `t1` ( |
| 71 |
`c1` bigint(20) NOT NULL AUTO_INCREMENT, |
| 72 |
`b` char(200) DEFAULT NULL, |
| 73 |
PRIMARY KEY (`c1`) |
| 74 |
) ENGINE=InnoDB AUTO_INCREMENT=504 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci `encrypted`=yes `encryption_key_id`=4 |
| 75 |
SELECT COUNT(*) FROM t1; |
| 76 |
COUNT(*) |
| 77 |
256 |
| 78 |
ALTER TABLE t2 IMPORT TABLESPACE; |
| 79 |
SELECT COUNT(*) FROM t2; |
| 80 |
COUNT(*) |
| 81 |
256 |
| 82 |
ALTER TABLE t3 IMPORT TABLESPACE; |
| 83 |
SELECT COUNT(*) FROM t3; |
| 84 |
COUNT(*) |
| 85 |
256 |
| 86 |
ALTER TABLE t4 IMPORT TABLESPACE; |
| 87 |
SELECT COUNT(*) FROM t4; |
| 88 |
COUNT(*) |
| 89 |
256 |
| 90 |
ALTER TABLE t5 IMPORT TABLESPACE; |
| 91 |
SELECT COUNT(*) FROM t5; |
| 92 |
COUNT(*) |
| 93 |
256 |
| 94 |
# t1 encrypted expecting NOT FOUND |
| 95 |
NOT FOUND /verysecretmessage/ in t1.ibd |
| 96 |
# t2 encrypted expecting NOT FOUND |
| 97 |
NOT FOUND /verysecretmessage/ in t2.ibd |
| 98 |
# t3 page compressed expecting NOT FOUND |
| 99 |
NOT FOUND /verysecretmessage/ in t3.ibd |
| 100 |
# t4 page compressed and encrypted expecting NOT FOUND |
| 101 |
NOT FOUND /verysecretmessage/ in t4.ibd |
| 102 |
# t5 normal expecting FOUND |
| 103 |
FOUND 289 /verysecretmessage/ in t5.ibd |
| 104 |
DROP TABLE t1,t2,t3,t4,t5,t6; |