| 1 |
-- source include/have_innodb.inc |
| 2 |
-- source include/innodb_undo_tablespaces.inc |
| 3 |
-- source include/have_file_key_management_plugin.inc |
| 4 |
|
| 5 |
# |
| 6 |
# MDEV-8138: strange results from encrypt-and-grep test |
| 7 |
# |
| 8 |
--let $MYSQLD_DATADIR=`select @@datadir` |
| 9 |
--let ib1_IBD = $MYSQLD_DATADIR/ibdata1 |
| 10 |
--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd |
| 11 |
--let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd |
| 12 |
--let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd |
| 13 |
--let SEARCH_RANGE = 10000000 |
| 14 |
|
| 15 |
create table t1 (a varchar(255)) engine=innodb encrypted=yes; |
| 16 |
create table t2 (a varchar(255)) engine=innodb; |
| 17 |
show warnings; |
| 18 |
create table t3 (a varchar(255)) engine=innodb encrypted=no; |
| 19 |
|
| 20 |
insert t1 values (repeat('foobarsecret', 12)); |
| 21 |
insert t2 values (repeat('tempsecret', 12)); |
| 22 |
insert t3 values (repeat('dummysecret', 12)); |
| 23 |
|
| 24 |
--echo # Wait max 10 min for key encryption threads to encrypt all spaces |
| 25 |
--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'` |
| 26 |
--let $wait_timeout= 600 |
| 27 |
--let $wait_condition=SELECT COUNT(*) = $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 |
| 28 |
--source include/wait_condition.inc |
| 29 |
|
| 30 |
--sorted_result |
| 31 |
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; |
| 32 |
--sorted_result |
| 33 |
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; |
| 34 |
|
| 35 |
FLUSH TABLES t1,t2,t3 FOR EXPORT; |
| 36 |
|
| 37 |
--let SEARCH_PATTERN=foobarsecret |
| 38 |
--echo # t1 yes on expecting NOT FOUND |
| 39 |
-- let SEARCH_FILE=$t1_IBD |
| 40 |
-- source include/search_pattern_in_file.inc |
| 41 |
--let SEARCH_PATTERN=tempsecret |
| 42 |
--echo # t2 ... on expecting NOT FOUND |
| 43 |
-- let SEARCH_FILE=$t2_IBD |
| 44 |
-- source include/search_pattern_in_file.inc |
| 45 |
--let SEARCH_PATTERN=dummysecret |
| 46 |
--echo # t3 no on expecting FOUND |
| 47 |
-- let SEARCH_FILE=$t3_IBD |
| 48 |
-- source include/search_pattern_in_file.inc |
| 49 |
--let SEARCH_PATTERN=foobarsecret |
| 50 |
--echo # ibdata1 expecting NOT FOUND |
| 51 |
-- let SEARCH_FILE=$ib1_IBD |
| 52 |
-- source include/search_pattern_in_file.inc |
| 53 |
|
| 54 |
UNLOCK TABLES; |
| 55 |
|
| 56 |
--echo # Now turn off encryption and wait for threads to decrypt everything |
| 57 |
|
| 58 |
SET GLOBAL innodb_encrypt_tables = off; |
| 59 |
|
| 60 |
--echo # Wait max 10 min for key encryption threads to decrypt all spaces |
| 61 |
--let $wait_timeout= 600 |
| 62 |
--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'` |
| 63 |
|
| 64 |
--let $wait_condition=SELECT COUNT(*) = $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND CURRENT_KEY_VERSION = 0; |
| 65 |
--source include/wait_condition.inc |
| 66 |
|
| 67 |
--sorted_result |
| 68 |
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; |
| 69 |
--sorted_result |
| 70 |
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; |
| 71 |
|
| 72 |
FLUSH TABLES t1,t2,t3 FOR EXPORT; |
| 73 |
|
| 74 |
--let SEARCH_PATTERN=foobarsecret |
| 75 |
--echo # t1 yes on expecting NOT FOUND |
| 76 |
-- let SEARCH_FILE=$t1_IBD |
| 77 |
-- source include/search_pattern_in_file.inc |
| 78 |
--let SEARCH_PATTERN=tempsecret |
| 79 |
--echo # t2 ... default expecting FOUND |
| 80 |
-- let SEARCH_FILE=$t2_IBD |
| 81 |
-- source include/search_pattern_in_file.inc |
| 82 |
--let SEARCH_PATTERN=dummysecret |
| 83 |
--echo # t3 no on expecting FOUND |
| 84 |
-- let SEARCH_FILE=$t3_IBD |
| 85 |
-- source include/search_pattern_in_file.inc |
| 86 |
--let SEARCH_PATTERN=foobarsecret |
| 87 |
--echo # ibdata1 expecting NOT FOUND |
| 88 |
-- let SEARCH_FILE=$ib1_IBD |
| 89 |
-- source include/search_pattern_in_file.inc |
| 90 |
|
| 91 |
UNLOCK TABLES; |
| 92 |
|
| 93 |
--echo # Now turn on encryption and wait for threads to encrypt all spaces |
| 94 |
SET GLOBAL innodb_encrypt_tables = on; |
| 95 |
|
| 96 |
--echo # Wait max 10 min for key encryption threads to encrypt all spaces |
| 97 |
--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'` |
| 98 |
--let $wait_timeout= 600 |
| 99 |
--let $wait_condition=SELECT COUNT(*) = $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 |
| 100 |
--source include/wait_condition.inc |
| 101 |
|
| 102 |
--sorted_result |
| 103 |
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; |
| 104 |
--sorted_result |
| 105 |
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; |
| 106 |
|
| 107 |
FLUSH TABLES t1,t2,t3 FOR EXPORT; |
| 108 |
|
| 109 |
--let SEARCH_PATTERN=foobarsecret |
| 110 |
--echo # t1 yes on expecting NOT FOUND |
| 111 |
-- let SEARCH_FILE=$t1_IBD |
| 112 |
-- source include/search_pattern_in_file.inc |
| 113 |
--let SEARCH_PATTERN=tempsecret |
| 114 |
--echo # t2 ... on expecting NOT FOUND |
| 115 |
-- let SEARCH_FILE=$t2_IBD |
| 116 |
-- source include/search_pattern_in_file.inc |
| 117 |
--let SEARCH_PATTERN=dummysecret |
| 118 |
--echo # t3 no on expecting FOUND |
| 119 |
-- let SEARCH_FILE=$t3_IBD |
| 120 |
-- source include/search_pattern_in_file.inc |
| 121 |
--let SEARCH_PATTERN=foobarsecret |
| 122 |
--echo # ibdata1 expecting NOT FOUND |
| 123 |
-- let SEARCH_FILE=$ib1_IBD |
| 124 |
-- source include/search_pattern_in_file.inc |
| 125 |
|
| 126 |
UNLOCK TABLES; |
| 127 |
|
| 128 |
drop table t1, t2, t3; |