| 1 |
--source include/have_innodb.inc |
| 2 |
# embedded does not support restart |
| 3 |
-- source include/not_embedded.inc |
| 4 |
-- source filekeys_plugin_exists.inc |
| 5 |
# |
| 6 |
# MDEV-8750: Server crashes in page_cur_is_after_last on altering table using a wrong encryption key |
| 7 |
# MDEV-8769: Server crash at file btr0btr.ic line 122 when defragmenting encrypted table using incorrect keys |
| 8 |
# MDEV-8768: Server crash at file btr0btr.ic line 122 when checking encrypted table using incorrect keys |
| 9 |
# MDEV-8727: Server/InnoDB hangs on shutdown after trying to read an encrypted table with a wrong key |
| 10 |
# |
| 11 |
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|does not exist.*is trying to rename)"); |
| 12 |
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1(new)?\\.ibd' cannot be decrypted; key_version=1"); |
| 13 |
call mtr.add_suppression("InnoDB: Recovery failed to read page"); |
| 14 |
# Suppression for builds where file_key_management plugin is linked statically |
| 15 |
call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); |
| 16 |
call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as discarded\\."); |
| 17 |
call mtr.add_suppression("InnoDB: Failed to read page 3 from file '.*test/t1\\.ibd'"); |
| 18 |
call mtr.add_suppression("InnoDB: File '.*test/t1\\.ibd' is corrupted"); |
| 19 |
call mtr.add_suppression("Table `test`\\.`t1` is corrupted"); |
| 20 |
call mtr.add_suppression("InnoDB: Cannot delete tablespace .* because it is not found in the tablespace memory cache"); |
| 21 |
call mtr.add_suppression("InnoDB: ALTER TABLE `test`\\.`t1` DISCARD TABLESPACE failed to find tablespace"); |
| 22 |
# for innodb_checksum_algorithm=full_crc32 only |
| 23 |
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space="); |
| 24 |
|
| 25 |
--let $restart_parameters=--plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt |
| 26 |
--source include/restart_mysqld.inc |
| 27 |
|
| 28 |
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB |
| 29 |
ENCRYPTED=YES ENCRYPTION_KEY_ID=4; |
| 30 |
INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); |
| 31 |
|
| 32 |
--let $restart_parameters=--plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt |
| 33 |
--source include/restart_mysqld.inc |
| 34 |
|
| 35 |
--error ER_TABLE_CORRUPT |
| 36 |
SELECT * FROM t1; |
| 37 |
--replace_regex /key_id [1-9][0-9]*/\1 / |
| 38 |
SHOW WARNINGS; |
| 39 |
--error ER_TABLE_CORRUPT |
| 40 |
ALTER TABLE t1 ENGINE=InnoDB; |
| 41 |
--replace_regex /key_id [1-9][0-9]*/\1 / |
| 42 |
SHOW WARNINGS; |
| 43 |
OPTIMIZE TABLE t1; |
| 44 |
--replace_regex /key_id [1-9][0-9]*/\1 / |
| 45 |
SHOW WARNINGS; |
| 46 |
|
| 47 |
CHECK TABLE t1; |
| 48 |
--replace_regex /key_id [1-9][0-9]*/\1 / |
| 49 |
SHOW WARNINGS; |
| 50 |
|
| 51 |
--let $restart_parameters=--plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt |
| 52 |
--source include/restart_mysqld.inc |
| 53 |
|
| 54 |
let MYSQLD_DATADIR =`SELECT @@datadir`; |
| 55 |
|
| 56 |
FLUSH TABLES t1 FOR EXPORT; |
| 57 |
perl; |
| 58 |
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; |
| 59 |
ib_backup_tablespaces("test", "t1"); |
| 60 |
EOF |
| 61 |
UNLOCK TABLES; |
| 62 |
|
| 63 |
--let $restart_parameters=--plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt |
| 64 |
--source include/restart_mysqld.inc |
| 65 |
|
| 66 |
--error ER_TABLE_CORRUPT |
| 67 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 68 |
# Drop table will succeed. |
| 69 |
DROP TABLE t1; |
| 70 |
|
| 71 |
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB |
| 72 |
ENCRYPTED=YES ENCRYPTION_KEY_ID=4; |
| 73 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 74 |
|
| 75 |
perl; |
| 76 |
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; |
| 77 |
ib_discard_tablespaces("test", "t1"); |
| 78 |
ib_restore_tablespaces("test", "t1"); |
| 79 |
EOF |
| 80 |
|
| 81 |
--let $restart_parameters=--plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt |
| 82 |
--source include/restart_mysqld.inc |
| 83 |
|
| 84 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 85 |
|
| 86 |
perl; |
| 87 |
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; |
| 88 |
ib_discard_tablespaces("test", "t1"); |
| 89 |
ib_restore_tablespaces("test", "t1"); |
| 90 |
EOF |
| 91 |
|
| 92 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 93 |
SHOW CREATE TABLE t1; |
| 94 |
|
| 95 |
--let $restart_parameters= --innodb-encrypt-tables --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt |
| 96 |
--source include/restart_mysqld.inc |
| 97 |
|
| 98 |
--error ER_TABLE_CORRUPT |
| 99 |
RENAME TABLE t1 TO t1new; |
| 100 |
--error ER_TABLE_CORRUPT |
| 101 |
ALTER TABLE t1 RENAME TO t1new; |
| 102 |
# Drop should succeed even with incorrect keys |
| 103 |
DROP TABLE t1; |