| 1 |
# |
| 2 |
# Test negative scenarios, lifted from other table_encrypt tests |
| 3 |
# |
| 4 |
# Create a table with encryption, should fail since keyring is not |
| 5 |
# loaded |
| 6 |
|
| 7 |
--source include/have_debug.inc |
| 8 |
|
| 9 |
call mtr.add_suppression(".*Encryption can't find master key.*"); |
| 10 |
call mtr.add_suppression(".*Encryption information in datafile.*"); |
| 11 |
|
| 12 |
--error ER_CANNOT_FIND_KEY_IN_KEYRING |
| 13 |
CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; |
| 14 |
|
| 15 |
CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB; |
| 16 |
|
| 17 |
--error ER_CANNOT_FIND_KEY_IN_KEYRING |
| 18 |
ALTER TABLE t1 ENCRYPTION="Y", algorithm=copy; |
| 19 |
|
| 20 |
DROP TABLE t1; |
| 21 |
|
| 22 |
--let $restart_parameters= restart: --early-plugin-load="keyring_file=$KEYRING_PLUGIN" --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT |
| 23 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR $KEYRING_PLUGIN_OPT --plugin-dir=KEYRING_PLUGIN_PATH |
| 24 |
--replace_regex /\.dll/.so/ |
| 25 |
-- source include/restart_mysqld.inc |
| 26 |
|
| 27 |
# Create a table with encryption |
| 28 |
CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; |
| 29 |
|
| 30 |
SHOW CREATE TABLE t1; |
| 31 |
INSERT INTO t1 VALUES(0, "aaaaa"); |
| 32 |
INSERT INTO t1 VALUES(1, "bbbbb"); |
| 33 |
INSERT INTO t1 VALUES(2, "ccccc"); |
| 34 |
INSERT INTO t1 VALUES(3, "ddddd"); |
| 35 |
INSERT INTO t1 VALUES(4, "eeeee"); |
| 36 |
INSERT INTO t1 VALUES(5, "fffff"); |
| 37 |
INSERT INTO t1 VALUES(6, "ggggg"); |
| 38 |
INSERT INTO t1 VALUES(7, "hhhhh"); |
| 39 |
INSERT INTO t1 VALUES(8, "iiiii"); |
| 40 |
INSERT INTO t1 VALUES(9, "jjjjj"); |
| 41 |
INSERT INTO t1 select * from t1; |
| 42 |
INSERT INTO t1 select * from t1; |
| 43 |
INSERT INTO t1 select * from t1; |
| 44 |
INSERT INTO t1 select * from t1; |
| 45 |
INSERT INTO t1 select * from t1; |
| 46 |
INSERT INTO t1 select * from t1; |
| 47 |
|
| 48 |
SELECT * FROM t1 ORDER BY c1 LIMIT 10; |
| 49 |
|
| 50 |
--disable_query_log |
| 51 |
SET DEBUG='+d,os_block_cache_busy'; |
| 52 |
--enable_query_log |
| 53 |
|
| 54 |
# Restart without key ring to check the encrypted table can't be open. |
| 55 |
--let $restart_parameters= restart: |
| 56 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR $KEYRING_PLUGIN_OPT --plugin-dir=KEYRING_PLUGIN_PATH |
| 57 |
--replace_regex /\.dll/.so/ |
| 58 |
-- source include/restart_mysqld.inc |
| 59 |
|
| 60 |
--error ER_CANNOT_FIND_KEY_IN_KEYRING |
| 61 |
SELECT * FROM t1 ORDER BY c1 LIMIT 10; |
| 62 |
|
| 63 |
# Restart with keyring to check that we can now open the table |
| 64 |
--let $restart_parameters= restart: --early-plugin-load="keyring_file=$KEYRING_PLUGIN" --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT |
| 65 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR $KEYRING_PLUGIN_OPT --plugin-dir=KEYRING_PLUGIN_PATH |
| 66 |
--replace_regex /\.dll/.so/ |
| 67 |
--source include/restart_mysqld.inc |
| 68 |
|
| 69 |
--disable_query_log |
| 70 |
SET DEBUG='-d,os_block_cache_busy'; |
| 71 |
--enable_query_log |
| 72 |
|
| 73 |
SELECT * FROM t1 ORDER BY c1 LIMIT 10; |
| 74 |
|
| 75 |
DROP TABLE t1; |
| 76 |
|
| 77 |
--let $restart_parameters= restart: |
| 78 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR $KEYRING_PLUGIN_OPT --plugin-dir=KEYRING_PLUGIN_PATH |
| 79 |
--replace_regex /\.dll/.so/ |
| 80 |
--source include/restart_mysqld.inc |
| 81 |
|
| 82 |
--remove_file $MYSQL_TMP_DIR/mysecret_keyring |