Debian Codegraph @

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

raw
1 --echo #
2 --echo # Bug#30787535 : FULLTEXT INDEX TABLES CREATED IN ENCRYPTED SCHEMA ARE NOT ENCRYPTED
3 --echo #
4
5 ################################################################################
6 # For an encrypted table, this test case checks physical ibd file for :
7 # - table
8 # - fts table created for an FTS index on table
9 # - Other aux tables created for FTS index
10 # to see if they are encrypted.
11 ################################################################################
12 --source include/have_debug.inc
13 # Disable in valgrind because of timeout, cf. Bug#22760145
14 --source include/not_valgrind.inc
15 # Waiting time when (re)starting the server
16 --let $explicit_default_wait_counter=10000
17
18 --echo #########
19 --echo # SETUP #
20 --echo #########
21 --echo
22 let datadir=`SELECT @@datadir`;
23 let search_pattern=supremum;
24
25 --echo #########################################################################
26 --echo # RESTART 1 : WITH KEYRING PLUGIN
27 --echo #########################################################################
28 let $restart_parameters = restart: --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT;
29 --source include/restart_mysqld_no_echo.inc
30
31 --echo # Create a new 'unencrypted' table
32 CREATE TABLE t1 (id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
33 C1 TEXT(500),
34 C2 VARCHAR(200),
35 C3 VARCHAR(200)) ENCRYPTION='N' ENGINE=InnoDB;
36
37 # Make sure all pages are flushed
38 set global innodb_buf_flush_list_now = 1;
39
40 --echo # ---------------------------------------------------------------
41 --echo # Test 1 : t1 un-encrypted, FTS tables should also be unencrypted
42 --echo # ---------------------------------------------------------------
43 --echo # Check that tablespace file is not encrypted
44 --let ts_name=test/t1.ibd
45 --source include/if_encrypted.inc
46
47 CREATE FULLTEXT INDEX idx ON t1(C1);
48
49 # Make sure all pages are flushed
50 set global innodb_buf_flush_list_now = 1;
51
52 --let ts_name = `select NAME from information_schema.innodb_tables where name like "%index_1%";`
53 --let ts_name = $ts_name.ibd
54 --echo # Check that FTS tablespaces file is not encrypted
55 --source include/if_encrypted.inc
56
57 --echo # ---------------------------------------------------------------
58 --echo # Test 1 : t1 encrypted, FTS tables should also be unencrypted
59 --echo # ---------------------------------------------------------------
60 # Now, change the encryption property of table
61 ALTER TABLE t1 ENCRYPTION='Y';
62
63 --echo # Check that tablespace file is encrypted now
64 --let ts_name=test/t1.ibd
65 --source include/if_encrypted.inc
66
67 --let ts_name = `select NAME from information_schema.innodb_tables where name like "%index_1%";`
68 --let ts_name = $ts_name.ibd
69 --echo # Check that FTS tablespace file is encrypted now
70 --source include/if_encrypted.inc
71
72 --echo ###########
73 --echo # CLEANUP #
74 --echo ###########
75 DROP TABLE test.t1;
76 remove_file $MYSQLTEST_VARDIR/tmpfile.txt;
77 remove_file $MYSQL_TMP_DIR/mysecret_keyring;
78
79 --echo # Restarting server without keyring to restore server state
80 let $restart_parameters = restart: ;
81 --source include/restart_mysqld.inc