|
| 1 | +--source include/have_innodb.inc |
| 2 | +# embedded does not support restart |
| 3 | +-- source include/not_embedded.inc |
| 4 | +-- source include/not_valgrind.inc |
| 5 | +# Avoid CrashReporter popup on Mac |
| 6 | +-- source include/not_crashrep.inc |
| 7 | + |
| 8 | +# |
| 9 | +# MDEV-8772: Assertion failure in file ha_innodb.cc line 20027 when importing page compressed and encrypted tablespace using incorrect keys |
| 10 | +# |
| 11 | +call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded"); |
| 12 | + |
| 13 | +--disable_query_log |
| 14 | +let $innodb_file_format_orig = `SELECT @@innodb_file_format`; |
| 15 | +let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; |
| 16 | +--enable_query_log |
| 17 | + |
| 18 | +--let $MYSQLD_TMPDIR = `SELECT @@tmpdir` |
| 19 | +--let $MYSQLD_DATADIR = `SELECT @@datadir` |
| 20 | +--let SEARCH_RANGE = 10000000 |
| 21 | +--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd |
| 22 | +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 23 | +--shutdown_server |
| 24 | +--source include/wait_until_disconnected.inc |
| 25 | + |
| 26 | +--write_file $MYSQLTEST_VARDIR/keys1.txt |
| 27 | +1;770A8A65DA156D24EE2A093277530142 |
| 28 | +4;770A8A65DA156D24EE2A093277530143 |
| 29 | +EOF |
| 30 | + |
| 31 | +--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 32 | +--enable_reconnect |
| 33 | +--source include/wait_until_connected_again.inc |
| 34 | + |
| 35 | +SET GLOBAL innodb_file_format = `Barracuda`; |
| 36 | +SET GLOBAL innodb_file_per_table = ON; |
| 37 | +set global innodb_compression_algorithm = 1; |
| 38 | + |
| 39 | +CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4; |
| 40 | +SHOW WARNINGS; |
| 41 | +SHOW CREATE TABLE t1; |
| 42 | +INSERT INTO t1 VALUES (1,'foobar'),(2,'barfoo'); |
| 43 | +FLUSH TABLE t1 FOR EXPORT; |
| 44 | +--echo # List before copying files |
| 45 | +--list_files $MYSQLD_DATADIR/test |
| 46 | +--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg |
| 47 | +--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd |
| 48 | +UNLOCK TABLES; |
| 49 | + |
| 50 | +--sleep 5 |
| 51 | +--echo # Tablespaces should be still encrypted |
| 52 | +--let SEARCH_PATTERN=foobar |
| 53 | +--echo # t1 yes on expecting NOT FOUND |
| 54 | +-- let SEARCH_FILE=$t1_IBD |
| 55 | +-- source include/search_pattern_in_file.inc |
| 56 | + |
| 57 | +ALTER TABLE t1 DISCARD TABLESPACE; |
| 58 | + |
| 59 | +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 60 | +--shutdown_server |
| 61 | +--source include/wait_until_disconnected.inc |
| 62 | + |
| 63 | +--write_file $MYSQLTEST_VARDIR/keys2.txt |
| 64 | +1;770A8A65DA156D24EE2A093277530142 |
| 65 | +4;770A8A65DA156D24EE2A093277530144 |
| 66 | +EOF |
| 67 | + |
| 68 | +--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 69 | +--enable_reconnect |
| 70 | +--source include/wait_until_connected_again.inc |
| 71 | +--source include/restart_mysqld.inc |
| 72 | + |
| 73 | +SET GLOBAL innodb_file_format = `Barracuda`; |
| 74 | +SET GLOBAL innodb_file_per_table = ON; |
| 75 | +--echo # List after t1 DISCARD |
| 76 | +--list_files $MYSQLD_DATADIR/test |
| 77 | +--copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg |
| 78 | +--copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd |
| 79 | + |
| 80 | +--error ER_GET_ERRMSG |
| 81 | +ALTER TABLE t1 IMPORT TABLESPACE; |
| 82 | +SHOW CREATE TABLE t1; |
| 83 | +--error ER_TABLESPACE_DISCARDED |
| 84 | +SELECT * FROM t1; |
| 85 | +--sleep 5 |
| 86 | +--echo # Tablespaces should be still encrypted |
| 87 | +-- let SEARCH_FILE=$t1_IBD |
| 88 | +--let SEARCH_PATTERN=foobar |
| 89 | +--echo # t1 yes on expecting NOT FOUND |
| 90 | +-- let SEARCH_FILE=$t1_IBD |
| 91 | +-- source include/search_pattern_in_file.inc |
| 92 | +DROP TABLE t1; |
| 93 | + |
| 94 | +# reset system |
| 95 | +--disable_query_log |
| 96 | +EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; |
| 97 | +EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; |
| 98 | +--enable_query_log |
| 99 | + |
| 100 | +--remove_file $MYSQLTEST_VARDIR/keys1.txt |
| 101 | +--remove_file $MYSQLTEST_VARDIR/keys2.txt |
0 commit comments