Debian Codegraph @

mysql-test/suite/encryption/t/innodb-checksum-algorithm.test

raw
1 -- source include/innodb_checksum_algorithm.inc
2 -- source include/innodb_page_size.inc
3 -- source include/have_file_key_management_plugin.inc
4
5 SET @saved_encrypt_tables = @@global.innodb_encrypt_tables;
6 SET @saved_encryption_threads = @@global.innodb_encryption_threads;
7 SET @saved_encryption_key_id = @@global.innodb_default_encryption_key_id;
8
9 SET GLOBAL innodb_encrypt_tables = ON;
10 SET GLOBAL innodb_encryption_threads = 4;
11
12 SET GLOBAL innodb_default_encryption_key_id=4;
13
14 let MYSQLD_DATADIR =`SELECT @@datadir`;
15
16 # ROW_FORMAT=COMPRESSED is unavailable with innodb_page_size=32k or 64k
17 let $row_format_compressed= `select case when @@global.innodb_page_size>16384
18 then 'ROW_FORMAT=DYNAMIC' else 'ROW_FORMAT=COMPRESSED' end`;
19
20 eval create table tce(a serial, b blob, index(b(10))) engine=innodb
21 $row_format_compressed encrypted=yes;
22 eval create table tc(a serial, b blob, index(b(10))) engine=innodb
23 $row_format_compressed encrypted=no;
24 eval create table te(a serial, b blob, index(b(10))) engine=innodb
25 encrypted=yes;
26 eval create table t(a serial, b blob, index(b(10))) engine=innodb
27 encrypted=no;
28 eval create table tpe(a serial, b blob, index(b(10))) engine=innodb
29 page_compressed=yes encrypted=yes;
30 eval create table tp(a serial, b blob, index(b(10))) engine=innodb
31 page_compressed=yes encrypted=no;
32
33 begin;
34 eval insert into tce(b) values (repeat('secret',20));
35 eval insert into tc(b) values (repeat('secret',20));
36 eval insert into te(b) values (repeat('secret',20));
37 eval insert into t(b) values (repeat('secret',20));
38 eval insert into tpe(b) values (repeat('secret',20));
39 eval insert into tp(b) values (repeat('secret',20));
40 commit;
41
42 eval FLUSH TABLES tce, tc, te, t, tpe, tp FOR EXPORT;
43 perl;
44 do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
45 ib_backup_tablespaces("test", ("tce", "tc", "te", "t", "tpe", "tp"));
46 EOF
47 --list_files $MYSQLD_DATADIR/test
48 UNLOCK TABLES;
49
50 ALTER TABLE tce DISCARD TABLESPACE;
51 ALTER TABLE tc DISCARD TABLESPACE;
52 ALTER TABLE te DISCARD TABLESPACE;
53 ALTER TABLE t DISCARD TABLESPACE;
54 ALTER TABLE tpe DISCARD TABLESPACE;
55 ALTER TABLE tp DISCARD TABLESPACE;
56
57 perl;
58 do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
59 ib_restore_tablespaces("test", ("tce", "tc", "te", "t", "tpe", "tp"));
60 EOF
61
62 ALTER TABLE tce IMPORT TABLESPACE;
63 update tce set b=substr(b,1);
64 ALTER TABLE tc IMPORT TABLESPACE;
65 update tc set b=substr(b,1);
66 ALTER TABLE te IMPORT TABLESPACE;
67 update te set b=substr(b,1);
68 ALTER TABLE t IMPORT TABLESPACE;
69 update t set b=substr(b,1);
70 ALTER TABLE tpe IMPORT TABLESPACE;
71 update tpe set b=substr(b,1);
72 ALTER TABLE tp IMPORT TABLESPACE;
73 update tp set b=substr(b,1);
74
75 CHECK TABLE tce, tc, te, t, tpe, tp;
76 DROP TABLE tce, tc, te, t, tpe, tp;
77
78 SET GLOBAL innodb_encrypt_tables = @saved_encrypt_tables;
79 SET GLOBAL innodb_encryption_threads = @saved_encryption_threads;
80 SET GLOBAL innodb_default_encryption_key_id = @saved_encryption_key_id;