| 1 |
SET @saved_encrypt_tables = @@global.innodb_encrypt_tables; |
| 2 |
SET @saved_encryption_threads = @@global.innodb_encryption_threads; |
| 3 |
SET @saved_encryption_key_id = @@global.innodb_default_encryption_key_id; |
| 4 |
SET GLOBAL innodb_encrypt_tables = ON; |
| 5 |
SET GLOBAL innodb_encryption_threads = 4; |
| 6 |
SET GLOBAL innodb_default_encryption_key_id=4; |
| 7 |
create table tce(a serial, b blob, index(b(10))) engine=innodb |
| 8 |
ROW_FORMAT=COMPRESSED encrypted=yes; |
| 9 |
create table tc(a serial, b blob, index(b(10))) engine=innodb |
| 10 |
ROW_FORMAT=COMPRESSED encrypted=no; |
| 11 |
Warnings: |
| 12 |
Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 |
| 13 |
create table te(a serial, b blob, index(b(10))) engine=innodb |
| 14 |
encrypted=yes; |
| 15 |
create table t(a serial, b blob, index(b(10))) engine=innodb |
| 16 |
encrypted=no; |
| 17 |
Warnings: |
| 18 |
Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 |
| 19 |
create table tpe(a serial, b blob, index(b(10))) engine=innodb |
| 20 |
page_compressed=yes encrypted=yes; |
| 21 |
create table tp(a serial, b blob, index(b(10))) engine=innodb |
| 22 |
page_compressed=yes encrypted=no; |
| 23 |
Warnings: |
| 24 |
Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 |
| 25 |
begin; |
| 26 |
insert into tce(b) values (repeat('secret',20)); |
| 27 |
insert into tc(b) values (repeat('secret',20)); |
| 28 |
insert into te(b) values (repeat('secret',20)); |
| 29 |
insert into t(b) values (repeat('secret',20)); |
| 30 |
insert into tpe(b) values (repeat('secret',20)); |
| 31 |
insert into tp(b) values (repeat('secret',20)); |
| 32 |
commit; |
| 33 |
FLUSH TABLES tce, tc, te, t, tpe, tp FOR EXPORT; |
| 34 |
backup: tce |
| 35 |
backup: tc |
| 36 |
backup: te |
| 37 |
backup: t |
| 38 |
backup: tpe |
| 39 |
backup: tp |
| 40 |
db.opt |
| 41 |
t.cfg |
| 42 |
t.frm |
| 43 |
t.ibd |
| 44 |
tc.cfg |
| 45 |
tc.frm |
| 46 |
tc.ibd |
| 47 |
tce.cfg |
| 48 |
tce.frm |
| 49 |
tce.ibd |
| 50 |
te.cfg |
| 51 |
te.frm |
| 52 |
te.ibd |
| 53 |
tp.cfg |
| 54 |
tp.frm |
| 55 |
tp.ibd |
| 56 |
tpe.cfg |
| 57 |
tpe.frm |
| 58 |
tpe.ibd |
| 59 |
UNLOCK TABLES; |
| 60 |
ALTER TABLE tce DISCARD TABLESPACE; |
| 61 |
ALTER TABLE tc DISCARD TABLESPACE; |
| 62 |
ALTER TABLE te DISCARD TABLESPACE; |
| 63 |
ALTER TABLE t DISCARD TABLESPACE; |
| 64 |
ALTER TABLE tpe DISCARD TABLESPACE; |
| 65 |
ALTER TABLE tp DISCARD TABLESPACE; |
| 66 |
restore: tce .ibd and .cfg files |
| 67 |
restore: tc .ibd and .cfg files |
| 68 |
restore: te .ibd and .cfg files |
| 69 |
restore: t .ibd and .cfg files |
| 70 |
restore: tpe .ibd and .cfg files |
| 71 |
restore: tp .ibd and .cfg files |
| 72 |
ALTER TABLE tce IMPORT TABLESPACE; |
| 73 |
update tce set b=substr(b,1); |
| 74 |
ALTER TABLE tc IMPORT TABLESPACE; |
| 75 |
update tc set b=substr(b,1); |
| 76 |
ALTER TABLE te IMPORT TABLESPACE; |
| 77 |
update te set b=substr(b,1); |
| 78 |
ALTER TABLE t IMPORT TABLESPACE; |
| 79 |
update t set b=substr(b,1); |
| 80 |
ALTER TABLE tpe IMPORT TABLESPACE; |
| 81 |
update tpe set b=substr(b,1); |
| 82 |
ALTER TABLE tp IMPORT TABLESPACE; |
| 83 |
update tp set b=substr(b,1); |
| 84 |
CHECK TABLE tce, tc, te, t, tpe, tp; |
| 85 |
Table Op Msg_type Msg_text |
| 86 |
test.tce check status OK |
| 87 |
test.tc check status OK |
| 88 |
test.te check status OK |
| 89 |
test.t check status OK |
| 90 |
test.tpe check status OK |
| 91 |
test.tp check status OK |
| 92 |
DROP TABLE tce, tc, te, t, tpe, tp; |
| 93 |
SET GLOBAL innodb_encrypt_tables = @saved_encrypt_tables; |
| 94 |
SET GLOBAL innodb_encryption_threads = @saved_encryption_threads; |
| 95 |
SET GLOBAL innodb_default_encryption_key_id = @saved_encryption_key_id; |