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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
|
--echo #
--echo # WL#12261 Control (enforce and disable) table encryption
--echo #
--source include/have_debug.inc
--echo # Pre-define user u1, which is used in different tests below.
CREATE USER u1@localhost;
GRANT ALL ON db1.* TO u1@localhost;
GRANT ALL ON db2.* TO u1@localhost;
GRANT ALL ON sch1.* TO u1@localhost;
GRANT ALL ON sch2.* TO u1@localhost;
GRANT CREATE TABLESPACE, PROCESS, SYSTEM_VARIABLES_ADMIN ON *.* TO u1@localhost;
SET GLOBAL debug= '+d,skip_table_encryption_admin_check_for_set';
connect (con1, localhost, u1);
--echo # The test cases run ALTER TABLE RENAME to move tables from one database
--echo # to another, with tables using file-per-table or general
--echo # tablespace. And these operations are run in below configuration,
--echo #
--echo # - Setting table_encryption_privilege_check to true/false.
--echo # - Setting per database default encryption to 'y' and 'n'
--echo # - Setting table's encryption mode to 'y' and 'n'.
--echo # - With and without user holding TABLE_ENCRYPTION_ADMIN privilege.
--echo # -
--echo # - Check for warnings generated.
--echo #
--echo `````````````````````````````````````````````````````````
--echo # Test using innodb_file_per_table tablespace.
--let alter_tablespace_name=innodb_file_per_table
--let expected_error1=0
--let expected_error2=0
--let expected_error3=0
--let expected_error4=0
--let caseno=0
--echo `````````````````````````````````````````````````````````
--echo # table_encryption_privilege_check=false
--let privilege_check=false
--let table_encryption='n'
--source ./alter_rename_table.inc
--let table_encryption='y'
--source ./alter_rename_table.inc
--echo `````````````````````````````````````````````````````````
--echo # table_encryption_privilege_check=true
--let privilege_check=true
--echo `````````````````````````````````````````````````````````
--echo # We expect failure when the table encryption does not match
--echo # with default database encryption.
--let table_encryption='n'
--let expected_error2=ER_CANNOT_SET_TABLE_ENCRYPTION
--let expected_error4=ER_CANNOT_SET_TABLE_ENCRYPTION
--source ./alter_rename_table.inc
--let has_grant=true
--let table_encryption='n'
--source ./alter_rename_table.inc
--let has_grant=false
--echo `````````````````````````````````````````````````````````
--echo # We expect failure when the table encryption does not match
--echo # with default database encryption.
--let table_encryption='y'
--let expected_error1=ER_CANNOT_SET_TABLE_ENCRYPTION
--let expected_error3=ER_CANNOT_SET_TABLE_ENCRYPTION
--source ./alter_rename_table.inc
--let has_grant=true
--let table_encryption='y'
--source ./alter_rename_table.inc
--let has_grant=false
--echo `````````````````````````````````````````````````````````
--echo # Test using general tablespace.
--let alter_tablespace_name=ts1
--let expected_error1=0
--let expected_error2=0
--let expected_error3=0
--let expected_error4=0
--echo `````````````````````````````````````````````````````````
--echo # table_encryption_privilege_check=false
--let privilege_check=false
--let table_encryption='n'
--source ./alter_rename_table.inc
--let table_encryption='y'
--source ./alter_rename_table.inc
--echo `````````````````````````````````````````````````````````
--echo # table_encryption_privilege_check=true
--let privilege_check=true
--echo `````````````````````````````````````````````````````````
--echo # We expect failure when the table encryption does not match
--echo # with default database encryption.
--let table_encryption='n'
--let expected_error2=ER_CANNOT_SET_TABLE_ENCRYPTION
--let expected_error4=ER_CANNOT_SET_TABLE_ENCRYPTION
--source ./alter_rename_table.inc
--let has_grant=true
--let table_encryption='n'
--source ./alter_rename_table.inc
--let has_grant=false
--echo `````````````````````````````````````````````````````````
--echo # We expect failure when the table encryption does not match
--echo # with default database encryption.
--let table_encryption='y'
--let expected_error1=ER_CANNOT_SET_TABLE_ENCRYPTION
--let expected_error3=ER_CANNOT_SET_TABLE_ENCRYPTION
--source ./alter_rename_table.inc
--let has_grant=true
--let table_encryption='y'
--source ./alter_rename_table.inc
--let has_grant=false
--let algo=copy
--echo `````````````````````````````````````````````````````````
--echo # table_encryption_privilege_check=false
--let privilege_check=false
--let table_encryption='n'
--source ./alter_rename_table.inc
--let table_encryption='y'
--source ./alter_rename_table.inc
--echo `````````````````````````````````````````````````````````
--echo # table_encryption_privilege_check=true
--let privilege_check=true
--echo `````````````````````````````````````````````````````````
--echo # We expect failure when the table encryption does not match
--echo # with default database encryption.
--let table_encryption='n'
--let expected_error2=ER_CANNOT_SET_TABLE_ENCRYPTION
--let expected_error4=ER_CANNOT_SET_TABLE_ENCRYPTION
--source ./alter_rename_table.inc
--let has_grant=true
--let table_encryption='n'
--source ./alter_rename_table.inc
--let has_grant=false
--echo `````````````````````````````````````````````````````````
--echo # We expect failure when the table encryption does not match
--echo # with default database encryption.
--let table_encryption='y'
--let expected_error1=ER_CANNOT_SET_TABLE_ENCRYPTION
--let expected_error3=ER_CANNOT_SET_TABLE_ENCRYPTION
--source ./alter_rename_table.inc
--let has_grant=true
--let table_encryption='y'
--source ./alter_rename_table.inc
--let has_grant=false
--let algo=inplace
--echo `````````````````````````````````````````````````````````
--echo # table_encryption_privilege_check=false
--let privilege_check=false
--let table_encryption='n'
--source ./alter_rename_table.inc
--let table_encryption='y'
--source ./alter_rename_table.inc
--echo `````````````````````````````````````````````````````````
--echo # table_encryption_privilege_check=true
--let privilege_check=true
--echo `````````````````````````````````````````````````````````
--echo # We expect failure when the table encryption does not match
--echo # with default database encryption.
--let table_encryption='n'
--let expected_error2=ER_CANNOT_SET_TABLE_ENCRYPTION
--let expected_error4=ER_CANNOT_SET_TABLE_ENCRYPTION
--source ./alter_rename_table.inc
--let has_grant=true
--let table_encryption='y'
--source ./alter_rename_table.inc
--let has_grant=false
--echo `````````````````````````````````````````````````````````
--echo # We expect failure when the table encryption does not match
--echo # with default database encryption.
--let table_encryption='y'
--let expected_error1=ER_CANNOT_SET_TABLE_ENCRYPTION
--let expected_error3=ER_CANNOT_SET_TABLE_ENCRYPTION
--source ./alter_rename_table.inc
--let has_grant=true
--let table_encryption='y'
--source ./alter_rename_table.inc
--let has_grant=false
--echo # Cleanup
disconnect con1;
connection default;
DROP USER u1@localhost;
SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set';
|