| 1 |
create table t1 (a varchar(255)) engine=innodb encrypted=yes; |
| 2 |
create table t2 (a varchar(255)) engine=innodb; |
| 3 |
show warnings; |
| 4 |
Level Code Message |
| 5 |
create table t3 (a varchar(255)) engine=innodb encrypted=no; |
| 6 |
insert t1 values (repeat('foobarsecret', 12)); |
| 7 |
insert t2 values (repeat('tempsecret', 12)); |
| 8 |
insert t3 values (repeat('dummysecret', 12)); |
| 9 |
# Wait max 10 min for key encryption threads to encrypt all spaces |
| 10 |
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; |
| 11 |
NAME |
| 12 |
test/t3 |
| 13 |
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; |
| 14 |
NAME |
| 15 |
innodb_system |
| 16 |
mysql/innodb_index_stats |
| 17 |
mysql/innodb_table_stats |
| 18 |
mysql/transaction_registry |
| 19 |
test/t1 |
| 20 |
test/t2 |
| 21 |
FLUSH TABLES t1,t2,t3 FOR EXPORT; |
| 22 |
# t1 yes on expecting NOT FOUND |
| 23 |
NOT FOUND /foobarsecret/ in t1.ibd |
| 24 |
# t2 ... on expecting NOT FOUND |
| 25 |
NOT FOUND /tempsecret/ in t2.ibd |
| 26 |
# t3 no on expecting FOUND |
| 27 |
FOUND 12 /dummysecret/ in t3.ibd |
| 28 |
# ibdata1 expecting NOT FOUND |
| 29 |
NOT FOUND /foobarsecret/ in ibdata1 |
| 30 |
UNLOCK TABLES; |
| 31 |
# Now turn off encryption and wait for threads to decrypt everything |
| 32 |
SET GLOBAL innodb_encrypt_tables = off; |
| 33 |
# Wait max 10 min for key encryption threads to decrypt all spaces |
| 34 |
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; |
| 35 |
NAME |
| 36 |
innodb_system |
| 37 |
mysql/innodb_index_stats |
| 38 |
mysql/innodb_table_stats |
| 39 |
mysql/transaction_registry |
| 40 |
test/t2 |
| 41 |
test/t3 |
| 42 |
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; |
| 43 |
NAME |
| 44 |
test/t1 |
| 45 |
FLUSH TABLES t1,t2,t3 FOR EXPORT; |
| 46 |
# t1 yes on expecting NOT FOUND |
| 47 |
NOT FOUND /foobarsecret/ in t1.ibd |
| 48 |
# t2 ... default expecting FOUND |
| 49 |
FOUND 12 /tempsecret/ in t2.ibd |
| 50 |
# t3 no on expecting FOUND |
| 51 |
FOUND 12 /dummysecret/ in t3.ibd |
| 52 |
# ibdata1 expecting NOT FOUND |
| 53 |
NOT FOUND /foobarsecret/ in ibdata1 |
| 54 |
UNLOCK TABLES; |
| 55 |
# Now turn on encryption and wait for threads to encrypt all spaces |
| 56 |
SET GLOBAL innodb_encrypt_tables = on; |
| 57 |
# Wait max 10 min for key encryption threads to encrypt all spaces |
| 58 |
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; |
| 59 |
NAME |
| 60 |
test/t3 |
| 61 |
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; |
| 62 |
NAME |
| 63 |
innodb_system |
| 64 |
mysql/innodb_index_stats |
| 65 |
mysql/innodb_table_stats |
| 66 |
mysql/transaction_registry |
| 67 |
test/t1 |
| 68 |
test/t2 |
| 69 |
FLUSH TABLES t1,t2,t3 FOR EXPORT; |
| 70 |
# t1 yes on expecting NOT FOUND |
| 71 |
NOT FOUND /foobarsecret/ in t1.ibd |
| 72 |
# t2 ... on expecting NOT FOUND |
| 73 |
NOT FOUND /tempsecret/ in t2.ibd |
| 74 |
# t3 no on expecting FOUND |
| 75 |
FOUND 12 /dummysecret/ in t3.ibd |
| 76 |
# ibdata1 expecting NOT FOUND |
| 77 |
NOT FOUND /foobarsecret/ in ibdata1 |
| 78 |
UNLOCK TABLES; |
| 79 |
drop table t1, t2, t3; |