File: tablespace_with_tables.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (78 lines) | stat: -rw-r--r-- 2,371 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Parameter to set before including this file.

# $privilege_check = true/false
# $global_database_encryption_default = true/false
# $tablespace_encryption = 'n' or 'y'
# $tablespace_encryption_to = 'n' or 'y'
# $database_encryption = 'n' or 'y'
# $table_encryption_clause = 'n' or 'y'
# $alter_tablespace_error = ER_*

--let caseno=`SELECT $caseno+1`
--echo # [ALTER TABLESPACE] Case $caseno )
--echo `````````````````````````````````````````````````````````

if ($has_grant == 'true')
{
connection default;
--echo # Grant user with TABLE_ENCRYPTION_ADMIN
GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost;
connection con1;
}

--echo # Create required schema to run ALTER TABLESPACE.
eval CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION=$tablespace_encryption;
eval CREATE DATABASE db1 DEFAULT ENCRYPTION=$database_encryption;
if ($table1_encryption_clause == 'no')
{
eval CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1;
}
if ($table1_encryption_clause != 'no')
{
eval CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION=$tablespace_encryption;
}
if ($table2_encryption_clause == 'no')
{
eval CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1;
}
if ($table2_encryption_clause != 'no')
{
eval CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION=$tablespace_encryption;
}
SHOW CREATE TABLE db1.t1;
SHOW CREATE TABLE db1.t2;

# We assume default_table_encryption same desired tablespace encryption
# type, because our motive here is allow alter tablespace to succeed and
# observe what happens to ENCRYPTION clause of tables. The test
# encryption.tablespaces covers such test cases.
if ($tablespace_encryption_to == "'n'")
{
eval SET SESSION default_table_encryption=false;
}
if ($tablespace_encryption_to == "'y'")
{
eval SET SESSION default_table_encryption=true;
}

--echo # Run ALTER TABLESPACE
eval SET GLOBAL table_encryption_privilege_check=$privilege_check;
--error $alter_tablespace_error
eval ALTER TABLESPACE ts1 ENCRYPTION=$tablespace_encryption_to;
SHOW WARNINGS;
SHOW CREATE TABLE db1.t1;
SHOW CREATE TABLE db1.t2;
SET GLOBAL table_encryption_privilege_check=false;
SET SESSION default_table_encryption=false;

--echo # clean up
if ($has_grant == 'true')
{
connection default;
--echo # Revoke TABLE_ENCRYPTION_ADMIN from user
REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost;
connection con1;
}
DROP DATABASE db1;
DROP TABLESPACE ts1;
--echo #