Debian Codegraph @

mysql-test/suite/innodb/t/log_encrypt_7.test

raw
1 # InnoDB transparent encryption on redo log.
2 # This test case will test negative scenarios for encryption features.
3 #
4
5 --source include/no_valgrind_without_big.inc
6 --source include/have_innodb_max_16k.inc
7
8 #Suppress following messages from myslqd log
9 --disable_query_log
10 call mtr.add_suppression("keyring_file initialization failure. Please check if the keyring_file_data points to readable keyring file or keyring file can be created in the specified location. The keyring_file will stay unusable until correct path to the keyring file gets provided");
11 call mtr.add_suppression("Error while loading keyring content. The keyring might be malformed");
12 call mtr.add_suppression("ibd can't be decrypted, please confirm that keyring is loaded.");
13 call mtr.add_suppression("\\[Warning\\] .* Plugin mysqlx reported.*");
14 call mtr.add_suppression("\\[Warning\\] .* Ignoring tablespace .* because it could not be opened");
15 call mtr.add_suppression("\\[ERROR\\] .* Encryption can't find master key, please check the keyring is loaded.");
16 call mtr.add_suppression("\\[ERROR\\] .* Failed to find tablespace for table `\.\.*`\.`\.\.*` in the cache.");
17 call mtr.add_suppression("\\[ERROR\\] .* Can't set redo log files to be encrypted.");
18 --enable_query_log
19
20 #Enable redo log encryption, should report error in server log, since keyring is not loaded.
21 SET GLOBAL innodb_redo_log_encrypt = ON;
22
23 # Create a table with encryption, should fail since keyring is not
24 # loaded.
25 --error ER_CANNOT_FIND_KEY_IN_KEYRING
26 CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB;
27
28 CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB;
29
30 --error ER_CANNOT_FIND_KEY_IN_KEYRING
31 ALTER TABLE t1 ENCRYPTION="Y", algorithm=copy;
32
33 let $old_innodb_file_per_table = `SELECT @@innodb_file_per_table`;
34 let $old_innodb_redo_log_encrypt = `SELECT @@innodb_redo_log_encrypt`;
35
36 --disable_warnings
37 DROP DATABASE IF EXISTS tde_db;
38 CREATE DATABASE tde_db;
39 USE tde_db;
40 --enable_warnings
41 # Server is not started with keyring plugin and run innodb_redo_log_encrypt=ON
42 # Expected Result : Variable is ignored.
43 # bug : expect warning or error
44 SET GLOBAL innodb_redo_log_encrypt = ON;
45
46 SHOW WARNINGS;
47 --let $wait_condition=SELECT @@global.innodb_redo_log_encrypt = 0
48 --source include/wait_condition.inc
49
50 CREATE TABLE tde_db.t4 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB;
51 INSERT INTO t4 (a, b) VALUES (1, REPEAT('a', 6*512*512));
52 SELECT a,LEFT(b,10) FROM tde_db.t4;
53 # Restart server
54 --source include/restart_mysqld.inc
55 SELECT a,LEFT(b,10) FROM tde_db.t4;
56 DROP TABLE tde_db.t4;
57
58
59 --disable_warnings
60 DROP TABLE test.t1;
61 DROP DATABASE tde_db;
62 --enable_warnings