diff --git a/components/keyrings/common/data/data.h b/components/keyrings/common/data/data.h index f9564bbb45fc..b071957921dd 100644 --- a/components/keyrings/common/data/data.h +++ b/components/keyrings/common/data/data.h @@ -23,6 +23,7 @@ #ifndef DATA_INCLUDED #define DATA_INCLUDED +#include <cstdint> #include <functional> #include <string> #include "pfs_string.h" diff --git a/mysql-test/include/have_component_keyring_kmip.inc b/mysql-test/include/have_component_keyring_kmip.inc deleted file mode 100644 index ef965e319365..000000000000 --- a/mysql-test/include/have_component_keyring_kmip.inc +++ /dev/null @@ -1,10 +0,0 @@ -disable_query_log; - -# -# Check if the variable KEYRING_KMIP_COMPONENT is set -# -if (!$KEYRING_KMIP_COMPONENT) { - --skip test requires the environment variable \$KEYRING_FILE_COMPONENT to be set (normally done by mtr), see the file plugin.defs -} - -enable_query_log; diff --git a/mysql-test/include/have_component_keyring_kms.inc b/mysql-test/include/have_component_keyring_kms.inc deleted file mode 100644 index 348195c4902f..000000000000 --- a/mysql-test/include/have_component_keyring_kms.inc +++ /dev/null @@ -1,10 +0,0 @@ -disable_query_log; - -# -# Check if the variable KEYRING_KMS_COMPONENT is set -# -if (!$KEYRING_KMS_COMPONENT) { - --skip test requires the environment variable \$KEYRING_KMS_COMPONENT to be set (normally done by mtr), see the file plugin.defs -} - -enable_query_log; diff --git a/mysql-test/include/have_keyring_kmip_plugin.inc b/mysql-test/include/have_keyring_kmip_plugin.inc deleted file mode 100644 index e697b3dd415d..000000000000 --- a/mysql-test/include/have_keyring_kmip_plugin.inc +++ /dev/null @@ -1,6 +0,0 @@ -# -# Check if the variable KEYRING_KMIP_PLUGIN is set -# -if (!$KEYRING_KMIP_PLUGIN) { - --skip keyring_kmip not available. -} diff --git a/mysql-test/include/keyring_tests/helper/local_keyring_kmip_remove.inc b/mysql-test/include/keyring_tests/helper/local_keyring_kmip_remove.inc deleted file mode 100644 index 2e273ba73262..000000000000 --- a/mysql-test/include/keyring_tests/helper/local_keyring_kmip_remove.inc +++ /dev/null @@ -1,20 +0,0 @@ -# ==== Purpose ==== -# -# Remove keyring file for given keyring component -# -# ==== Usage ==== -# -# --let COMPONENT_NAME = <name_of_keyring_component> -# --let KEYRING_FILE_PATH = <path_of_keyring_file> -# --source include/keyring_tests/local_keyring_file_remove.inc -# -# ==== Parameters ==== -# -# $COMPONENT_NAME -# Name of the keyring component. -# -# $KEYRING_FILE_PATH -# Path to keyring file -# - -# NOP diff --git a/mysql-test/include/keyring_tests/helper/local_keyring_kms_remove.inc b/mysql-test/include/keyring_tests/helper/local_keyring_kms_remove.inc deleted file mode 100644 index c6f91b6a724a..000000000000 --- a/mysql-test/include/keyring_tests/helper/local_keyring_kms_remove.inc +++ /dev/null @@ -1,21 +0,0 @@ -# ==== Purpose ==== -# -# Remove keyring file for given keyring component -# -# ==== Usage ==== -# -# --let COMPONENT_NAME = <name_of_keyring_component> -# --let KEYRING_FILE_PATH = <path_of_keyring_file> -# --source include/keyring_tests/local_keyring_file_remove.inc -# -# ==== Parameters ==== -# -# $COMPONENT_NAME -# Name of the keyring component. -# -# $KEYRING_FILE_PATH -# Path to keyring file -# - ---error 0,1 ---remove_file $KEYRING_KMS_PATH diff --git a/mysql-test/include/keyring_tests/mats/keyring_udf_test.inc b/mysql-test/include/keyring_tests/mats/keyring_udf_test.inc index ac2bd4297908..92b962ac346d 100644 --- a/mysql-test/include/keyring_tests/mats/keyring_udf_test.inc +++ b/mysql-test/include/keyring_tests/mats/keyring_udf_test.inc @@ -23,10 +23,8 @@ --echo # Tests for AES key type --source keyring_udf_aes_test.inc ---if (!$skip_secret_tests) { --echo # Tests for SECRET key type --source keyring_udf_secret_test.inc --- } --echo # ---------------------------------------------------------------------- diff --git a/mysql-test/include/keyring_tests/mats/mysql_ts_alter_encrypt_1.inc b/mysql-test/include/keyring_tests/mats/mysql_ts_alter_encrypt_1.inc index 47e57e5dde48..95037d0b1f87 100644 --- a/mysql-test/include/keyring_tests/mats/mysql_ts_alter_encrypt_1.inc +++ b/mysql-test/include/keyring_tests/mats/mysql_ts_alter_encrypt_1.inc @@ -192,9 +192,9 @@ ALTER TABLESPACE mysql ENCRYPTION='N'; SET debug='+d,skip_dd_table_access_check'; --echo # Wait for Unencryption processing to finish in background thread -let $wait_condition = SELECT ENCRYPTION = 'N' - FROM INFORMATION_SCHEMA.INNODB_TABLESPACES - WHERE NAME='mysql'; +let $wait_condition = select count(*) = 0 + from performance_schema.events_stages_current + where EVENT_NAME='stage/innodb/alter tablespace (encryption)'; --source include/wait_condition.inc # Encrytion property of tablespace should have changed i.e. it should be diff --git a/mysql-test/std_data/kmip_clear.py b/mysql-test/std_data/kmip_clear.py deleted file mode 100644 index e12cd080d7bd..000000000000 --- a/mysql-test/std_data/kmip_clear.py +++ /dev/null @@ -1,34 +0,0 @@ -import ssl -import logging -import os -from kmip.pie.client import ProxyKmipClient, enums -from kmip.core.factories import attributes - -logging.basicConfig(encoding='utf-8', level=logging.DEBUG) - -client = ProxyKmipClient( -# config_file="/home/dutow/workspace/topics/ps7586/8.0/pykmip.conf", - kmip_version=enums.KMIPVersion.KMIP_2_0, - ssl_version="PROTOCOL_SSLv23", - cert=os.environ.get("KMIP_CLIENT_CA"), - key=os.environ.get("KMIP_CLIENT_KEY"), - ca=os.environ.get("KMIP_SERVER_CA"), - config='client', - hostname=os.environ.get("KMIP_ADDR"), - port=os.environ.get("KMIP_PORT") - ) - -f = attributes.AttributeFactory() - -with client: - l = client.locate( - attributes=[ - f.create_attribute( - enums.AttributeType.OBJECT_TYPE, - enums.ObjectType.SYMMETRIC_KEY - ) - ] - ) - for id in l: - client.destroy(id) - diff --git a/mysql-test/suite/component_keyring_kmip/inc/setup_component.inc b/mysql-test/suite/component_keyring_kmip/inc/setup_component.inc deleted file mode 100644 index 89fd62fc9c34..000000000000 --- a/mysql-test/suite/component_keyring_kmip/inc/setup_component.inc +++ /dev/null @@ -1,35 +0,0 @@ -# Setup test to use keyring component - -# Used environment variables: -# KMIP_PORT -# KMIP_ADDR -# KMIP_CLIENT_CA -# KMIP_CLIENT_KEY -# KMIP_SERVER_CA - ---echo # ---------------------------------------------------------------------- ---echo # Setup - ---let PLUGIN_DIR_OPT = $KEYRING_KMIP_COMPONENT_OPT - -# Data directory location ---let CURRENT_DATADIR = `SELECT @@datadir` - ---let COMPONENT_LIBRARY = `SELECT SUBSTRING_INDEX('$KEYRING_KMIP_COMPONENT_LOAD', '=', -1)` ---let COMPONENT_DIR = $KEYRING_KMIP_COMPONENT_DIR ---let COMPONENT_NAME = `SELECT SUBSTRING_INDEX('$COMPONENT_LIBRARY', '.', 1)` ---source include/keyring_tests/helper/global_keyring_create_config.inc - -# Create local keyring config ---let KEYRING_KMIP_PATH = `SELECT CONCAT( '$MYSQLTEST_VARDIR', '/keyring_kmip')` ---let KEYRING_CONFIG_CONTENT = `SELECT CONCAT('{ \"path\": \"', '$KEYRING_KMIP_PATH', '\", \"server_addr\": \"', '$KMIP_ADDR', '\", \"server_port\": \"', '$KMIP_PORT', '\", \"client_ca\": \"', '$KMIP_CLIENT_CA', '\", \"client_key\": \"', '$KMIP_CLIENT_KEY', '\", \"server_ca\": \"', '$KMIP_SERVER_CA', '\" }')` ---source include/keyring_tests/helper/local_keyring_create_config.inc - -# Create local manifest file for current server instance ---let LOCAL_MANIFEST_CONTENT = `SELECT CONCAT('{ \"components\": \"file://', '$COMPONENT_NAME', '\" }')` ---source include/keyring_tests/helper/instance_create_manifest.inc - -# Restart server with manifest file ---source include/keyring_tests/helper/start_server_with_manifest.inc ---echo # ---------------------------------------------------------------------- - diff --git a/mysql-test/suite/component_keyring_kmip/inc/setup_component_customized.inc b/mysql-test/suite/component_keyring_kmip/inc/setup_component_customized.inc deleted file mode 100644 index 1c0cd939ef95..000000000000 --- a/mysql-test/suite/component_keyring_kmip/inc/setup_component_customized.inc +++ /dev/null @@ -1,23 +0,0 @@ -# Setup test to use keyring component - ---echo # ---------------------------------------------------------------------- ---echo # Setup - ---let PLUGIN_DIR_OPT = $KEYRING_KMIP_COMPONENT_OPT - ---let COMPONENT_LIBRARY = `SELECT SUBSTRING_INDEX('$KEYRING_KMIP_COMPONENT_LOAD', '=', -1)` ---let COMPONENT_DIR = $KEYRING_KMIP_COMPONENT_DIR ---let COMPONENT_NAME = `SELECT SUBSTRING_INDEX('$COMPONENT_LIBRARY', '.', 1)` ---let GLOBAL_MANIFEST_CONTENT = `SELECT CONCAT('{ \"components\": \"file://', '$COMPONENT_NAME', '\" }')` -# Create manifest file for mysqld binary ---source include/keyring_tests/helper/binary_create_customized_manifest.inc - -# Create global keyring config ---let KEYRING_KMIP_PATH = `SELECT CONCAT( '$MYSQLTEST_VARDIR', '/keyring_kmip')` ---let KEYRING_CONFIG_CONTENT = `SELECT CONCAT('{ \"path\": \"', '$KEYRING_KMIP_PATH','\", \"server_addr\": \"127.0.0.1\", \"server_port\": \"5696\", \"client_ca\": \"/home/dutow/.local/etc/pykmip/client_certificate_jane_doe.pem\", \"client_key\":\"/home/dutow/.local/etc/pykmip/client_key_jane_doe.pem\", \"server_ca\":\"/home/dutow/.local/etc/pykmip/root_certificate.pem\" }')` ---source include/keyring_tests/helper/global_keyring_create_customized_config.inc - -# Restart server with manifest file ---source include/keyring_tests/helper/start_server_with_manifest.inc ---echo # ---------------------------------------------------------------------- - diff --git a/mysql-test/suite/component_keyring_kmip/inc/teardown_component.inc b/mysql-test/suite/component_keyring_kmip/inc/teardown_component.inc deleted file mode 100644 index 05fec915d4f3..000000000000 --- a/mysql-test/suite/component_keyring_kmip/inc/teardown_component.inc +++ /dev/null @@ -1,21 +0,0 @@ -# Teardown - ---echo # ---------------------------------------------------------------------- ---echo # Teardown -# Remove local manifest file for current server instance ---source include/keyring_tests/helper/instance_remove_manifest.inc - -# Remove keyring kmip ---source include/keyring_tests/helper/local_keyring_kmip_remove.inc - -# Remove local keyring config ---source include/keyring_tests/helper/local_keyring_remove_config.inc - -# Remove global keyring config ---source include/keyring_tests/helper/global_keyring_remove_config.inc - -# Restart server without manifest file ---source include/keyring_tests/helper/cleanup_server_with_manifest.inc ---echo # ---------------------------------------------------------------------- - ---exec python std_data/kmip_clear.py diff --git a/mysql-test/suite/component_keyring_kmip/inc/teardown_component_customized.inc b/mysql-test/suite/component_keyring_kmip/inc/teardown_component_customized.inc deleted file mode 100644 index e91ff69d5d90..000000000000 --- a/mysql-test/suite/component_keyring_kmip/inc/teardown_component_customized.inc +++ /dev/null @@ -1,15 +0,0 @@ -# Teardown - ---echo # ---------------------------------------------------------------------- ---echo # Teardown ---source include/keyring_tests/helper/local_keyring_kmip_remove.inc - -# Drop global keyring config ---source include/keyring_tests/helper/global_keyring_remove_config.inc - -# Remove manifest file for mysqld binary ---source include/keyring_tests/helper/binary_remove_manifest.inc - -# Restart server without manifest file ---source include/keyring_tests/helper/cleanup_server_with_manifest.inc ---echo # ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/alter_rename_table.result b/mysql-test/suite/component_keyring_kmip/t/alter_rename_table.result deleted file mode 100644 index 4712e51ac2db..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/alter_rename_table.result +++ /dev/null @@ -1,1779 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# 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'; -# The test cases run ALTER TABLE RENAME to move tables from one database -# to another, with tables using file-per-table or general -# tablespace. And these operations are run in below configuration, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting per database default encryption to 'y' and 'n' -# - Setting table's encryption mode to 'y' and 'n'. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - -# - Check for warnings generated. -# -````````````````````````````````````````````````````````` -# Test using innodb_file_per_table tablespace. -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=false -# [ALTER TABLE ... RENAME ...] Case 1 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# 1.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 1.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 1.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -# [ALTER TABLE ... RENAME ...] Case 2 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# 2.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 2.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 2.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 3 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# 3.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 3.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 3.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt2 -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -# [ALTER TABLE ... RENAME ...] Case 4 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 4.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 4.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 4.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 5 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# 5.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 5.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 5.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt2 -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -# [ALTER TABLE ... RENAME ...] Case 6 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 6.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 6.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 6.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -````````````````````````````````````````````````````````` -# Test using general tablespace. -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=false -# [ALTER TABLE ... RENAME ...] Case 7 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# 7.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 7.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 7.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 8 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# 8.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 8.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 8.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 9 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# 9.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 9.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 9.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt2 -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 10 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 10.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 10.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 10.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 11 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# 11.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 11.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 11.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt2 -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 12 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 12.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 12.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 12.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=false -# [ALTER TABLE ... RENAME ...] Case 13 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# 13.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30); -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 13.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30); -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 13.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 14 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# 14.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30); -# 14.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30); -# 14.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 15 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# 15.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 15.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 15.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt2 -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 16 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 16.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30); -# 16.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30); -# 16.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 17 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# 17.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30); -# 17.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30); -# 17.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt2 -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 18 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 18.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30); -# 18.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30); -# 18.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=false -# [ALTER TABLE ... RENAME ...] Case 19 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# 19.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30); -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 19.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30); -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 19.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 20 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# 20.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30); -# 20.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30); -# 20.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 21 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# 21.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 21.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 21.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt2 -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 22 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 22.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30); -# 22.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30); -# 22.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 23 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# 23.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30); -# 23.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30); -# 23.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt2 -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 24 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 24.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30); -# 24.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30); -# 24.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# Cleanup -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/alter_rename_table.test b/mysql-test/suite/component_keyring_kmip/t/alter_rename_table.test deleted file mode 100644 index 8cda1d095424..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/alter_rename_table.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/encryption/alter_rename_table_tests.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/alter_table.result b/mysql-test/suite/component_keyring_kmip/t/alter_table.result deleted file mode 100644 index 722e20a49f31..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/alter_table.result +++ /dev/null @@ -1,2862 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# Pre-define user u1, which is used in different tests below. -CREATE USER u1@localhost; -GRANT ALL ON db1.* 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'; -# This test run ALTER TABLE in different configurations, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting default_table_encryption to true/false. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - Test SHOW CREATE TABLE -# - Test INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS -# - Check for warnings generated. -# -# See comments in alter_table.inc for more details. -````````````````````````````````````````````````````````` -# Test using user tablespace 'ts1' -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=OFF and default per-db encryption OFF -# [ALTER TABLE] Case 1 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 2 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# Moving encrypted tablespace to unencrypted tablespace is rejected. -# [ALTER TABLE] Case 3 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 ENCRYPTION='y' -t3 -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 4 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=OFF and default per-db encryption ON -# [ALTER TABLE] Case 5 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 6 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# Moving encrypted tablespace to unencrypted tablespace is rejected. -# [ALTER TABLE] Case 7 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='y' -t3 ENCRYPTION='n' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 8 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=ON and default per-db encryption OFF -# [ALTER TABLE] Case 9 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# Request to create encrypted table to unencrypted database is rejected. -# [ALTER TABLE] Case 10 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 11 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -# Grant TABLE_ENCRYPTION_ADMIN if requested. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# Moving encrypted tablespace to unencrypted tablespace is rejected. -# [ALTER TABLE] Case 12 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 ENCRYPTION='y' -t3 -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 13 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=ON and default per-db encryption ON -# [ALTER TABLE] Case 14 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 15 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 16 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# Moving encrypted tablespace to unencrypted tablespace is rejected. -# [ALTER TABLE] Case 17 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -# Grant TABLE_ENCRYPTION_ADMIN if requested. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='y' -t3 ENCRYPTION='n' -t4 ENCRYPTION='y' -# Cleanup -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 18 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# Using 'innodb_system' tablespace -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=OFF and default per-db encryption OFF -# [ALTER TABLE] Case 19 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 20 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 -t3 ENCRYPTION='y' -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 21 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 ENCRYPTION='y' -t3 -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 22 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=OFF and default per-db encryption ON -# [ALTER TABLE] Case 23 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 24 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='n' -t3 ENCRYPTION='y' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 25 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='y' -t3 ENCRYPTION='n' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 26 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=ON and default per-db encryption OFF -# [ALTER TABLE] Case 27 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Request to create encrypted table to unencrypted database is rejected. -# [ALTER TABLE] Case 28 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 29 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -# Grant TABLE_ENCRYPTION_ADMIN if requested. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 -t3 ENCRYPTION='y' -t4 -# Cleanup -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 30 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 ENCRYPTION='y' -t3 -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 31 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=ON and default per-db encryption ON -# [ALTER TABLE] Case 32 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 33 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='n' -t3 ENCRYPTION='y' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Request to create unencrypted table under database with default -# encryption=ON is rejected. -# [ALTER TABLE] Case 34 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 35 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -# Grant TABLE_ENCRYPTION_ADMIN if requested. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='y' -t3 ENCRYPTION='n' -t4 ENCRYPTION='y' -# Cleanup -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 36 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Test using 'innodb_file_per_table' -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=OFF and default per-db encryption OFF -# [ALTER TABLE] Case 37 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 38 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 39 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 40 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=OFF and default per-db encryption ON -# [ALTER TABLE] Case 41 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 42 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 43 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 44 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=ON and default per-db encryption OFF -# [ALTER TABLE] Case 45 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Request to create encrypted table to database with default -# encryption=OFF is rejected. -# [ALTER TABLE] Case 46 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 47 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -# Grant TABLE_ENCRYPTION_ADMIN if requested. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 48 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 49 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=ON and default per-db encryption ON -# [ALTER TABLE] Case 50 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 51 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Request to create unencrypted table to database with default -# encryption=ON is rejected. -# [ALTER TABLE] Case 52 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 53 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -# Grant TABLE_ENCRYPTION_ADMIN if requested. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 54 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# Cleanup -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/alter_table.test b/mysql-test/suite/component_keyring_kmip/t/alter_table.test deleted file mode 100644 index ddca5bb33459..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/alter_table.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/encryption/alter_table_tests.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/clone_local_encrypt-master.opt b/mysql-test/suite/component_keyring_kmip/t/clone_local_encrypt-master.opt deleted file mode 100644 index 3d385b83ea9f..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/clone_local_encrypt-master.opt +++ /dev/null @@ -1,3 +0,0 @@ -$CLONE_PLUGIN_OPT -$EXAMPLE_PLUGIN_OPT ---log_error_verbosity=3 diff --git a/mysql-test/suite/component_keyring_kmip/t/clone_local_encrypt.result b/mysql-test/suite/component_keyring_kmip/t/clone_local_encrypt.result deleted file mode 100644 index 9b6265854c90..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/clone_local_encrypt.result +++ /dev/null @@ -1,481 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kmip -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Prepare for creating Encrypted Table -# create bootstrap file -# Create and start mysqld with keyring plugin. -## Install plugin -INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN'; -CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB); -CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) -PARTITION BY KEY(col1) PARTITIONS 5; -CREATE PROCEDURE execute_dml( -p_dml_type INT, -p_key_min INT, -p_key_range INT, -p_loop_count INT, -p_frequency INT, -p_is_rand INT) -BEGIN -DECLARE v_idx INT DEFAULT 0; -DECLARE v_commit INT DEFAULT 0; -DECLARE v_key INT DEFAULT 0; -/* Loop and INSERT data at random position */ -WHILE(v_idx < p_loop_count) DO -/* Generate key between 1 to p_loop_count */ -IF p_is_rand = 1 THEN -SET v_key = p_key_min + FLOOR(RAND() * p_key_range); -ELSE -SET v_key = p_key_min + (v_idx % p_key_range); -END IF; -CASE p_dml_type -WHEN 0 THEN -SET @clol3_text = CONCAT('Clone Test Row - ', v_key); -INSERT INTO t1 VALUES(v_key, v_key * 10, -@clol3_text, REPEAT('Large Column Data ', 2048)) -ON DUPLICATE KEY UPDATE col2 = col2 + 1; -INSERT INTO t2 VALUES(v_key, v_key * 10, -@clol3_text, REPEAT('Large Column Data ', 2048)) -ON DUPLICATE KEY UPDATE col2 = col2 + 1; -WHEN 1 THEN -UPDATE t1 SET col2 = v_idx + 1 WHERE col1 = v_key; -UPDATE t2 SET col2 = v_idx + 1 WHERE col1 = v_key; -WHEN 2 THEN -DELETE FROM t1 WHERE col1 = v_key; -DELETE FROM t2 WHERE col1 = v_key; -ELSE -DELETE FROM t1; -DELETE FROM t2; -END CASE; -SET v_idx = v_idx + 1; -/* Commit or rollback work at specified frequency. */ -IF v_idx % p_frequency = 0 THEN -SET v_commit = FLOOR(RAND() * 2); -IF v_commit = 0 AND p_is_rand = 1 THEN -ROLLBACK; -START TRANSACTION; -ELSE -COMMIT; -START TRANSACTION; -END IF; -END IF; -END WHILE; -END| -# In connection default - starting clone -SET DEBUG_SYNC = 'clone_file_copy SIGNAL set_encryption WAIT_FOR resume_clone'; -SET GLOBAL clone_autotune_concurrency = OFF; -SET GLOBAL clone_max_concurrency = 8; -CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR'; -# In connection con1 - Set redo and undo encryption -SET DEBUG_SYNC = 'now WAIT_FOR set_encryption'; -SHOW VARIABLES LIKE 'innodb_redo_log_encrypt'; -Variable_name Value -innodb_redo_log_encrypt OFF -SET GLOBAL innodb_redo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_redo_log_encrypt'; -Variable_name Value -innodb_redo_log_encrypt ON -SHOW VARIABLES LIKE 'innodb_undo_log_encrypt'; -Variable_name Value -innodb_undo_log_encrypt OFF -SET GLOBAL innodb_undo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_undo_log_encrypt'; -Variable_name Value -innodb_undo_log_encrypt ON -SET DEBUG_SYNC = 'now SIGNAL resume_clone'; -# In connection default - finishing Clone -SET GLOBAL innodb_redo_log_encrypt = OFF; -SET GLOBAL innodb_undo_log_encrypt = OFF; -DROP TABLE t1; -DROP TABLE t2; -CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) -ROW_FORMAT = COMPRESSED ENCRYPTION = "Y"; -CREATE TABLESPACE tbs1 ADD DATAFILE 'tbs1_data1.ibd' ENCRYPTION="Y"; -CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) -ENCRYPTION="Y" TABLESPACE = tbs1; -SET GLOBAL innodb_redo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_redo_log_encrypt'; -Variable_name Value -innodb_redo_log_encrypt ON -SET GLOBAL innodb_undo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_undo_log_encrypt'; -Variable_name Value -innodb_undo_log_encrypt ON -call execute_dml(0, 0, 200, 200, 100, 0); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SELECT count(*) from t1; -count(*) -200 -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -SELECT count(*) from t2; -count(*) -200 -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SET GLOBAL innodb_buf_flush_list_now = 1; -SET GLOBAL clone_autotune_concurrency = OFF; -SET GLOBAL clone_max_concurrency = 8; -CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR'; -select ID, STATE, ERROR_NO from performance_schema.clone_status; -ID STATE ERROR_NO -1 Completed 0 -select ID, STAGE, STATE from performance_schema.clone_progress; -ID STAGE STATE -1 DROP DATA Completed -1 FILE COPY Completed -1 PAGE COPY Completed -1 REDO COPY Completed -1 FILE SYNC Completed -1 RESTART Not Started -1 RECOVERY Not Started -# Restart cloned database -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SELECT count(*) from t1; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -SELECT count(*) from t2; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -call execute_dml(3, 0, 1, 1, 1, 0); -call execute_dml(0, 0, 200, 200, 100, 0); -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SET GLOBAL innodb_redo_log_encrypt = ON; -SET GLOBAL innodb_undo_log_encrypt = ON; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -# In connection default - Cloning database -SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1'; -SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2'; -SET GLOBAL clone_autotune_concurrency = OFF; -SET GLOBAL clone_max_concurrency = 8; -CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR'; -# In connection con1 - Running Update Random [0 - 200 Key Range] -SET DEBUG_SYNC = 'now WAIT_FOR start_dml1'; -START TRANSACTION; -CALL execute_dml(1, 0, 200, 500, 100, 1); -COMMIT; -# Flush all dirty buffers -SET GLOBAL innodb_buf_flush_list_now = 1; -SET DEBUG_SYNC = 'now SIGNAL resume_clone1'; -SET DEBUG_SYNC = 'now WAIT_FOR start_dml2'; -START TRANSACTION; -CALL execute_dml(1, 0, 200, 500, 100, 1); -COMMIT; -SET DEBUG_SYNC = 'now SIGNAL resume_clone2'; -# In connection default - Cloning database -# Restart cloned database -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SELECT count(*) from t1; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -SELECT count(*) from t2; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -call execute_dml(3, 0, 1, 1, 1, 0); -call execute_dml(0, 0, 200, 200, 100, 0); -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -DROP TABLE t1; -DROP TABLE t2; -DROP PROCEDURE execute_dml; -DROP TABLESPACE tbs1; -UNINSTALL PLUGIN clone; -SET DEBUG_SYNC = 'RESET'; -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kmip -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/clone_local_encrypt.test b/mysql-test/suite/component_keyring_kmip/t/clone_local_encrypt.test deleted file mode 100644 index 23517b4a2446..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/clone_local_encrypt.test +++ /dev/null @@ -1,13 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/big_test.inc ---source include/not_parallel.inc ---source include/have_innodb_max_16k.inc ---source include/have_debug_sync.inc ---source include/count_sessions.inc - -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/mats/clone_local_encrypt.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt-master.opt b/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt-master.opt deleted file mode 100644 index 3d385b83ea9f..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt-master.opt +++ /dev/null @@ -1,3 +0,0 @@ -$CLONE_PLUGIN_OPT -$EXAMPLE_PLUGIN_OPT ---log_error_verbosity=3 diff --git a/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt.result b/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt.result deleted file mode 100644 index 919813c9fa0a..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt.result +++ /dev/null @@ -1,484 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kmip -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Prepare for creating Encrypted Table -# create bootstrap file -# Create and start mysqld with keyring plugin. -## Install plugin -INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN'; -CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB); -CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) -PARTITION BY KEY(col1) PARTITIONS 5; -CREATE PROCEDURE execute_dml( -p_dml_type INT, -p_key_min INT, -p_key_range INT, -p_loop_count INT, -p_frequency INT, -p_is_rand INT) -BEGIN -DECLARE v_idx INT DEFAULT 0; -DECLARE v_commit INT DEFAULT 0; -DECLARE v_key INT DEFAULT 0; -/* Loop and INSERT data at random position */ -WHILE(v_idx < p_loop_count) DO -/* Generate key between 1 to p_loop_count */ -IF p_is_rand = 1 THEN -SET v_key = p_key_min + FLOOR(RAND() * p_key_range); -ELSE -SET v_key = p_key_min + (v_idx % p_key_range); -END IF; -CASE p_dml_type -WHEN 0 THEN -SET @clol3_text = CONCAT('Clone Test Row - ', v_key); -INSERT INTO t1 VALUES(v_key, v_key * 10, -@clol3_text, REPEAT('Large Column Data ', 2048)) -ON DUPLICATE KEY UPDATE col2 = col2 + 1; -INSERT INTO t2 VALUES(v_key, v_key * 10, -@clol3_text, REPEAT('Large Column Data ', 2048)) -ON DUPLICATE KEY UPDATE col2 = col2 + 1; -WHEN 1 THEN -UPDATE t1 SET col2 = v_idx + 1 WHERE col1 = v_key; -UPDATE t2 SET col2 = v_idx + 1 WHERE col1 = v_key; -WHEN 2 THEN -DELETE FROM t1 WHERE col1 = v_key; -DELETE FROM t2 WHERE col1 = v_key; -ELSE -DELETE FROM t1; -DELETE FROM t2; -END CASE; -SET v_idx = v_idx + 1; -/* Commit or rollback work at specified frequency. */ -IF v_idx % p_frequency = 0 THEN -SET v_commit = FLOOR(RAND() * 2); -IF v_commit = 0 AND p_is_rand = 1 THEN -ROLLBACK; -START TRANSACTION; -ELSE -COMMIT; -START TRANSACTION; -END IF; -END IF; -END WHILE; -END| -# In connection default - starting clone -SET DEBUG_SYNC = 'clone_file_copy SIGNAL set_encryption WAIT_FOR resume_clone'; -SET GLOBAL clone_autotune_concurrency = OFF; -SET GLOBAL clone_max_concurrency = 8; -SET GLOBAL clone_valid_donor_list = 'HOST:PORT'; -CLONE INSTANCE FROM USER@HOST:PORT IDENTIFIED BY '' DATA DIRECTORY = 'CLONE_DATADIR'; -# In connection con1 - Set redo and undo encryption -SET DEBUG_SYNC = 'now WAIT_FOR set_encryption'; -SHOW VARIABLES LIKE 'innodb_redo_log_encrypt'; -Variable_name Value -innodb_redo_log_encrypt OFF -SET GLOBAL innodb_redo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_redo_log_encrypt'; -Variable_name Value -innodb_redo_log_encrypt ON -SHOW VARIABLES LIKE 'innodb_undo_log_encrypt'; -Variable_name Value -innodb_undo_log_encrypt OFF -SET GLOBAL innodb_undo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_undo_log_encrypt'; -Variable_name Value -innodb_undo_log_encrypt ON -SET DEBUG_SYNC = 'now SIGNAL resume_clone'; -# In connection default - finishing Clone -SET GLOBAL innodb_redo_log_encrypt = OFF; -SET GLOBAL innodb_undo_log_encrypt = OFF; -DROP TABLE t1; -DROP TABLE t2; -CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) -ROW_FORMAT = COMPRESSED ENCRYPTION = "Y"; -CREATE TABLESPACE tbs1 ADD DATAFILE 'tbs1_data1.ibd' ENCRYPTION="Y"; -CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) -ENCRYPTION="Y" TABLESPACE = tbs1; -SET GLOBAL innodb_redo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_redo_log_encrypt'; -Variable_name Value -innodb_redo_log_encrypt ON -SET GLOBAL innodb_undo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_undo_log_encrypt'; -Variable_name Value -innodb_undo_log_encrypt ON -call execute_dml(0, 0, 200, 200, 100, 0); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SELECT count(*) from t1; -count(*) -200 -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -SELECT count(*) from t2; -count(*) -200 -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SET GLOBAL innodb_buf_flush_list_now = 1; -SET GLOBAL clone_autotune_concurrency = OFF; -SET GLOBAL clone_max_concurrency = 8; -SET GLOBAL clone_valid_donor_list = 'HOST:PORT'; -CLONE INSTANCE FROM USER@HOST:PORT IDENTIFIED BY '' DATA DIRECTORY = 'CLONE_DATADIR'; -select ID, STATE, ERROR_NO from performance_schema.clone_status; -ID STATE ERROR_NO -1 Completed 0 -select ID, STAGE, STATE from performance_schema.clone_progress; -ID STAGE STATE -1 DROP DATA Completed -1 FILE COPY Completed -1 PAGE COPY Completed -1 REDO COPY Completed -1 FILE SYNC Completed -1 RESTART Not Started -1 RECOVERY Not Started -# Restart cloned database -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SELECT count(*) from t1; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -SELECT count(*) from t2; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -call execute_dml(3, 0, 1, 1, 1, 0); -call execute_dml(0, 0, 200, 200, 100, 0); -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SET GLOBAL innodb_redo_log_encrypt = ON; -SET GLOBAL innodb_undo_log_encrypt = ON; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -# In connection default - Cloning database -SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1'; -SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2'; -SET GLOBAL clone_autotune_concurrency = OFF; -SET GLOBAL clone_max_concurrency = 8; -SET GLOBAL clone_valid_donor_list = 'HOST:PORT'; -CLONE INSTANCE FROM USER@HOST:PORT IDENTIFIED BY '' DATA DIRECTORY = 'CLONE_DATADIR'; -# In connection con1 - Running Update Random [0 - 200 Key Range] -SET DEBUG_SYNC = 'now WAIT_FOR start_dml1'; -START TRANSACTION; -CALL execute_dml(1, 0, 200, 500, 100, 1); -COMMIT; -# Flush all dirty buffers -SET GLOBAL innodb_buf_flush_list_now = 1; -SET DEBUG_SYNC = 'now SIGNAL resume_clone1'; -SET DEBUG_SYNC = 'now WAIT_FOR start_dml2'; -START TRANSACTION; -CALL execute_dml(1, 0, 200, 500, 100, 1); -COMMIT; -SET DEBUG_SYNC = 'now SIGNAL resume_clone2'; -# In connection default - Cloning database -# Restart cloned database -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SELECT count(*) from t1; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -SELECT count(*) from t2; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -call execute_dml(3, 0, 1, 1, 1, 0); -call execute_dml(0, 0, 200, 200, 100, 0); -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -DROP TABLE t1; -DROP TABLE t2; -DROP PROCEDURE execute_dml; -DROP TABLESPACE tbs1; -UNINSTALL PLUGIN clone; -SET DEBUG_SYNC = 'RESET'; -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kmip -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt.test b/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt.test deleted file mode 100644 index 3584dc8527ba..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt.test +++ /dev/null @@ -1,11 +0,0 @@ ---source include/have_component_keyring_kmip.inc -# Test remote clone with different table types with debug sync - ---source include/have_innodb_max_16k.inc - ---let $HOST = 127.0.0.1 ---let $PORT =`select @@port` ---let $USER = root ---let remote_clone = 1 - ---source clone_local_encrypt.test diff --git a/mysql-test/suite/component_keyring_kmip/t/create_table.result b/mysql-test/suite/component_keyring_kmip/t/create_table.result deleted file mode 100644 index 74b9f5a59ce8..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/create_table.result +++ /dev/null @@ -1,1024 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# Pre-define user u1, which is used in different tests below. -CREATE USER u1@localhost; -GRANT ALL ON db1.* 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'; -# This test run CREATE TABLE in different configurations, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting default_table_encryption to true/false. -# - With and without ENCRYPTION clause. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - Test SHOW CREATE TABLE -# - Test INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS -# - Check for warnings generated. -# -````````````````````````````````````````````````````````` -# Test CREATE TABLE on DATABASE with ENCRYPTION 'y/n' -# and with different values for system variable -# 'table_encryption_privilege_check' and 'default_table_encryption' -````````````````````````````````````````````````````````` -# CREATE TABLE without ENCRYPTION clause -# [CREATE TABLE] Case 1 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int); -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 2 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int); -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='Y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 3 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int); -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 4 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int); -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='Y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# CREATE TABLE with ENCRYPTION clause -# [CREATE TABLE] Case 5 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 6 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 7 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 8 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 9 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 10 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 11 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 12 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Check with invalid ENCRYPTION value -# [CREATE TABLE] Case 13 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='k'; -ERROR HY000: Invalid encryption option. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# With innodb_file_per_table=off and -# Test CREATE TABLE without ENCRYPTION clause. -SET GLOBAL innodb_file_per_table = OFF; -# [CREATE TABLE] Case 14 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int); -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 15 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int); -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 16 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int); -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 17 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int); -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# With explicit ENCRYPTION clause -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 18 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 19 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 20 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 21 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 22 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 23 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 24 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 25 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# With innodb_file_per_table = ON. -# Test CREATE TABLE with explicit TABLESPACE=innodb_file_per_table -SET GLOBAL innodb_file_per_table = ON; -````````````````````````````````````````````````````````` -# Without ENCRYPTION clause -# [CREATE TABLE] Case 26 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 27 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='Y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 28 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 29 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='Y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# With ENCRYPTION clause -# [CREATE TABLE] Case 30 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 31 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 32 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 33 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 34 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 35 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 36 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 37 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Test CREATE TABLE with TABLESPACE=innodb_system -````````````````````````````````````````````````````````` -# Without ENCRYPTION clause -# [CREATE TABLE] Case 38 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 39 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 40 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 41 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# With ENCRYPTION clause -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 42 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 43 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 44 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 45 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# The statement would fail even with user owning TABLE_ENCRYPTION_ADMIN -# with ER_ILLEGAL_HA_CREATE_OPTION because one cannot create -# encrypted table in system tablespace. -# [CREATE TABLE] Case 46 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 47 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 48 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 49 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='n'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Test CREATE TABLE with general TABLESPACE -````````````````````````````````````````````````````````` -# With unencrypted general tablespace and without ENCRYPTION clause. -# [CREATE TABLE] Case 50 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# The table ENCRYPTION clause is inherited from database and this -# does not match tablespace encryption type. -# [CREATE TABLE] Case 51 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 52 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# The table ENCRYPTION clause is inherited from database and this -# does not match tablespace encryption type. -# [CREATE TABLE] Case 53 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# With ENCRYPTION clause -# [CREATE TABLE] Case 54 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 55 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 56 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 57 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 58 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 59 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 60 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 61 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# Cleanup -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/create_table.test b/mysql-test/suite/component_keyring_kmip/t/create_table.test deleted file mode 100644 index 7e480a8b4af5..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/create_table.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/create_table_tests.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/database.result b/mysql-test/suite/component_keyring_kmip/t/database.result deleted file mode 100644 index 8f45e3534f4f..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/database.result +++ /dev/null @@ -1,1053 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# Pre-define user u1, which is used in different tests below. -CREATE USER u1@localhost; -GRANT ALL ON db1.* 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'; -# This test run CREATE/ALTER DATABASE in different configurations, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting default_table_encryption to true/false. -# - With and without ENCRYPTION clause. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - Test SHOW CREATE DATABASE -# - Test INFORMATION_SCHEMA.SCHEMATA -# - Check for warnings generated. -# -````````````````````````````````````````````````````````` -# CREATE DATABASE without DEFAULT ENCRYPTION clause -# and with different values for system variable -# 'table_encryption_privilege_check' and 'default_table_encryption' -# [CREATE DATABASE] Case 1 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 2 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 3 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 4 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 5 ) -````````````````````````````````````````````````````````` -# Granting TABLE_ENCRYPTION_ADMIN for user. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# Revoke TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 6 ) -````````````````````````````````````````````````````````` -# Granting TABLE_ENCRYPTION_ADMIN for user. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# Revoke TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# CREATE DATABASE with DEFAULT ENCRYPTION clause 'y/n' -# and with different values for system variable -# 'table_encryption_privilege_check' and 'default_table_encryption'. -# [CREATE DATABASE] Case 7 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 8 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 9 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 10 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Without the keyword DEFAULT. -# [CREATE DATABASE] Case 11 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 12 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 13 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 14 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# We expect failure because the encryption request is different from -# global 'default_table_encryption' setting. -# [CREATE DATABASE] Case 15 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -ERROR HY000: Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3827 Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 16 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 17 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# We expect failure because the encryption request is different from -# global 'default_table_encryption' setting. -# [CREATE DATABASE] Case 18 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -ERROR HY000: Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3827 Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 19 ) -````````````````````````````````````````````````````````` -# Granting TABLE_ENCRYPTION_ADMIN for user. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# Revoke TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 20 ) -````````````````````````````````````````````````````````` -# Granting TABLE_ENCRYPTION_ADMIN for user. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# Revoke TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 21 ) -````````````````````````````````````````````````````````` -# Granting TABLE_ENCRYPTION_ADMIN for user. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# Revoke TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 22 ) -````````````````````````````````````````````````````````` -# Granting TABLE_ENCRYPTION_ADMIN for user. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# Revoke TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# With invalid value for DEFAULT ENCRYPTION -# [CREATE DATABASE] Case 23 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='k'; -ERROR HY000: Incorrect argument (should be Y or N) value: 'k' -SHOW WARNINGS; -Level Code Message -Error 1525 Incorrect argument (should be Y or N) value: 'k' -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Check with legacy syntax. -CREATE DATABASE `db1` /*!80016 DEFAULT ENCRYPTION='Y' */; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -DROP DATABASE db1; -````````````````````````````````````````````````````````` -# See that we ignore the clause with invalid mysql version. -CREATE DATABASE `db1` /*!99999 DEFAULT ENCRYPTION='Y' */; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -DROP DATABASE db1; -````````````````````````````````````````````````````````` -# ALTER DATABASE withDEFAULT ENCRYPTION clause 'y/n' -# and with different values for system variable -# 'table_encryption_privilege_check' and 'default_table_encryption' -````````````````````````````````````````````````````````` -# Following cases are with database DEFAULT ENCRYPTION 'y' -# [ALTER DATABASE] Case 1 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 2 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 3 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 4 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 5 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# We expect failure because the encryption request is different from -# global 'default_table_encryption' setting. -# [ALTER DATABASE] Case 6 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -ERROR HY000: Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3827 Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# We expect failure because the encryption request is different from -# global 'default_table_encryption' setting. -# [ALTER DATABASE] Case 7 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -ERROR HY000: Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3827 Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 8 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 9 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 10 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 11 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 12 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Following cases are with database DEFAULT ENCRYPTION 'y' -# [ALTER DATABASE] Case 13 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 14 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 15 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 16 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 17 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# We expect failure because the encryption request is different from -# global 'default_table_encryption' setting. -# [ALTER DATABASE] Case 18 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -ERROR HY000: Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3827 Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# We expect failure because the encryption request is different from -# global 'default_table_encryption' setting. -# [ALTER DATABASE] Case 19 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -ERROR HY000: Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3827 Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 20 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 21 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 22 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 23 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 24 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Invalid encryption option. -# [ALTER DATABASE] Case 25 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='k'; -ERROR HY000: Incorrect argument (should be Y or N) value: 'k' -SHOW WARNINGS; -Level Code Message -Error 1525 Incorrect argument (should be Y or N) value: 'k' -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# Cleanup -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/database.test b/mysql-test/suite/component_keyring_kmip/t/database.test deleted file mode 100644 index 32e7a99e1709..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/database.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/database.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/encrypt_explicit.result b/mysql-test/suite/component_keyring_kmip/t/encrypt_explicit.result deleted file mode 100644 index a6c956d38c8d..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/encrypt_explicit.result +++ /dev/null @@ -1,59 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kmip -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# wl9508: Show that explicit and implicit undo tablespaces can be encrypted. -# -use test; -CREATE table tab1(c1 int); -# create bootstrap file -# Stop the MTR default DB server -# Taking backup of global manifest file for MySQL server -# Run the bootstrap command of datadir1 -# Restore global manifest file for MySQL server from backup -SELECT @@datadir; -@@datadir -MYSQLD_DATADIR1/ -SHOW VARIABLES LIKE 'keyring_file%'; -Variable_name Value -SELECT @@innodb_undo_log_encrypt; -@@innodb_undo_log_encrypt -1 -CREATE UNDO TABLESPACE undo_003 ADD DATAFILE 'undo_003.ibu'; -CREATE DATABASE nath; -use nath; -CREATE TABLE tab2(c1 int , c2 varchar(10)) Engine=InnoDB ENCRYPTION='Y'; -INSERT INTO tab2 VALUES(2, 'VISH'); -CREATE INDEX ix2 ON tab2(c2) ; -CREATE UNDO TABLESPACE undo_004 ADD DATAFILE 'undo_004.ibu'; -ALTER UNDO TABLESPACE undo_003 SET INACTIVE; -ALTER UNDO TABLESPACE undo_004 SET INACTIVE; -DELETE FROM tab2; -DROP UNDO TABLESPACE undo_003; -DROP UNDO TABLESPACE undo_004; -DROP TABLE tab2; -DROP DATABASE nath; -# Stop the encrypt server -SELECT @@datadir; -@@datadir -MYSQLD_OLD_DATADIR -use test; -DROP TABLE tab1; -# -# bug#29006275 : ENCRYPTION MASTER KEY IS GENERATED WITH BLANK UUID -# -# Stop the non-encrypted server -# Run the bootstrap command of datadir1 -# Show that a master key with a blank Server UUID is not used. -SELECT * FROM performance_schema.keyring_keys where KEY_ID='INNODBKey--1'; -KEY_ID KEY_OWNER BACKEND_KEY_ID -# Stop the encrypted server -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kmip -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/encrypt_explicit.test b/mysql-test/suite/component_keyring_kmip/t/encrypt_explicit.test deleted file mode 100644 index 028ec78ea118..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/encrypt_explicit.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/big_test.inc ---source include/not_parallel.inc ---source include/have_innodb_16k.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/innodb/encrypt_explicit.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/engine.result b/mysql-test/suite/component_keyring_kmip/t/engine.result deleted file mode 100644 index f99ee454ccd3..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/engine.result +++ /dev/null @@ -1,176 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# Check for use of ENCRYPTION clause on tables using engines that -# does not support encryption. -# -# 1. Requesting encryption on SE that does not support encryption. -# -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=HEAP ENCRYPTION='y'; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=MyISAM ENCRYPTION='y'; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=MyISAM ENCRYPTION='w'; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -# 2. -# Requesting unencrypted tables on SE that does not support -# encryption. This is allowed. Verify that we do not store -# ENCRYPTION clause. -# -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=HEAP ENCRYPTION='N'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE t1; -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=HEAP ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE t1; -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=MyISAM ENCRYPTION=''; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE t1; -# 3. -# Move tables to and from different storage engine. -# -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=InnoDB ENCRYPTION='y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -# 4. -# Moving encrypted table to SE that doesn't support encryption. -ALTER TABLE t1 ENGINE=MyISAM; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -ALTER TABLE t1 ENGINE=HEAP; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -# 5. -# Moving encrypted table to SE that doesn't support encryption. -# with a explicit request to decrypt the table is allowed. -ALTER TABLE t1 ENGINE=MyISAM ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -ALTER TABLE t1 ENGINE=Heap ENCRYPTION='N'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -ALTER TABLE t1 ENGINE=CSV ENCRYPTION=''; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -# 6. -# Moving unencrypted table from SE that doesn't support encryption -# to SE that does support encryption is allowed. -ALTER TABLE t1 ENGINE=InnoDB ENCRYPTION='y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE t1; -# Same as 4/5/6 using general tablespace: -# -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE t1 (f1 INT NOT NULL) TABLESPACE=ts1 ENCRYPTION='y'; -# 4. -# Moving encrypted table to SE that doesn't support encryption. -ALTER TABLE t1 ENGINE=MyISAM; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -ALTER TABLE t1 ENGINE=HEAP; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -# 5. -# Moving encrypted table to SE that doesn't support encryption. -# with a explicit request to decrypt the table is allowed. -ALTER TABLE t1 ENGINE=MyISAM ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -# 6. -# Moving unencrypted table from SE that doesn't support encryption -# to SE that does support encryption is allowed. -ALTER TABLE t1 ENGINE=InnoDB TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -ALTER TABLE t1 ENCRYPTION='y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE t1; -DROP TABLESPACE ts1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/engine.test b/mysql-test/suite/component_keyring_kmip/t/engine.test deleted file mode 100644 index f7c0f6d23da6..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/engine.test +++ /dev/null @@ -1,4 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source ../inc/setup_component.inc ---source include/keyring_tests/encryption/engine.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/import_compress_encrypt.result b/mysql-test/suite/component_keyring_kmip/t/import_compress_encrypt.result deleted file mode 100644 index b84a9e760798..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/import_compress_encrypt.result +++ /dev/null @@ -1,111 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# Bug#31313533 : IMPORT FAILS FOR ENCRYPT AND COMPRESSION ENABLED TDE TABLES -# -# SETUP -# -# Try to create a table with ZLib compression with strict mode OFF. -# If there is an error about Punch Hole not supported, make InnoDB -# think that Punch Hole is working but actually ignore the calls. -# -CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB"; -DROP TABLE t1; - -# Test 1 : Check that EXPORT and IMPORT is working fine on same FS - -CREATE TABLE t1(c1 int NOT NULL AUTO_INCREMENT, -c2 varchar(65000) DEFAULT NULL, -c3 varchar(255) GENERATED ALWAYS AS (substr(c2,2,100)) STORED, -c4 varchar(255) GENERATED ALWAYS AS (substr(c2,10,200)) VIRTUAL, -b bit(64) DEFAULT NULL, -p_c1 bigint DEFAULT NULL, -PRIMARY KEY (c1)) ENGINE=Innodb AUTO_INCREMENT=50001 DEFAULT CHARSET=latin1 COMPRESSION='zlib' ENCRYPTION='Y'; -SELECT c1, HEX(SUBSTRING(c2, 10, 10)), HEX(SUBSTRING(c3, 10, 10)), -HEX(SUBSTRING(c4, 10, 10)), HEX(b) -FROM t1 ORDER BY c1 limit 10; -c1 HEX(SUBSTRING(c2, 10, 10)) HEX(SUBSTRING(c3, 10, 10)) HEX(SUBSTRING(c4, 10, 10)) HEX(b) -50001 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50002 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50003 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50004 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50005 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50006 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50007 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50008 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50009 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50010 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -# Flush tables for export -FLUSH TABLES t1 FOR EXPORT; -# Copy .cfp .cfg .ibd file to temp -UNLOCK TABLES; -DROP TABLE t1; -CREATE TABLE t1(c1 int NOT NULL AUTO_INCREMENT, -c2 varchar(65000) DEFAULT NULL, -c3 varchar(255) GENERATED ALWAYS AS (substr(c2,2,100)) STORED, -c4 varchar(255) GENERATED ALWAYS AS (substr(c2,10,200)) VIRTUAL, -b bit(64) DEFAULT NULL, -p_c1 bigint DEFAULT NULL, -PRIMARY KEY (c1)) ENGINE=Innodb AUTO_INCREMENT=50001 DEFAULT CHARSET=latin1 COMPRESSION='zlib' ENCRYPTION='Y'; -ALTER TABLE t1 DISCARD TABLESPACE; -# Copy .cfp/.cfg and .ibd files from temp to datadir -# Start import -ALTER TABLE t1 IMPORT TABLESPACE; -SELECT c1, HEX(SUBSTRING(c2, 10, 10)), HEX(SUBSTRING(c3, 10, 10)), -HEX(SUBSTRING(c4, 10, 10)), HEX(b) FROM t1 ORDER BY c1 limit 10; -c1 HEX(SUBSTRING(c2, 10, 10)) HEX(SUBSTRING(c3, 10, 10)) HEX(SUBSTRING(c4, 10, 10)) HEX(b) -50001 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50002 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50003 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50004 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50005 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50006 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50007 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50008 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50009 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50010 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -# Cleanup -DROP TABLE t1; - -# Test 2 : Check that EXPORT and IMPORT is working fine on different FS - -# Copy and unzip the dir having cfg/cfg/ibd file from a different FS Block Size -CREATE TABLE t1(c1 int NOT NULL AUTO_INCREMENT, -c2 varchar(65000) DEFAULT NULL, -c3 varchar(255) GENERATED ALWAYS AS (substr(c2,2,100)) STORED, -c4 varchar(255) GENERATED ALWAYS AS (substr(c2,10,200)) VIRTUAL, -b bit(64) DEFAULT NULL, -p_c1 bigint DEFAULT NULL, -PRIMARY KEY (c1)) ENGINE=Innodb AUTO_INCREMENT=50001 DEFAULT CHARSET=latin1 COMPRESSION='zlib' ENCRYPTION='Y'; -ALTER TABLE t1 DISCARD TABLESPACE; -# Copy .cfp/.cfg and .ibd files from temp to datadir -# Start import -ALTER TABLE t1 IMPORT TABLESPACE; -SELECT c1, HEX(SUBSTRING(c2, 10, 10)), HEX(SUBSTRING(c3, 10, 10)), -HEX(SUBSTRING(c4, 10, 10)), HEX(b) FROM t1 ORDER BY c1 limit 10; -c1 HEX(SUBSTRING(c2, 10, 10)) HEX(SUBSTRING(c3, 10, 10)) HEX(SUBSTRING(c4, 10, 10)) HEX(b) -50001 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50002 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50003 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50004 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50005 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50006 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50007 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50008 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50009 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50010 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -# Cleanup -DROP TABLE t1; -# Remove copied files -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/import_compress_encrypt.test b/mysql-test/suite/component_keyring_kmip/t/import_compress_encrypt.test deleted file mode 100644 index 6f2239956ff8..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/import_compress_encrypt.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_component_keyring_kmip.inc -# InnoDB tablespace import with compression + encryption ---source include/have_lowercase0.inc ---source include/have_innodb_16k.inc ---source include/have_punch_hole.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/import_compress_encrypt.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/keyring_component_status.result b/mysql-test/suite/component_keyring_kmip/t/keyring_component_status.result deleted file mode 100644 index 711a649cedd6..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/keyring_component_status.result +++ /dev/null @@ -1,43 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -CALL mtr.add_suppression("No suitable 'keyring_component_metadata_query' service implementation found to fulfill the request"); -# -# Bug#32390719: QUERYING KEYRING_COMPONENT_STATUS TABLE -# GENERATES AN ERROR IN THE SERVER LOG -# -SELECT * FROM performance_schema.keyring_component_status; -STATUS_KEY STATUS_VALUE -Component_name component_keyring_kmip -Author Percona Corporation -License GPL -Implementation_name component_keyring_kmip -Version 1.0 -Component_status Active -Server_addr 127.0.0.1 -Server_port 5696 -Client_ca /home/dutow/.local/etc/pykmip/client_certificate_jane_doe.pem -Client_key /home/dutow/.local/etc/pykmip/client_key_jane_doe.pem -Server_ca /home/dutow/.local/etc/pykmip/root_certificate.pem -Object_group <NONE> -SELECT PRIO, ERROR_CODE, SUBSYSTEM, DATA FROM performance_schema.error_log WHERE ERROR_CODE='MY-013712'; -PRIO ERROR_CODE SUBSYSTEM DATA -# Restarting server without keyring component -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM performance_schema.keyring_component_status; -STATUS_KEY STATUS_VALUE -SELECT PRIO, ERROR_CODE, SUBSYSTEM, DATA FROM performance_schema.error_log WHERE ERROR_CODE='MY-013712'; -PRIO ERROR_CODE SUBSYSTEM DATA -Warning MY-013712 Server No suitable 'keyring_component_metadata_query' service implementation found to fulfill the request. -# Restore local manifest file for MySQL server instance from backup -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/keyring_component_status.test b/mysql-test/suite/component_keyring_kmip/t/keyring_component_status.test deleted file mode 100644 index a762de00cac2..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/keyring_component_status.test +++ /dev/null @@ -1,5 +0,0 @@ ---source include/have_component_keyring_kmip.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/keyring_component_status.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/load.result b/mysql-test/suite/component_keyring_kmip/t/load.result deleted file mode 100644 index 4ef98c6af438..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/load.result +++ /dev/null @@ -1,14 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/load.test b/mysql-test/suite/component_keyring_kmip/t/load.test deleted file mode 100644 index 85ff823a3dc8..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/load.test +++ /dev/null @@ -1,5 +0,0 @@ ---source include/have_component_keyring_kmip.inc -# Load-Unload test for component_keyring_kmip - ---source ../inc/setup_component.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_1.result b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_1.result deleted file mode 100644 index a533abea6f78..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_1.result +++ /dev/null @@ -1,126 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Kill the server -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -# Kill the server -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -# Kill the server -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -DELETE FROM t1; -START TRANSACTION; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -# Kill the server -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -DROP TABLE t1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_1.test b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_1.test deleted file mode 100644 index 9b003b6e42de..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_1.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc -# WL#9290 InnoDB: Support transparent tablespace data encryption for redo log -# This test case will test basic redo log encryption support features. - ---source include/no_valgrind_without_big.inc ---source include/have_innodb_max_16k.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/log_encrypt_1.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_2.result b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_2.result deleted file mode 100644 index 08628405758e..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_2.result +++ /dev/null @@ -1,164 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Kill the server -SHOW VARIABLES LIKE "%innodb_redo_log_encrypt%"; -Variable_name Value -innodb_redo_log_encrypt ON -DROP TABLE IF EXISTS t1; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -# Kill the server -SHOW VARIABLES LIKE "%innodb_redo_log_encrypt%"; -Variable_name Value -innodb_redo_log_encrypt ON -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER INSTANCE ROTATE INNODB MASTER KEY; -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -# Kill the server -SHOW VARIABLES LIKE "%innodb_redo_log_encrypt%"; -Variable_name Value -innodb_redo_log_encrypt ON -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -DROP TABLE t1; -# Kill the server -SHOW VARIABLES LIKE "%innodb_redo_log_encrypt%"; -Variable_name Value -innodb_redo_log_encrypt ON -SET block_encryption_mode = 'aes-256-cbc'; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -CREATE TABLE tde_db.t1(c1 INT PRIMARY KEY, c2 char(50)) ENCRYPTION = 'Y' ENGINE = InnoDB; -INSERT INTO tde_db.t1 VALUES(0, 'abc'); -INSERT INTO tde_db.t1 VALUES(1, 'xyz'); -INSERT INTO tde_db.t1 VALUES(2, null); -INSERT INTO tde_db.t1 VALUES(3, null); -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -# Mysqldump output - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `tde_db` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; - -USE `tde_db`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `t1` ( - `c1` int NOT NULL, - `c2` char(50) DEFAULT NULL, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y'; -/*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO `t1` VALUES (0,'abc'),(1,'xyz'),(2,NULL),(3,NULL); -# Redirecting mysqlpump output to MYSQL_TMP_DIR/mysqlpump_encrypt.sql -DROP DATABASE tde_db; -Pattern "ALTER INSTANCE ROTATE INNODB MASTER KEY" found -# Loading tables from mysqlpump_encrypt.sql -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -INSERT INTO tde_db.t1 VALUES(4, null); -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -4 NULL -DROP DATABASE tde_db; -# Kill the server -SET GLOBAL innodb_file_per_table=1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_2.test b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_2.test deleted file mode 100644 index 84cbca95637c..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_2.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_component_keyring_kmip.inc -# WL#9290 InnoDB: Support transparent tablespace data encryption for redo log -# This test case will test basic redo log encryption support features. - ---source include/no_valgrind_without_big.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/log_encrypt_2.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_3.result b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_3.result deleted file mode 100644 index 134aac597741..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_3.result +++ /dev/null @@ -1,196 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Kill the server -CREATE DATABASE tde_db; -USE tde_db; -# Kill the server -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -SET GLOBAL innodb_redo_log_encrypt = 1; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t1 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t2 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t2 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -1 aaaaaaaaaa -SET GLOBAL innodb_redo_log_encrypt = 0; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -OFF -CREATE TABLE tde_db.t3 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t3 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t4 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t4 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -1 aaaaaaaaaa -FLUSH LOGS; -# Kill the server -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -1 aaaaaaaaaa -DROP TABLE tde_db.t1,tde_db.t2,tde_db.t3,tde_db.t4; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -CREATE TABLE tde_db.t2 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -START TRANSACTION; -SET GLOBAL innodb_redo_log_encrypt = 1; -INSERT INTO t1 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -INSERT INTO t2 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -1 aaaaaaaaaa -ROLLBACK; -START TRANSACTION; -INSERT INTO t1 (a, b) VALUES (2, REPEAT('a', 6*512*512)); -INSERT INTO t2 (a, b) VALUES (2, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -2 aaaaaaaaaa -COMMIT; -CREATE TABLE tde_db.t3 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -CREATE TABLE tde_db.t4 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -START TRANSACTION; -SET GLOBAL innodb_redo_log_encrypt = 0; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -OFF -INSERT INTO t3 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -INSERT INTO t4 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -1 aaaaaaaaaa -ROLLBACK; -START TRANSACTION; -INSERT INTO t3 (a, b) VALUES (2, REPEAT('a', 6*512*512)); -INSERT INTO t4 (a, b) VALUES (2, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -2 aaaaaaaaaa -COMMIT; -# Kill the server -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -2 aaaaaaaaaa -SET GLOBAL innodb_redo_log_encrypt = 0; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -OFF -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -2 aaaaaaaaaa -SET GLOBAL innodb_redo_log_encrypt = 1; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -2 aaaaaaaaaa -CREATE USER encryptnonprivuser@localhost IDENTIFIED BY 'noauth'; -GRANT SELECT ON *.* to encryptnonprivuser@localhost; -FLUSH PRIVILEGES; -# In connection 1 - with encryptnonprivuser -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -SET GLOBAL innodb_redo_log_encrypt = 0; -ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -SET GLOBAL innodb_undo_log_encrypt = 0; -ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation -SELECT @@global.innodb_undo_log_encrypt ; -@@global.innodb_undo_log_encrypt -0 -SET GLOBAL innodb_redo_log_encrypt = 1; -ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -SET GLOBAL innodb_undo_log_encrypt = 1; -ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation -SELECT @@global.innodb_undo_log_encrypt ; -@@global.innodb_undo_log_encrypt -0 -# In connection default -DROP TABLE tde_db.t1,tde_db.t2,tde_db.t3,tde_db.t4; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_3.test b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_3.test deleted file mode 100644 index a8a5fd7660e0..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_3.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc -# WL#9290 InnoDB: Support transparent tablespace data encryption for redo log -# This test case will test basic redo log encryption support features. - ---source include/no_valgrind_without_big.inc ---source include/have_innodb_max_16k.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/log_encrypt_3.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_5.result b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_5.result deleted file mode 100644 index f5ded3ea3f7c..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_5.result +++ /dev/null @@ -1,84 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kmip -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# create bootstrap file -# Stop the MTR default DB server -# Run the bootstrap command of datadir1 -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -SET GLOBAL innodb_redo_log_encrypt = 1; -SET GLOBAL innodb_undo_log_encrypt = 1; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t1 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t2 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t2 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -1 aaaaaaaaaa -SET GLOBAL innodb_redo_log_encrypt = 0; -SET GLOBAL innodb_undo_log_encrypt = 0; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -OFF -CREATE TABLE tde_db.t3 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t3 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t4 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t4 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -1 aaaaaaaaaa -SET GLOBAL innodb_redo_log_encrypt = 1; -SET GLOBAL innodb_undo_log_encrypt = 1; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t5 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t5 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t5; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t6 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t6 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t6; -a LEFT(b,10) -1 aaaaaaaaaa -START TRANSACTION; -INSERT INTO t5 (a, b) VALUES (2, REPEAT('a', 6*512*512)); -INSERT INTO t6 (a, b) VALUES (2, REPEAT('a', 6*512*512)); -COMMIT; -START TRANSACTION; -INSERT INTO t5 (a, b) VALUES (3, REPEAT('a', 6*512*512)); -INSERT INTO t6 (a, b) VALUES (3, REPEAT('a', 6*512*512)); -ROLLBACK; -SELECT a,LEFT(b,10) FROM tde_db.t5; -a LEFT(b,10) -1 aaaaaaaaaa -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t6; -a LEFT(b,10) -1 aaaaaaaaaa -2 aaaaaaaaaa -DROP TABLE tde_db.t1,tde_db.t2,tde_db.t3,tde_db.t4,tde_db.t5,tde_db.t6; -DROP DATABASE tde_db; -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kmip -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_5.test b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_5.test deleted file mode 100644 index cf9a92a8ecf2..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_5.test +++ /dev/null @@ -1,14 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/big_test.inc ---source include/not_parallel.inc -# InnoDB transparent encryption on redo log. -# This test case will test basic encryption support features. - ---source include/no_valgrind_without_big.inc ---source include/not_windows.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/innodb/log_encrypt_5.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_6.result b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_6.result deleted file mode 100644 index 082a665e239f..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_6.result +++ /dev/null @@ -1,86 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kmip -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# create bootstrap file -# Stop the MTR default DB server -# Run the bootstrap command of datadir1 -# Start the DB server with datadir1 -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -SELECT status_key, status_value FROM -performance_schema.keyring_component_status -WHERE status_key LIKE '%name%' OR status_key LIKE '%status%'; -status_key status_value -Component_name component_keyring_kmip -Implementation_name component_keyring_kmip -Component_status Active -SET GLOBAL innodb_redo_log_encrypt = 1; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t1 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t2 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t2 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t3 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t3 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t4 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t4 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t5 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t5 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t5; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t6 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t6 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t6; -a LEFT(b,10) -1 aaaaaaaaaa -DROP DATABASE tde_db; -# Taking backup of global manifest file for MySQL server -# Try starting without keyring : Error -# Search for error message -Pattern "Redo log was encrypted, but keyring is not loaded" found -Pattern "Aborting" found -# Restart without keyring plugin possible if redo files removed -# Start the DB server with datadir1 -# Try starting without keyring and --innodb_force_recovery=SRV_FORCE_NO_LOG_REDO. -# Start the DB server with datadir1 -SELECT 1; -1 -1 -# Restore global manifest file for MySQL server from backup -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kmip -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_6.test b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_6.test deleted file mode 100644 index 31ad52ea7beb..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_6.test +++ /dev/null @@ -1,15 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/big_test.inc ---source include/not_parallel.inc -# Test tries restart after redo log encryption is enabled -# - Error :restart without keyring -# - Pass :restart without keyring and --innodb_force_recovery=6 -# - Pass :remove redo files,restart without keyring - ---source include/no_valgrind_without_big.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/innodb/log_encrypt_6.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_kill.result b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_kill.result deleted file mode 100644 index caff8f878396..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_kill.result +++ /dev/null @@ -1,251 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kmip -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Taking backup of global manifest file for MySQL server -SELECT @@global.innodb_redo_log_encrypt; -@@global.innodb_redo_log_encrypt -OFF -SET GLOBAL innodb_redo_log_encrypt = 1; -Warnings: -Warning 7013 InnoDB: Redo log cannot be encrypted if the keyring is not loaded. -SET GLOBAL innodb_undo_log_encrypt = 1; -Warnings: -Warning 7014 InnoDB: Undo log can't be encrypted if the keyring is not loaded. -SELECT status_key, status_value FROM -performance_schema.keyring_component_status -WHERE status_key LIKE '%name%' OR status_key LIKE '%status%'; -status_key status_value -CREATE TABLE tne_1(c1 INT, c2 varchar(2000)) ENGINE = InnoDB; -INSERT INTO tne_1 VALUES (1,REPEAT('a',1990)),(2,REPEAT('b',1990)),(100,REPEAT('c',1990)); -SELECT c1,LEFT(c2,10) FROM tne_1; -c1 LEFT(c2,10) -1 aaaaaaaaaa -2 bbbbbbbbbb -100 cccccccccc -DROP TABLE tne_1; -# Stop the MTR default DB server -Pattern "Redo log cannot be encrypted if the keyring is not loaded." found -# create bootstrap file -# Restore global manifest file for MySQL server from backup -# Prepare new datadir -# Run the bootstrap command with keyring -# Starting server with keyring plugin -SELECT @@global.innodb_redo_log_encrypt; -@@global.innodb_redo_log_encrypt -OFF -SET GLOBAL innodb_redo_log_encrypt = 1; -SELECT @@global.innodb_undo_log_encrypt; -@@global.innodb_undo_log_encrypt -0 -SET GLOBAL innodb_undo_log_encrypt = 1; -SELECT @@global.innodb_undo_log_encrypt; -@@global.innodb_undo_log_encrypt -1 -SELECT status_key, status_value FROM -performance_schema.keyring_component_status -WHERE status_key LIKE '%name%' OR status_key LIKE '%status%'; -status_key status_value -Component_name component_keyring_kmip -Implementation_name component_keyring_kmip -Component_status Active -SET GLOBAL innodb_redo_log_encrypt = 0; -SELECT @@global.innodb_redo_log_encrypt; -@@global.innodb_redo_log_encrypt -OFF -SET GLOBAL innodb_undo_log_encrypt = 0; -SELECT @@global.innodb_undo_log_encrypt; -@@global.innodb_undo_log_encrypt -0 -SELECT status_key, status_value FROM -performance_schema.keyring_component_status -WHERE status_key LIKE '%name%' OR status_key LIKE '%status%'; -status_key status_value -Component_name component_keyring_kmip -Implementation_name component_keyring_kmip -Component_status Active -DROP TABLE IF EXISTS t1; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -CREATE TABLE tde_db.t_encrypt(c2 INT NOT NULL PRIMARY KEY, -c3 LONGBLOB -) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE TABLE tde_db.t_non_encrypt(c2 INT NOT NULL PRIMARY KEY, -c3 LONGBLOB -) ENGINE = InnoDB; -CREATE PROCEDURE tde_db.populate_table_set_redo_encrypt(IN table_name VARCHAR(50)) -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 2000) DO -SET @sql_text = CONCAT('INSERT INTO ',table_name, '(c2,c3) VALUES (' , i,',' ,'CONCAT(REPEAT("a",6*512*512)))'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -set i = i + 1; -IF i%10 = 0 THEN SET GLOBAL innodb_redo_log_encrypt = 1; -END IF; -IF i%20 = 0 THEN SET GLOBAL innodb_redo_log_encrypt = 0; -END IF; -IF i%15 = 0 THEN SET GLOBAL innodb_undo_log_encrypt = 1; -END IF; -IF i%30 = 0 THEN SET GLOBAL innodb_undo_log_encrypt = 0; -END IF; -end while; -end| -CREATE PROCEDURE tde_db.update_table(IN table_name VARCHAR(50)) -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 2000) DO -SET @sql_text = CONCAT('UPDATE ',table_name, ' SET c2 = c2 * -1 ORDER BY RAND() LIMIT 2'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.delete_table(IN table_name VARCHAR(50)) -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 2000) DO -SET @sql_text = CONCAT('DELETE FROM ',table_name, ' ORDER BY RAND() LIMIT 2'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.transaction_table(IN table_name VARCHAR(50)) -begin -declare i int default 1; -declare iflag int default -1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -SET i = 3000; -START TRANSACTION; -while (i <= 9000) DO -SET @sql_text = CONCAT('INSERT INTO ',table_name, '(c2,c3) VALUES (' , i,',' ,'CONCAT(REPEAT("a",6*512*512)))'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -SET @sql_text = CONCAT('UPDATE ',table_name, ' SET c2 = c2 * -1 ORDER BY RAND() LIMIT 2'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -set i = i + 1; -IF i%10 = 0 THEN SET GLOBAL innodb_redo_log_encrypt = 1; -END IF; -IF i%20 = 0 THEN SET GLOBAL innodb_redo_log_encrypt = 0; -END IF; -IF i%15 = 0 THEN SET GLOBAL innodb_undo_log_encrypt = 1; -END IF; -IF i%30 = 0 THEN SET GLOBAL innodb_undo_log_encrypt = 0; -END IF; -IF i%10 = 0 THEN -SET @sql_text = CONCAT('DELETE FROM ',table_name, ' ORDER BY RAND() LIMIT 2'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -START TRANSACTION; -SET iflag = -1 * iflag; -END IF; -IF i%9 = 0 THEN -IF iflag < 0 THEN -COMMIT; -ELSE -ROLLBACK; -END IF; -END IF; -end while; -end| -CREATE PROCEDURE tde_db.create_table_rotate_key() -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 2000) DO -IF i%10 = 0 THEN -SET @sql_text = CONCAT('CREATE TABLE ',CONCAT('tde_db.t_non_encrypt_',encrypt,'_',i),' (c1 INT) ' ,' ENGINE=InnoDB'); -ELSE -SET @sql_text = CONCAT('CREATE TABLE ',CONCAT('tde_db.t_encrypt_',encrypt,'_',i),' (c1 INT) ENCRYPTION="Y"' ,' ENGINE=InnoDB'); -END IF; -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.query_table(IN table_name VARCHAR(50)) -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 2000) DO -SET @sql_text = CONCAT('SELECT * FROM ',table_name, ' ORDER BY RAND() LIMIT 2'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -set i = i + 1; -end while; -end| -# In connection con1 - Running insert with redo_log_encrypt variable -call tde_db.populate_table_set_redo_encrypt('tde_db.t_encrypt'); -# In connection con2 - Running insert on non encrypt table -call tde_db.populate_table_set_redo_encrypt('tde_db.t_non_encrypt'); -# Starting server with keyring -SELECT COUNT(*)>0 FROM tde_db.t_encrypt; -COUNT(*)>0 -# -SELECT COUNT(*)>0 FROM tde_db.t_non_encrypt; -COUNT(*)>0 -# -DELETE FROM tde_db.t_encrypt; -DELETE FROM tde_db.t_non_encrypt; -# In connection con1 - Running insert with redo_log_encrypt variable -call tde_db.populate_table_set_redo_encrypt('tde_db.t_encrypt'); -# In connection con2 - Running insert on non encrypt table -call tde_db.populate_table_set_redo_encrypt('tde_db.t_non_encrypt'); -# In connection con3 - Running update on encrypt -call tde_db.table_update('tde_db.t_encrypt'); -# In connection con4 - Running update non encrypt -call tde_db.table_update('tde_db.t_non_encrypt'); -# In connection con5 - Running delete on encrypt -call tde_db.table_delete('tde_db.t_encrypt'); -# In connection con6 - Running delete on non encrypt -call tde_db.table_delete('tde_db.t_non_encrypt'); -# In connection con7 - Running transaction on encrypt -call tde_db.transaction_table('tde_db.t_encrypt'); -# In connection con8 - Running transaction on non encrypt -call tde_db.transaction_table('tde_db.t_non_encrypt'); -# In connection con9 - Running create encrypt and non encrypt table with rotate key -call tde_db.create_table_rotate_key(); -# In connection con10 - Running query on encrypt table -call tde_db.query_table('tde_db.t_encrypt'); -# In connection con11 - Running query on non encrypt table -call tde_db.query_table('tde_db.t_non_encrypt'); -# Starting server with keyring -SELECT COUNT(*) > 1 FROM tde_db.t_encrypt; -COUNT(*) > 1 -# -SELECT COUNT(*) > 1 FROM tde_db.t_non_encrypt; -COUNT(*) > 1 -# -# In connection con1 - Running insert with redo_log_encrypt variable -call tde_db.populate_table_set_redo_encrypt('tde_db.t_encrypt'); -# In connection con2 - Running insert on non encrypt table -call tde_db.populate_table_set_redo_encrypt('tde_db.t_non_encrypt'); -DROP DATABASE tde_db; -# Taking backup of global manifest file for MySQL server -# restart -# Restore global manifest file for MySQL server from backup -# -# Cleanup -# -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kmip -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_kill.test b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_kill.test deleted file mode 100644 index b3621b89c6c9..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_kill.test +++ /dev/null @@ -1,15 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/big_test.inc ---source include/not_parallel.inc -# InnoDB transparent encryption on redo log and undo log -# This test case will test basic encryption support with -# concuurent execution and - ---source include/no_valgrind_without_big.inc ---source include/have_innodb_max_16k.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/innodb/log_encrypt_kill.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/migration-master.opt b/mysql-test/suite/component_keyring_kmip/t/migration-master.opt deleted file mode 100644 index 61ad7d05024b..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/migration-master.opt +++ /dev/null @@ -1 +0,0 @@ -$KEYRING_UDF_OPT diff --git a/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_1.result b/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_1.result deleted file mode 100644 index e21fd8987813..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_1.result +++ /dev/null @@ -1,222 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- - -############################################################# -# TEST 1 : NORMAL ALTER ENCRYPT mysql TABLESPACE. -############################################################# - -######################################################################### -# RESTART 1 : WITH KEYRING -######################################################################### -SET debug='+d,skip_dd_table_access_check'; -# Initially, mysql should be unencrypted by default -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N; -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -ALTER TABLESPACE mysql ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; - -############################################################# -# TEST 2 : CRASH DURING ALTER ENCRYPT mysql TABLESPACE. -############################################################# - -############################################################ -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -# (crash at page 10) # -############################################################ -# Set Encryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE mysql ENCRYPTION='Y'; -# Restart after crash -SET debug='+d,skip_dd_table_access_check'; -# Wait for Encryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Encryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -######################################################################### -# RESTART 2 : WITH KEYRING -######################################################################### -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -############################################################ -# ALTER TABLESPACE 2 : Encrypted => Unencrypted # -# (crash at page 10) # -############################################################ -# Set Unencryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE mysql ENCRYPTION='N'; -# Restart after crash -SET debug='+d,skip_dd_table_access_check'; -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; -ALTER TABLESPACE mysql ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; -######################################################################### -# RESTART 3 : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; -############################################################# -# TEST 3 : CRASH BEFORE/AFTER ENCRYPTION PROCESSING. -############################################################# - -######################################################################### -# RESTART 4 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SET debug='+d,skip_dd_table_access_check'; -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -# Set server to crash just before encryption processing starts -SET SESSION debug="+d,alter_encrypt_tablespace_crash_before_processing"; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE mysql ENCRYPTION='N'; -# Restart after crash -SET debug='+d,skip_dd_table_access_check'; -# Wait for Unencryption processing to finish in background thread -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -# Set server to crash just after encryption processing finishes -SET SESSION debug="-d,alter_encrypt_tablespace_crash_before_processing"; -SET SESSION debug="+d,alter_encrypt_tablespace_crash_after_processing"; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE mysql ENCRYPTION='N'; -# Restart after crash -SET debug='+d,skip_dd_table_access_check'; -# Wait for Unencryption processing to finish in background thread -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; -############################################################# -# TEST 4 : CRASH DURING KEY ROTATION. -############################################################# - -######################################################################### -# RESTART 5 : WITH KEYRING -######################################################################### -SET debug='+d,skip_dd_table_access_check'; -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -# Set server to crash while rotating encryption -SET SESSION debug="+d,ib_crash_during_rotation_for_encryption"; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -# Restart after crash -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -SET SESSION debug="-d,ib_crash_during_rotation_for_encryption"; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -############################################################# -# TEST 5 : PRIVILEGE CHECK. -############################################################# - -CREATE DATABASE priv_test; -CREATE USER myuser@'localhost'; -GRANT ALL ON priv_test.* TO myuser@'localhost'; -#connection con1 -ALTER TABLESPACE mysql ENCRYPTION='Y'; -ERROR 42000: Access denied; you need (at least one of) the CREATE TABLESPACE privilege(s) for this operation -#connection default -GRANT CREATE TABLESPACE ON mysql.* TO myuser@'localhost'; -ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES -GRANT CREATE TABLESPACE ON *.* TO myuser@'localhost'; -#connection con1 -ALTER TABLESPACE mysql ENCRYPTION='N'; -#connection default -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; -#connection con1 -ALTER TABLESPACE mysql ENCRYPTION='Y'; -#connection default -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -DROP DATABASE priv_test; -DROP USER myuser@localhost; -########### -# Cleanup # -########### -ALTER TABLESPACE mysql ENCRYPTION='N'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_1.test b/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_1.test deleted file mode 100644 index 086a0975fc73..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_1.test +++ /dev/null @@ -1,25 +0,0 @@ ---source include/have_component_keyring_kmip.inc -################################################################################ -# InnoDB transparent tablespace data encryption for mysql tablespace. -# For mysql tablespace, this test will test -# 1 - Normal alter encryption -# - encryption='y' to encryption='n' -# - encryption='n' to encryption='y' -# 2 - Crash during altering mysql tablespace encryption -# - encryption='y' to encryption='n' -# - encryption='n' to encryption='y' -# 3 - Crash -# - just before encryption processing starts -# - just after encryption processing finishes -# 4 - Crash during master key rotation -# 5 - Privilege check -################################################################################ - ---source include/big_test.inc ---source include/have_debug.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/mysql_ts_alter_encrypt_1.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_2.result b/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_2.result deleted file mode 100644 index eb75fc4a4d7c..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_2.result +++ /dev/null @@ -1,336 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######### -# SETUP # -######### - -# Taking backup of local manifest file for MySQL server instance -######################################################################### -# START : WITHOUT KEYRING -######################################################################### -ALTER TABLESPACE mysql ENCRYPTION='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -ALTER TABLESPACE mysql ENCRYPTION='N'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 1 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup --------------------------------------------------- -By Default, mysql tablespace should be unencrypted --------------------------------------------------- -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql N -# Print result -table space is Encrypted. -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -# Print result -table space is Encrypted. ------------------------------------------------------ -ALTER mysql TABLESPACE WITH INVALID ENCRYPTION OPTION ------------------------------------------------------ -ALTER TABLESPACE mysql ENCRYPTION='R'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='TRUE'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='True'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='true'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION=TRUE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRUE' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=True; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'True' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=true; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'true' at line 1 -ALTER TABLESPACE mysql ENCRYPTION='FALSE'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='False'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='false'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION=FALSE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FALSE' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=False; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'False' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=false; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'false' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=0; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=null; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=-1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=n; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'n' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=N; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'N' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=y; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'y' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=Y; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Y' at line 1 -ALTER TABLESPACE mysql ENCRYPTION='1'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='1True'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='@'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='null'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION=''; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION=""; -ERROR HY000: Invalid encryption option. ----------------------------------------------------- -ALTER MYSQL TABLESPACE WITH VALID ENCRYPTION OPTION ----------------------------------------------------- -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -ALTER TABLESPACE mysql ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -ALTER TABLESPACE mysql ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql N -ALTER TABLESPACE mysql ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql N -ALTER TABLESPACE mysql ENCRYPTION="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -ALTER TABLESPACE mysql ENCRYPTION="y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -ALTER TABLESPACE mysql ENCRYPTION="n"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql N -ALTER TABLESPACE mysql ENCRYPTION="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql N ------------------------------------------------------ -Create/Alter table using mysql.tablespace ------------------------------------------------------ -CREATE TABLE t1(i int) TABLESPACE mysql; -ERROR HY000: The table 't1' may not be created in the reserved tablespace 'mysql'. -CREATE TEMPORARY TABLE t1(i int) TABLESPACE mysql; -ERROR HY000: The table 't1' may not be created in the reserved tablespace 'mysql'. -CREATE TABLE t1(i int); -ALTER TABLE t1 TABLESPACE mysql; -ERROR HY000: The table 't1' may not be created in the reserved tablespace 'mysql'. -DROP TABLE t1; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB; -CREATE TABLE t1(i int) TABLESPACE encrypt_ts; -ALTER TABLE t1 TABLESPACE mysql; -ERROR HY000: The table 't1' may not be created in the reserved tablespace 'mysql'. -DROP TABLE t1; -CREATE TABLE t1(i int) TABLESPACE innodb_system; -ALTER TABLE t1 TABLESPACE mysql; -ERROR HY000: The table 't1' may not be created in the reserved tablespace 'mysql'. -DROP TABLE t1; -ALTER TABLE mysql.component TABLESPACE mysql; -CREATE TEMPORARY TABLE t1(i int); -ALTER TABLE t1 TABLESPACE mysql; -ERROR HY000: The table 't1' may not be created in the reserved tablespace 'mysql'. -DROP TABLE t1; ------------------------------------------------------ -Create view using mysql.tablespace ------------------------------------------------------ -CREATE TABLE t1(i int); -INSERT INTO t1 VALUES(1); -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -CREATE VIEW v1 AS SELECT * FROM t1 TABLESPACE mysql; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql' at line 1 -DROP TABLE t1; ------------------------------------------------------------- -Alter DD table part of mysql.tablespace to other tablespaces ------------------------------------------------------------- -ALTER TABLE mysql.events TABLESPACE innodb_file_per_table ENCRYPTION='Y'; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE innodb_file_per_table; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE innodb_temporary ENCRYPTION='Y'; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE innodb_temporary; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE innodb_system ENCRYPTION='Y'; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE innodb_system; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE encrypt_ts ENCRYPTION='Y'; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE encrypt_ts; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -DROP TABLESPACE encrypt_ts; -------------------------------------------------------- -Delete/truncate/drop DD table part of mysql tablespace -------------------------------------------------------- -DELETE FROM mysql.events; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -TRUNCATE TABLE mysql.events; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -DROP TABLE mysql.events; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. --------------------------------------------------- -Alter encryption of table part of mysql tablespace --------------------------------------------------- -ALTER TABLE mysql.component ENCRYPTION='Y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE mysql.component ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE mysql.component ENCRYPTION='N'; -ALTER TABLE mysql.component ENCRYPTION='n'; ---------------------------------------------------------------------- -Metadata for a table in mysql ts should not show encryption attribute ---------------------------------------------------------------------- -SHOW CREATE TABLE mysql.plugin; -Table Create Table -plugin CREATE TABLE `plugin` ( - `name` varchar(64) NOT NULL DEFAULT '', - `dl` varchar(128) NOT NULL DEFAULT '', - PRIMARY KEY (`name`) -) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='MySQL plugins' -------------------- -Drop mysql database -------------------- -DROP DATABASE mysql; -ERROR HY000: Access to system schema 'mysql' is rejected. ------------------------------------------------------ -Other DDL operation not allowed on 'mysql' tablespace ------------------------------------------------------ -CREATE TABLESPACE mysql ADD DATAFILE 'mysql.ibd' ENGINE=INNODB; -ERROR 42000: InnoDB: `mysql` is a reserved tablespace name. -DROP TABLESPACE mysql; -ERROR 42000: InnoDB: `mysql` is a reserved tablespace name. -ALTER TABLESPACE mysql RENAME TO xyz; -ERROR 42000: InnoDB: `mysql` is a reserved tablespace name. -ALTER TABLESPACE mysql ENGINE=myisam; -ERROR HY000: Engine 'myisam' does not match stored engine 'InnoDB' for tablespace 'mysql' -ALTER TABLESPACE mysql ENGINE=memory; -ERROR HY000: Engine 'memory' does not match stored engine 'InnoDB' for tablespace 'mysql' -######################################################################### -# Restart with same keyring option -# - tables in mysql ts should be accessible -######################################################################### -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT help_keyword_id FROM mysql.help_keyword ORDER BY help_keyword_id LIMIT 2; -help_keyword_id -0 -1 -ALTER TABLESPACE mysql ENCRYPTION='N'; -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ALTER TABLESPACE mysql ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql N -# Set Encryption process to wait after page 5 so that we can monitor -# progress in performance_schema table -SET DEBUG_SYNC = 'alter_encrypt_tablespace_wait_after_page5 SIGNAL s1 WAIT_FOR s2'; -ALTER TABLESPACE mysql ENCRYPTION='Y'; -# Monitoring connection -SET DEBUG_SYNC = 'now WAIT_FOR s1'; -# Wait for Encryption progress monitoring to appear in PFS table -# Wait for some progress to appear in PFS table -select WORK_COMPLETED -FROM performance_schema.events_stages_current -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)'; -WORK_COMPLETED -5 -SET DEBUG_SYNC = 'now SIGNAL s2'; -# Default connection -# Once done, select count from PFS tables -SELECT COUNT(*) -FROM performance_schema.events_stages_current -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -COUNT(*) -0 -SELECT COUNT(*) -FROM performance_schema.events_stages_history -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -COUNT(*) -0 -SELECT COUNT(*) -FROM performance_schema.events_stages_history_long -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -COUNT(*) -3 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_global_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_by_user_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_by_host_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_by_account_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -# Check that Encryption done successfully. -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT help_keyword_id FROM mysql.help_keyword ORDER BY help_keyword_id LIMIT 2; -help_keyword_id -0 -1 -########### -# Cleanup # -########### -ALTER TABLESPACE mysql ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_2.test b/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_2.test deleted file mode 100644 index 1a12498d4ac1..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_2.test +++ /dev/null @@ -1,29 +0,0 @@ ---source include/have_component_keyring_kmip.inc -################################################################################ -# InnoDB transparent tablespace data encryption for mysql.tablespace. -# For mysql.tablespace, this test will test -# 1 - Alter mysql.tablespace with -# - and without loading keyring plugin -# - valid/invalid encryption option -# -ENCRYPTION='n' to ENCRYPTION='y' -# 2 - Actual encryption taking place or not -# 3 - Create/Alter table using mysql.tablespace -# 4 - Alter table part of innodb_file_per_table/general/innodb_system/mysql ts to mysql ts -# 5 - Create view using mysql.tablespace -# 6 - Delete/truncate/drop DD table part of mysql tablespace -# 7 - Changing encryption attribute of tables in mysql tablespace -# 8 - Restart with same keyring plugin option and access mysql tables -# 9 - Restart without keyring plugin option, Install plugin explicitly and alter encryption to Y -# 10 - Monitor progress of encryption in performance_schema table -# 11 - Rename/drop mysql tablespace -# 12 - Create tablespace with name as mysql -################################################################################ - ---source include/big_test.inc ---source include/have_debug.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/mysql_ts_alter_encrypt_2.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/mysqldump.result b/mysql-test/suite/component_keyring_kmip/t/mysqldump.result deleted file mode 100644 index ce14204b9283..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/mysqldump.result +++ /dev/null @@ -1,353 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Pre-define user u1, which is used in different tests below. -CREATE USER u1@localhost; -GRANT ALL ON db1.* TO u1@localhost; -GRANT CREATE TABLESPACE, PROCESS, SYSTEM_VARIABLES_ADMIN ON *.* TO u1@localhost; -# This test run output (.sql) of mysqldump from 5.7, 8.0.12 and 8.0.13 -# in 8.0.15. -# -# The .sql files contain notes with tag wl12261 describing the -# modifications done to .sql to make it run on MySQL 8.0.15. -# It basically does two things a) removes ENCRYPTION=y for CVS and -# MEMORY engines. b) Adds a explicit ENCRYPTION='y' for tables -# using encryped general tablespace. -# -# The behavior of executing .sql with following variables would be -# same as the test behavior seen by encryption.* test results. -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting default_table_encryption to true/false. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -CREATE TABLESPACE ts2 ADD DATAFILE 'ts2.ibd'; -CREATE TABLESPACE ts3 ADD DATAFILE 'ts3.ibd'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ /*!80016 DEFAULT ENCRYPTION='N' */ -SHOW CREATE TABLE db1.i1; -Table Create Table -i1 CREATE TABLE `i1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.i2; -Table Create Table -i2 CREATE TABLE `i2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ENCRYPTION='y' -SHOW CREATE TABLE db1.i3; -Table Create Table -i3 CREATE TABLE `i3` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.i4; -Table Create Table -i4 CREATE TABLE `i4` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.i_ts1; -Table Create Table -i_ts1 CREATE TABLE `i_ts1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.i_ts2; -Table Create Table -i_ts2 CREATE TABLE `i_ts2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.i_ts3; -Table Create Table -i_ts3 CREATE TABLE `i_ts3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.i_part1; -Table Create Table -i_part1 CREATE TABLE `i_part1` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.i_part2; -Table Create Table -i_part2 CREATE TABLE `i_part2` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 ENCRYPTION='y' -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.i_part3; -Table Create Table -i_part3 CREATE TABLE `i_part3` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.c1; -Table Create Table -c1 CREATE TABLE `c1` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.c2; -Table Create Table -c2 CREATE TABLE `c2` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.c3; -Table Create Table -c3 CREATE TABLE `c3` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.h1; -Table Create Table -h1 CREATE TABLE `h1` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.h2; -Table Create Table -h2 CREATE TABLE `h2` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.h3; -Table Create Table -h3 CREATE TABLE `h3` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 -DROP DATABASE db1; -DROP TABLESPACE ts1; -DROP TABLESPACE ts2; -DROP TABLESPACE ts3; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -CREATE TABLESPACE ts2 ADD DATAFILE 'ts2.ibd'; -CREATE TABLESPACE ts3 ADD DATAFILE 'ts3.ibd'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SHOW CREATE TABLE db1.i1; -Table Create Table -i1 CREATE TABLE `i1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i2; -Table Create Table -i2 CREATE TABLE `i2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.i3; -Table Create Table -i3 CREATE TABLE `i3` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i4; -Table Create Table -i4 CREATE TABLE `i4` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_ts1; -Table Create Table -i_ts1 CREATE TABLE `i_ts1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_ts2; -Table Create Table -i_ts2 CREATE TABLE `i_ts2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_ts3; -Table Create Table -i_ts3 CREATE TABLE `i_ts3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_part1; -Table Create Table -i_part1 CREATE TABLE `i_part1` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.i_part2; -Table Create Table -i_part2 CREATE TABLE `i_part2` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.i_part3; -Table Create Table -i_part3 CREATE TABLE `i_part3` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.c1; -Table Create Table -c1 CREATE TABLE `c1` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.c2; -Table Create Table -c2 CREATE TABLE `c2` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.c3; -Table Create Table -c3 CREATE TABLE `c3` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.h1; -Table Create Table -h1 CREATE TABLE `h1` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.h2; -Table Create Table -h2 CREATE TABLE `h2` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.h3; -Table Create Table -h3 CREATE TABLE `h3` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP DATABASE db1; -DROP TABLESPACE ts1; -DROP TABLESPACE ts2; -DROP TABLESPACE ts3; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -CREATE TABLESPACE ts2 ADD DATAFILE 'ts2.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts3 ADD DATAFILE 'ts3.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts4 ADD DATAFILE 'ts4.ibd'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SHOW CREATE TABLE db1.i1; -Table Create Table -i1 CREATE TABLE `i1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i2; -Table Create Table -i2 CREATE TABLE `i2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.i3; -Table Create Table -i3 CREATE TABLE `i3` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_ts1; -Table Create Table -i_ts1 CREATE TABLE `i_ts1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_ts2; -Table Create Table -i_ts2 CREATE TABLE `i_ts2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts2` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_ts3; -Table Create Table -i_ts3 CREATE TABLE `i_ts3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts3` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.i_ts4; -Table Create Table -i_ts4 CREATE TABLE `i_ts4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts4` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_part1; -Table Create Table -i_part1 CREATE TABLE `i_part1` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.i_part2; -Table Create Table -i_part2 CREATE TABLE `i_part2` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.i_part3; -Table Create Table -i_part3 CREATE TABLE `i_part3` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.c1; -Table Create Table -c1 CREATE TABLE `c1` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.c2; -Table Create Table -c2 CREATE TABLE `c2` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.c3; -Table Create Table -c3 CREATE TABLE `c3` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.h1; -Table Create Table -h1 CREATE TABLE `h1` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.h2; -Table Create Table -h2 CREATE TABLE `h2` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.h3; -Table Create Table -h3 CREATE TABLE `h3` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP DATABASE db1; -DROP TABLESPACE ts1; -DROP TABLESPACE ts2; -DROP TABLESPACE ts3; -DROP TABLESPACE ts4; -# Cleanup -DROP USER u1@localhost; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/mysqldump.test b/mysql-test/suite/component_keyring_kmip/t/mysqldump.test deleted file mode 100644 index c8accdd97dd0..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/mysqldump.test +++ /dev/null @@ -1,8 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc ---source include/no_valgrind_without_big.inc ---source include/have_case_sensitive_file_system.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/encryption/mysqldump.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/rename_table.result b/mysql-test/suite/component_keyring_kmip/t/rename_table.result deleted file mode 100644 index 00a8f8b301cc..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/rename_table.result +++ /dev/null @@ -1,911 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# 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'; -# The test cases run RENAME TABLE to move tables from one database -# to another, with tables using file-per-table or general -# tablespace. And these operations are run in below configuration, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting per database default encryption to 'y' and 'n' -# - Setting table's encryption mode to 'y' and 'n'. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - -# - Check for warnings generated. -# -````````````````````````````````````````````````````````` -# Test using innodb_file_per_table tablespace. -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=false -# [ALTER TABLE ... RENAME ...] Case 1 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# 1.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 1.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -RENAME TABLE db2.ts1 TO db1.ts1_rename; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 1.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -# [ALTER TABLE ... RENAME ...] Case 2 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# 2.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -# 2.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -RENAME TABLE db2.ts1 TO db1.ts1_rename; -# 2.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 3 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# 3.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 3.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -RENAME TABLE db2.ts1 TO db1.ts1_rename; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 3.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt2 -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -# [ALTER TABLE ... RENAME ...] Case 4 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 4.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 4.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 4.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 5 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# 5.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -# 5.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -RENAME TABLE db2.ts1 TO db1.ts1_rename; -# 5.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt2 -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -# [ALTER TABLE ... RENAME ...] Case 6 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 6.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 6.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 6.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -````````````````````````````````````````````````````````` -# Test using general tablespace. -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=false -# [ALTER TABLE ... RENAME ...] Case 7 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# 7.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 7.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -RENAME TABLE db2.ts1 TO db1.ts1_rename; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 7.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 8 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# 8.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -# 8.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -RENAME TABLE db2.ts1 TO db1.ts1_rename; -# 8.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 9 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# 9.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 9.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -RENAME TABLE db2.ts1 TO db1.ts1_rename; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 9.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt2 -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 10 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 10.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 10.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 10.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 11 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# 11.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -# 11.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -RENAME TABLE db2.ts1 TO db1.ts1_rename; -# 11.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt2 -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 12 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 12.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 12.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 12.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# Cleanup -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/rename_table.test b/mysql-test/suite/component_keyring_kmip/t/rename_table.test deleted file mode 100644 index 168c6680252b..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/rename_table.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/encryption/rename_table_tests.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/suite.opt b/mysql-test/suite/component_keyring_kmip/t/suite.opt deleted file mode 100644 index b6ce825f2594..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/suite.opt +++ /dev/null @@ -1 +0,0 @@ -$KEYRING_KMIP_COMPONENT_OPT diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_1.result b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_1.result deleted file mode 100644 index a484225ea89e..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_1.result +++ /dev/null @@ -1,224 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -SET GLOBAL innodb_file_per_table = 0; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -0 -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE t1(c int) ENCRYPTION="Y" tablespace innodb_system; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -CREATE TABLE t1(c int) ENCRYPTION="N" tablespace innodb_system; -DROP TABLE t1; -CREATE TEMPORARY TABLE t1(c int) ENCRYPTION="Y"; -ERROR HY000: InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -Error 1031 Table storage engine for 't1' doesn't have this option -CREATE TEMPORARY TABLE t1(c int) ENCRYPTION="N"; -ERROR HY000: InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -Error 1031 Table storage engine for 't1' doesn't have this option -CREATE TABLE t1(c int) ENCRYPTION="R" ENGINE = InnoDB; -ERROR HY000: Invalid encryption option. -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -# Kill the server -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER TABLE t1 ENCRYPTION="N", algorithm=inplace; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -ALTER TABLE t1 TABLESPACE=`innodb_system`; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE t1 ENCRYPTION="N", algorithm=copy; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -DROP TABLE t1; -CREATE TABLE t1 (c1 int) ENCRYPTION='N'; -ALTER TABLE t1 ENCRYPTION='P',algorithm=copy; -ERROR HY000: Invalid encryption option. -ALTER TABLE t1 ADD KEY k1 (c1) ,algorithm=inplace; -ALTER TABLE t1 ENCRYPTION='Y',algorithm=inplace; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -drop table t1; -CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION = "ZLIB" ENCRYPTION = "Y" ENGINE = InnoDB; -INSERT INTO t1 VALUES(0), (1), (2), (3), (4), (5), (6), (7), (8), (9); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int NOT NULL, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='ZLIB' ENCRYPTION='Y' -FLUSH TABLES t1 WITH READ LOCK; -UNLOCK TABLES; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -SELECT * FROM t1 ORDER BY c1; -c1 -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -DROP TABLE t1; -CREATE TABLE t1(c1 int null) ENCRYPTION='Y' ROW_FORMAT=compressed; -INSERT INTO t1 VALUES(0), (1), (2), (3), (4), (5), (6), (7), (8), (9); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -FLUSH TABLES t1 WITH READ LOCK; -UNLOCK TABLES; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -SELECT * FROM t1 ORDER BY c1; -c1 -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -DROP TABLE t1; -CREATE TABLE t1(c1 INT PRIMARY KEY, g geometry not null, spatial index(g)) ENCRYPTION = "Y" ENGINE = InnoDB; -INSERT INTO t1 VALUES(0, POINT(0, 0)); -INSERT INTO t1 VALUES(1, POINT(1, 1)); -INSERT INTO t1 VALUES(2, POINT(2, 2)); -INSERT INTO t1 VALUES(3, POINT(3, 3)); -INSERT INTO t1 VALUES(4, POINT(4, 4)); -INSERT INTO t1 VALUES(5, POINT(5, 5)); -INSERT INTO t1 VALUES(6, POINT(6, 6)); -INSERT INTO t1 VALUES(7, POINT(7, 7)); -INSERT INTO t1 VALUES(8, POINT(8, 8)); -INSERT INTO t1 VALUES(9, POINT(9, 9)); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int NOT NULL, - `g` geometry NOT NULL, - PRIMARY KEY (`c1`), - SPATIAL KEY `g` (`g`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -FLUSH TABLES t1 WITH READ LOCK; -UNLOCK TABLES; -SELECT c1, ST_AsText(g) FROM t1 ORDER BY c1 LIMIT 10; -c1 ST_AsText(g) -0 POINT(0 0) -1 POINT(1 1) -2 POINT(2 2) -3 POINT(3 3) -4 POINT(4 4) -5 POINT(5 5) -6 POINT(6 6) -7 POINT(7 7) -8 POINT(8 8) -9 POINT(9 9) -SELECT c1, ST_AsText(g) FROM t1 ORDER BY c1 LIMIT 10; -c1 ST_AsText(g) -0 POINT(0 0) -1 POINT(1 1) -2 POINT(2 2) -3 POINT(3 3) -4 POINT(4 4) -5 POINT(5 5) -6 POINT(6 6) -7 POINT(7 7) -8 POINT(8 8) -9 POINT(9 9) -DROP TABLE t1; -SET GLOBAL innodb_file_per_table=OFF; -CREATE TABLE t1 (c1 int); -ALTER TABLE t1 COMPRESSION='zlib'; -ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'COMPRESSION' -SHOW WARNINGS; -Level Code Message -Warning 138 InnoDB: Page Compression is not supported for the system tablespace -Error 1478 Table storage engine 'InnoDB' does not support the create option 'COMPRESSION' -ALTER TABLE t1 ENCRYPTION='Y',ALGORITHM=COPY; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL innodb_file_per_table=1; -DROP TABLE t1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_1.test b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_1.test deleted file mode 100644 index 8bf0b671f00c..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_1.test +++ /dev/null @@ -1,12 +0,0 @@ ---source include/have_component_keyring_kmip.inc -# InnoDB transparent tablespace data encryption -# This test case will test basic encryption support features. - ---source include/no_valgrind_without_big.inc ---source include/have_innodb_max_16k.inc ---source include/have_debug.inc ---source include/have_punch_hole.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/table_encrypt_1.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_2.result b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_2.result deleted file mode 100644 index 233cb5fe5f6c..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_2.result +++ /dev/null @@ -1,170 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -DROP TABLE IF EXISTS t1; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER INSTANCE ROTATE INNODB MASTER KEY; -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -DROP TABLE t1; -SET block_encryption_mode = 'aes-256-cbc'; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -CREATE TABLE tde_db.t1(c1 INT PRIMARY KEY, c2 char(50)) ENCRYPTION = 'Y' ENGINE = InnoDB; -INSERT INTO tde_db.t1 VALUES(0, 'abc'); -INSERT INTO tde_db.t1 VALUES(1, 'xyz'); -INSERT INTO tde_db.t1 VALUES(2, null); -INSERT INTO tde_db.t1 VALUES(3, null); -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -# Mysqldump output - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `tde_db` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; - -USE `tde_db`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `t1` ( - `c1` int NOT NULL, - `c2` char(50) DEFAULT NULL, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y'; -/*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO `t1` VALUES (0,'abc'),(1,'xyz'),(2,NULL),(3,NULL); -# Redirecting mysqlpump output to MYSQL_TMP_DIR/mysqlpump_encrypt.sql -DROP DATABASE tde_db; -Pattern "ALTER INSTANCE ROTATE INNODB MASTER KEY" found -# Loading tables from mysqlpump_encrypt.sql -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -INSERT INTO tde_db.t1 VALUES(4, null); -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -4 NULL -DROP DATABASE tde_db; -# -# Bug #26634507 CREATE_OPTIONS FLD IN INFORMATION_SCHEMA.TABLES NOT -# FILLING PROPERLY. -# The CREATE_OPTIONS field from I_S.TABLES should show the option -# 'ENCRYPTION='. -# -CREATE TABLE not_encrypted1 (col1 INT) ENCRYPTION='n'; -CREATE TABLE not_encrypted2 (col1 INT) ENCRYPTION='N'; -CREATE TABLE encrypted1 (col1 INT) ENCRYPTION='y'; -CREATE TABLE encrypted2 (col1 INT) ENCRYPTION='Y'; -SELECT TABLE_SCHEMA, TABLE_NAME, CREATE_OPTIONS -FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME like '%encrypted%' - ORDER BY TABLE_NAME; -TABLE_SCHEMA TABLE_NAME CREATE_OPTIONS -test encrypted1 ENCRYPTION='y' -test encrypted2 ENCRYPTION='Y' -test not_encrypted1 -test not_encrypted2 -DROP TABLE encrypted1; -DROP TABLE not_encrypted1; -DROP TABLE encrypted2; -DROP TABLE not_encrypted2; -SET GLOBAL innodb_file_per_table=1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_2.test b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_2.test deleted file mode 100644 index 6a06f4a67598..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_2.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_component_keyring_kmip.inc -# InnoDB transparent tablespace data encryption -# This test case will test basic encryption support features. - ---source include/no_valgrind_without_big.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/table_encrypt_2.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.result b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.result deleted file mode 100644 index 5b032f1e04b3..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.result +++ /dev/null @@ -1,1422 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Taking backup of local manifest file for MySQL server instance -# Create encrypt table before loading keyring -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -DROP TABLE IF EXISTS t_encrypt; -CREATE TABLE t_encrypt(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -# Starting server with keyring -# Restore local manifest file for MySQL server instance from backup -DROP DATABASE IF EXISTS tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -CREATE DATABASE tde_db; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt(c4 JSON , -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO tde_db.t_encrypt(c4,c7) VALUES('{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -INSERT INTO tde_db.t_encrypt(c4,c7) select c4,c7 from tde_db.t_encrypt; -SELECT c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -SELECT c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 c6 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -# In connection 1 -LOCK TABLES tde_db.t_encrypt WRITE; -# In connection default -SHOW OPEN TABLES LIKE 't_encrypt'; -Database Table In_use Name_locked -tde_db t_encrypt 1 0 -"ALTER INSTANCE.." do not conflict with "LOCK TABLE .." COMMAND -ALTER INSTANCE ROTATE INNODB MASTER KEY; -# In connection 1 -INSERT INTO tde_db.t_encrypt(c4,c7) VALUES('{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 c6 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -UNLOCK TABLES; -# In connection default -SELECT c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 c6 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 c6 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -DROP DATABASE tde_db; -SET GLOBAL innodb_file_per_table=1; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -DROP TABLE IF EXISTS tde_db.t_encrypt_1; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt(c1 INT, c2 char(20), c3 BLOB) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE TABLE tde_db.t_encrypt_1(c1 INT, c2 char(20)) ENCRYPTION="Yes" ENGINE = InnoDB; -ERROR HY000: Invalid encryption option. -CREATE TABLE tde_db.t_encrypt_1(c1 INT, c2 char(20)) ENCRYPTION="y" ENGINE = InnoDB; -DROP TABLE tde_db.t_encrypt_1; -CREATE TABLE tde_db.t_encrypt_1(c1 INT, c2 char(20),c3 BLOB) ENGINE = InnoDB; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL, - `c3` blob -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO tde_db.t_encrypt VALUES(0, "aaaaa",repeat('A', 20000)); -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -#Insert into non encrypted table -INSERT INTO tde_db.t_encrypt_1 SELECT * FROM tde_db.t_encrypt; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt_1 LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -SELECT COUNT(*) FROM tde_db.t_encrypt_1; -COUNT(*) -64 -# Starting server with keyring restart with keying -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -64 -#check non encrypted table -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt_1 LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -SELECT COUNT(*) FROM tde_db.t_encrypt_1; -COUNT(*) -64 -DROP TABLE tde_db.t_encrypt; -DROP TABLE tde_db.t_encrypt_1; -SET GLOBAL innodb_file_per_table=1; -DROP DATABASE IF EXISTS tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -CREATE DATABASE tde_db; -USE tde_db; -# File per table is set 0. Encryption not possible. -SET GLOBAL innodb_file_per_table = 0; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -0 -CREATE TABLE tde_db.t_encrypt(c4 JSON , -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLESPACE s_alt1 ADD DATAFILE 's_alt1.ibd'; -CREATE TABLE tde_db.t_encrypt (a int, b text) ENCRYPTION="Y" TABLESPACE=`s_alt1` ENGINE=InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP TABLESPACE s_alt1; -CREATE TEMPORARY TABLE tde_db.t_encrypt (a int, b text) ENCRYPTION="Y" ENGINE=InnoDB; -ERROR HY000: InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -Error 1031 Table storage engine for 't_encrypt' doesn't have this option -CREATE TABLE tde_db.t_encrypt_myisam (a int, b text) ENCRYPTION="Y" ENGINE=MyISAM; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -CREATE PROCEDURE tde_db.row_format_t_encrypt(row_form VARCHAR(1000)) -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -DROP TABLE IF EXISTS tde_db.t_encrypt; -SET @sql_text = CONCAT('CREATE TABLE tde_db.t_encrypt ('," c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,c3 VARCHAR(255), c4 JSON ,c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED,c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL,c7 POINT NOT NULL SRID 0,spatial INDEX idx2 (c7) ) ", ' ENCRYPTION="Y" ', row_form ,' ENGINE=InnoDB'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -SHOW CREATE TABLE tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) VALUES (REPEAT('a',200),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -SELECT COUNT(*) FROM tde_db.t_encrypt; -SELECT c2,c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -DELETE FROM tde_db.t_encrypt WHERE c2 > 10; -UPDATE tde_db.t_encrypt SET c2 = 100 WHERE c2=1; -SELECT c2,c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -SHOW CREATE TABLE tde_db.t_encrypt; -end| -call tde_db.row_format_t_encrypt(" ROW_FORMAT=DYNAMIC "); -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC ENCRYPTION='Y' -COUNT(*) -32 -c2 c4 c5 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -c2 c4 c5 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC ENCRYPTION='Y' -# restart with keying -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -8 -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -16 -call tde_db.row_format_t_encrypt(" ROW_FORMAT=COMPACT "); -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT ENCRYPTION='Y' -COUNT(*) -32 -c2 c4 c5 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -c2 c4 c5 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT ENCRYPTION='Y' -# restart with keying -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -8 -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -16 -call tde_db.row_format_t_encrypt(" ROW_FORMAT=REDUNDANT "); -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=REDUNDANT ENCRYPTION='Y' -COUNT(*) -32 -c2 c4 c5 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -c2 c4 c5 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=REDUNDANT ENCRYPTION='Y' -# restart with keying -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -8 -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -16 -call tde_db.row_format_t_encrypt(" ROW_FORMAT=COMPRESSED " ); -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -COUNT(*) -32 -c2 c4 c5 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -c2 c4 c5 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -# restart with keying -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -8 -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -16 -call tde_db.row_format_t_encrypt(" ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 "); -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 ENCRYPTION='Y' -COUNT(*) -32 -c2 c4 c5 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -c2 c4 c5 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 ENCRYPTION='Y' -# restart with keying -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -8 -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -16 -# Create partition table -DROP TABLE tde_db.t_encrypt; -CREATE TABLE tde_db.t_encrypt (c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,c3 VARCHAR(255), c4 JSON ,c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED,c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL ) ENCRYPTION="Y" ENGINE=InnoDB PARTITION BY RANGE (c2) (PARTITION p1 VALUES LESS THAN (4),PARTITION p2 VALUES LESS THAN (8),PARTITION p3 VALUES LESS THAN (1000)) ; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - PRIMARY KEY (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -/*!50100 PARTITION BY RANGE (`c2`) -(PARTITION p1 VALUES LESS THAN (4) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (8) ENGINE = InnoDB, - PARTITION p3 VALUES LESS THAN (1000) ENGINE = InnoDB) */ -INSERT INTO tde_db.t_encrypt(c3,c4) VALUES (REPEAT('a',200),'{ "key_a": 1, "key_b": 2, "key_c": 3 }'); -INSERT INTO tde_db.t_encrypt(c3,c4) SELECT c3,c4 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4) SELECT c3,c4 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4) SELECT c3,c4 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4) SELECT c3,c4 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4) SELECT c3,c4 FROM tde_db.t_encrypt; -SELECT c2,c4,c5 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -5 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -SELECT c2,c4,c5,c6 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 c6 -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -5 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -DELETE FROM tde_db.t_encrypt WHERE c2 > 10; -UPDATE tde_db.t_encrypt SET c2 = 100 WHERE c2=1; -SELECT c2,c4,c5 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -5 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -SELECT c2,c4,c5,c6 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 c6 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -5 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -ALTER TABLE tde_db.t_encrypt TRUNCATE PARTITION p2; -SELECT c2,c4,c5 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -SELECT c2,c4,c5,c6 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 c6 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - PRIMARY KEY (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -/*!50100 PARTITION BY RANGE (`c2`) -(PARTITION p1 VALUES LESS THAN (4) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (8) ENGINE = InnoDB, - PARTITION p3 VALUES LESS THAN (1000) ENGINE = InnoDB) */ -# restart with keying -SELECT c2,c4,c5,c6 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 c6 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -DROP TABLE tde_db.t_encrypt; -DROP DATABASE tde_db; -SET GLOBAL innodb_file_per_table=1; -DROP DATABASE IF EXISTS tde_db; -DROP TABLE IF EXISTS tde_db. t_encrypt; -CREATE DATABASE tde_db; -USE tde_db; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt(c2 INT NOT NULL PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON , -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE PROCEDURE tde_db.populate_t_encrypt() -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 2000) DO -insert into tde_db.t_encrypt(c2,c3,c4,c7) VALUES(i,CONCAT(REPEAT('a',200),LPAD(CAST(i AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.populate_t_encrypt_small() -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 500) DO -insert into tde_db.t_encrypt(c2,c3,c4,c7) VALUES(i,CONCAT(REPEAT('a',200),LPAD(CAST(i AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.read_t_encrypt() -begin -declare i int default 1; -while (i <= 30) DO -SELECT * FROM (SELECT * FROM tde_db.t_encrypt ORDER BY RAND() LIMIT 1) AS A WHERE A.c2 < 0 ; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.rotate_master_key() -begin -declare i int default 1; -declare has_error int default 0; -while (i <= 500) DO -ALTER INSTANCE ROTATE INNODB MASTER KEY; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.create_encrypt_table(encrypt VARCHAR(5)) -begin -declare i int default 1; -declare has_error int default 0; -while (i <= 50) DO -SET @sql_text = CONCAT('CREATE TABLE ',CONCAT('tde_db.t_encrypt_',encrypt,'_',i),' (c1 INT) ENCRYPTION="',encrypt,'"' ,' ENGINE=InnoDB'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -set i = i + 1; -end while; -end| -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL, - `c3` char(255) DEFAULT 'No text', - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -# In connection con1 - Running insert -call tde_db.populate_t_encrypt(); -# In connection con2 - Running insert -call tde_db.populate_t_encrypt_small(); -# In connection con3 : Running select -call tde_db.read_t_encrypt(); -# In connection con4 : Running select -call tde_db.read_t_encrypt(); -# In connection con5 - Running "alter instance" -call tde_db.rotate_master_key(); -# In connection con6 - Running "create table" -call tde_db.create_encrypt_table("Y"); -# In connection con7 - Running "create table" -call tde_db.create_encrypt_table("N"); -# In connection con1 -# In connection con2 -# In connection con3 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -# In connection con4 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -# In connection con5 -# In connection con6 -# In connection con7 -USE tde_db; -SELECT c2,right(c3,20),c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 right(c3,20) c4 c5 ST_AsText(c7) -1 aaaaaaaaaaaaaaaa0001 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 aaaaaaaaaaaaaaaa0002 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 aaaaaaaaaaaaaaaa0003 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 aaaaaaaaaaaaaaaa0004 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -5 aaaaaaaaaaaaaaaa0005 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 aaaaaaaaaaaaaaaa0006 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 aaaaaaaaaaaaaaaa0007 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 aaaaaaaaaaaaaaaa0008 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 aaaaaaaaaaaaaaaa0009 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -10 aaaaaaaaaaaaaaaa0010 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 right(c3,20) c4 c5 c6 ST_AsText(c7) -1 aaaaaaaaaaaaaaaa0001 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 aaaaaaaaaaaaaaaa0002 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 aaaaaaaaaaaaaaaa0003 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 aaaaaaaaaaaaaaaa0004 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -5 aaaaaaaaaaaaaaaa0005 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 aaaaaaaaaaaaaaaa0006 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 aaaaaaaaaaaaaaaa0007 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 aaaaaaaaaaaaaaaa0008 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 aaaaaaaaaaaaaaaa0009 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -10 aaaaaaaaaaaaaaaa0010 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -2000 -SELECT c2,right(c3,20),c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt WHERE c2%200 = 0; -c2 right(c3,20) c4 c5 ST_AsText(c7) -200 aaaaaaaaaaaaaaaa0200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -400 aaaaaaaaaaaaaaaa0400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -600 aaaaaaaaaaaaaaaa0600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -800 aaaaaaaaaaaaaaaa0800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1000 aaaaaaaaaaaaaaaa1000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1200 aaaaaaaaaaaaaaaa1200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1400 aaaaaaaaaaaaaaaa1400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1600 aaaaaaaaaaaaaaaa1600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1800 aaaaaaaaaaaaaaaa1800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2000 aaaaaaaaaaaaaaaa2000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt WHERE c2%200 = 0; -c2 right(c3,20) c4 c5 c6 ST_AsText(c7) -200 aaaaaaaaaaaaaaaa0200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -400 aaaaaaaaaaaaaaaa0400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -600 aaaaaaaaaaaaaaaa0600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -800 aaaaaaaaaaaaaaaa0800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1000 aaaaaaaaaaaaaaaa1000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1200 aaaaaaaaaaaaaaaa1200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1400 aaaaaaaaaaaaaaaa1400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1600 aaaaaaaaaaaaaaaa1600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1800 aaaaaaaaaaaaaaaa1800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2000 aaaaaaaaaaaaaaaa2000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -# restart with keying -SELECT c2,right(c3,20),c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 right(c3,20) c4 c5 ST_AsText(c7) -1 aaaaaaaaaaaaaaaa0001 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 aaaaaaaaaaaaaaaa0002 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 aaaaaaaaaaaaaaaa0003 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 aaaaaaaaaaaaaaaa0004 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -5 aaaaaaaaaaaaaaaa0005 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 aaaaaaaaaaaaaaaa0006 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 aaaaaaaaaaaaaaaa0007 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 aaaaaaaaaaaaaaaa0008 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 aaaaaaaaaaaaaaaa0009 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -10 aaaaaaaaaaaaaaaa0010 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 right(c3,20) c4 c5 c6 ST_AsText(c7) -1 aaaaaaaaaaaaaaaa0001 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 aaaaaaaaaaaaaaaa0002 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 aaaaaaaaaaaaaaaa0003 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 aaaaaaaaaaaaaaaa0004 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -5 aaaaaaaaaaaaaaaa0005 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 aaaaaaaaaaaaaaaa0006 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 aaaaaaaaaaaaaaaa0007 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 aaaaaaaaaaaaaaaa0008 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 aaaaaaaaaaaaaaaa0009 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -10 aaaaaaaaaaaaaaaa0010 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -2000 -SELECT c2,right(c3,20),c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt WHERE c2%200 = 0; -c2 right(c3,20) c4 c5 ST_AsText(c7) -200 aaaaaaaaaaaaaaaa0200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -400 aaaaaaaaaaaaaaaa0400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -600 aaaaaaaaaaaaaaaa0600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -800 aaaaaaaaaaaaaaaa0800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1000 aaaaaaaaaaaaaaaa1000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1200 aaaaaaaaaaaaaaaa1200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1400 aaaaaaaaaaaaaaaa1400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1600 aaaaaaaaaaaaaaaa1600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1800 aaaaaaaaaaaaaaaa1800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2000 aaaaaaaaaaaaaaaa2000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt WHERE c2%200 = 0; -c2 right(c3,20) c4 c5 c6 ST_AsText(c7) -200 aaaaaaaaaaaaaaaa0200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -400 aaaaaaaaaaaaaaaa0400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -600 aaaaaaaaaaaaaaaa0600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -800 aaaaaaaaaaaaaaaa0800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1000 aaaaaaaaaaaaaaaa1000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1200 aaaaaaaaaaaaaaaa1200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1400 aaaaaaaaaaaaaaaa1400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1600 aaaaaaaaaaaaaaaa1600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1800 aaaaaaaaaaaaaaaa1800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2000 aaaaaaaaaaaaaaaa2000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -DROP DATABASE tde_db; -SET GLOBAL innodb_file_per_table=1; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt(c1 INT, c2 char(20), c3 BLOB) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL, - `c3` blob -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO tde_db.t_encrypt VALUES(0, "aaaaa",repeat('A', 20000)); -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -CREATE USER encryptprivuser@localhost IDENTIFIED BY 'auth'; -GRANT ALL PRIVILEGES ON *.* to encryptprivuser@localhost; -FLUSH PRIVILEGES; -CREATE USER encryptnonprivuser@localhost IDENTIFIED BY 'noauth'; -GRANT SELECT ON *.* to encryptnonprivuser@localhost; -FLUSH PRIVILEGES; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -# In connection 1 -SELECT CURRENT_USER(); -CURRENT_USER() -encryptprivuser@localhost -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -# In connection 2 -SELECT CURRENT_USER(); -CURRENT_USER() -encryptnonprivuser@localhost -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR 42000: Access denied; you need (at least one of) the SUPER or ENCRYPTION_KEY_ADMIN privilege(s) for this operation -CREATE TABLE tde_db.t_encrypt_np(c1 INT, c2 char(20), c3 BLOB) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR 42000: CREATE command denied to user 'encryptnonprivuser'@'localhost' for table 't_encrypt_np' -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -# In connection default -# Starting server with keyring -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -DROP USER encryptnonprivuser@localhost; -DROP USER encryptprivuser@localhost; -DROP TABLE tde_db.t_encrypt; -SET GLOBAL innodb_file_per_table=1; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt(c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 char(100), c3 BLOB , FULLTEXT INDEX `idx1` (c2)) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE TABLE tde_db.t_encrypt1(c11 INT , c22 char(100), c33 BLOB , FULLTEXT INDEX `idx1` (c22)) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c1` int NOT NULL AUTO_INCREMENT, - `c2` char(100) DEFAULT NULL, - `c3` blob, - PRIMARY KEY (`c1`), - FULLTEXT KEY `idx1` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -CREATE TABLE tde_db.t_encrypt2 (f1 INT PRIMARY KEY, f2 CHAR(100), -FOREIGN KEY (f1) REFERENCES tde_db.t_encrypt(c1) ON UPDATE CASCADE) ENCRYPTION="Y" ENGINE=InnoDB; -CREATE TRIGGER tde_db.trigger_encrypt_table AFTER INSERT ON tde_db.t_encrypt -FOR EACH ROW -begin -INSERT INTO tde_db.t_encrypt1 SET c11 = NEW.c1*-1, c22 = NEW.c2 , c33 = NEW.c3; -end| -INSERT INTO tde_db.t_encrypt(c2,c3) VALUES("transparanet tablespace encryption",repeat('A', 200)); -INSERT INTO tde_db.t_encrypt(c2,c3) VALUES("general tablespace option",repeat('A', 200)); -INSERT INTO tde_db.t_encrypt(c2,c3) VALUES("page level encryption",repeat('A', 200)); -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(1,"transparanet tablespace encryption"); -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(2,"general tablespace option"); -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -1 transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -3 page level encryption AAAAAAAAAAAAAAAAAAAA -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt WHERE MATCH c2 AGAINST ('tablespace'); -c1 c2 right(c3, 20) -1 transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt WHERE MATCH c2 AGAINST ('tablespace' IN BOOLEAN MODE); -c1 c2 right(c3, 20) -1 transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt WHERE MATCH c2 AGAINST ('+tablespace -encryption' IN BOOLEAN MODE); -c1 c2 right(c3, 20) -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -ALTER TABLE tde_db.t_encrypt DROP INDEX idx1; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -1 transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -3 page level encryption AAAAAAAAAAAAAAAAAAAA -ALTER TABLE tde_db.t_encrypt ADD COLUMN c4 CHAR(20) DEFAULT 'text'; -SELECT c1,c2,right(c3, 20),c4 FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) c4 -1 transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA text -2 general tablespace option AAAAAAAAAAAAAAAAAAAA text -3 page level encryption AAAAAAAAAAAAAAAAAAAA text -CREATE VIEW tde_db.t_encrypt_view AS SELECT c1,c2 FROM tde_db.t_encrypt; -SELECT c2 FROM tde_db.t_encrypt_view LIMIT 10; -c2 -transparanet tablespace encryption -general tablespace option -page level encryption -SELECT A.c2,B.c2,right(B.c3,20) FROM tde_db.t_encrypt_view A , tde_db.t_encrypt B WHERE A.c2 = B.c2; -c2 c2 right(B.c3,20) -transparanet tablespace encryption transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA -general tablespace option general tablespace option AAAAAAAAAAAAAAAAAAAA -page level encryption page level encryption AAAAAAAAAAAAAAAAAAAA -DROP VIEW tde_db.t_encrypt_view; -SELECT c11,c22,right(c33, 20) FROM tde_db.t_encrypt1 LIMIT 10; -c11 c22 right(c33, 20) --1 transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA --2 general tablespace option AAAAAAAAAAAAAAAAAAAA --3 page level encryption AAAAAAAAAAAAAAAAAAAA -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(2,"general tablespace option"); -ERROR 23000: Duplicate entry '2' for key 't_encrypt2.PRIMARY' -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(8,"general tablespace option"); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`tde_db`.`t_encrypt2`, CONSTRAINT `t_encrypt2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t_encrypt` (`c1`) ON UPDATE CASCADE) -SELECT f1,f2 FROM tde_db.t_encrypt2; -f1 f2 -1 transparanet tablespace encryption -2 general tablespace option -UPDATE tde_db.t_encrypt SET c1=10 WHERE c1=1; -SELECT f1,f2 FROM tde_db.t_encrypt2; -f1 f2 -2 general tablespace option -10 transparanet tablespace encryption -DROP DATABASE tde_db; -SET GLOBAL innodb_file_per_table=1; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt (c2 INT NOT NULL AUTO_INCREMENT ,c3 VARCHAR(255), c4 JSON ,c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED,c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL,c7 POINT NOT NULL SRID 0,spatial INDEX idx2 (c7) , PRIMARY KEY (c2,c3(100))) ENCRYPTION="Y" ENGINE=InnoDB; -CREATE PROCEDURE tde_db.txn_t_encrypt() -BEGIN -declare i int default 0; -declare rowcnt int default 0; -START TRANSACTION; -WHILE (i <= 2000) DO -SET i = i + 1; -SET rowcnt = rowcnt + 1; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) VALUES (CONCAT(REPEAT('a',10),REPEAT(i,10)),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -IF (rowcnt = 3) THEN -UPDATE tde_db.t_encrypt SET c4 = '{ "key_a": 21, "key_b": 22, "key_c": 23 }' WHERE c2 = i-1 ; -DELETE FROM tde_db.t_encrypt WHERE c2 = i; -SAVEPOINT A; -END IF; -IF (rowcnt = 5) THEN -UPDATE tde_db.t_encrypt SET c4 = '{ "key_a": 41, "key_b": 42, "key_c": 43 }' WHERE c2 = i-1 ; -DELETE FROM tde_db.t_encrypt WHERE c2 = i; -SAVEPOINT B; -END IF; -IF (rowcnt = 10) THEN -ROLLBACK TO SAVEPOINT A; -COMMIT; -SET rowcnt = 0; -START TRANSACTION; -END IF; -END WHILE; -COMMIT; -end| -call tde_db.txn_t_encrypt(); -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -401 -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt LIMIT 10; -c2 RIGHT(c3,20) c4 -1 aaaaaaaaaa1111111111 {"key_a": 1, "key_b": 2, "key_c": 3} -2 aaaaaaaaaa2222222222 {"key_a": 21, "key_b": 22, "key_c": 23} -11 11111111111111111111 {"key_a": 1, "key_b": 2, "key_c": 3} -12 12121212121212121212 {"key_a": 21, "key_b": 22, "key_c": 23} -21 21212121212121212121 {"key_a": 1, "key_b": 2, "key_c": 3} -22 22222222222222222222 {"key_a": 21, "key_b": 22, "key_c": 23} -31 31313131313131313131 {"key_a": 1, "key_b": 2, "key_c": 3} -32 32323232323232323232 {"key_a": 21, "key_b": 22, "key_c": 23} -41 41414141414141414141 {"key_a": 1, "key_b": 2, "key_c": 3} -42 42424242424242424242 {"key_a": 21, "key_b": 22, "key_c": 23} -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt WHERE c2 > 500 AND c2 < 600; -c2 RIGHT(c3,20) c4 -501 01501501501501501501 {"key_a": 1, "key_b": 2, "key_c": 3} -502 02502502502502502502 {"key_a": 21, "key_b": 22, "key_c": 23} -511 11511511511511511511 {"key_a": 1, "key_b": 2, "key_c": 3} -512 12512512512512512512 {"key_a": 21, "key_b": 22, "key_c": 23} -521 21521521521521521521 {"key_a": 1, "key_b": 2, "key_c": 3} -522 22522522522522522522 {"key_a": 21, "key_b": 22, "key_c": 23} -531 31531531531531531531 {"key_a": 1, "key_b": 2, "key_c": 3} -532 32532532532532532532 {"key_a": 21, "key_b": 22, "key_c": 23} -541 41541541541541541541 {"key_a": 1, "key_b": 2, "key_c": 3} -542 42542542542542542542 {"key_a": 21, "key_b": 22, "key_c": 23} -551 51551551551551551551 {"key_a": 1, "key_b": 2, "key_c": 3} -552 52552552552552552552 {"key_a": 21, "key_b": 22, "key_c": 23} -561 61561561561561561561 {"key_a": 1, "key_b": 2, "key_c": 3} -562 62562562562562562562 {"key_a": 21, "key_b": 22, "key_c": 23} -571 71571571571571571571 {"key_a": 1, "key_b": 2, "key_c": 3} -572 72572572572572572572 {"key_a": 21, "key_b": 22, "key_c": 23} -581 81581581581581581581 {"key_a": 1, "key_b": 2, "key_c": 3} -582 82582582582582582582 {"key_a": 21, "key_b": 22, "key_c": 23} -591 91591591591591591591 {"key_a": 1, "key_b": 2, "key_c": 3} -592 92592592592592592592 {"key_a": 21, "key_b": 22, "key_c": 23} -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt ORDER BY c2 DESC LIMIT 10; -c2 RIGHT(c3,20) c4 -2001 20012001200120012001 {"key_a": 1, "key_b": 2, "key_c": 3} -1992 19921992199219921992 {"key_a": 21, "key_b": 22, "key_c": 23} -1991 19911991199119911991 {"key_a": 1, "key_b": 2, "key_c": 3} -1982 19821982198219821982 {"key_a": 21, "key_b": 22, "key_c": 23} -1981 19811981198119811981 {"key_a": 1, "key_b": 2, "key_c": 3} -1972 19721972197219721972 {"key_a": 21, "key_b": 22, "key_c": 23} -1971 19711971197119711971 {"key_a": 1, "key_b": 2, "key_c": 3} -1962 19621962196219621962 {"key_a": 21, "key_b": 22, "key_c": 23} -1961 19611961196119611961 {"key_a": 1, "key_b": 2, "key_c": 3} -1952 19521952195219521952 {"key_a": 21, "key_b": 22, "key_c": 23} -# Starting server with keyring -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -401 -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt LIMIT 10; -c2 RIGHT(c3,20) c4 -1 aaaaaaaaaa1111111111 {"key_a": 1, "key_b": 2, "key_c": 3} -2 aaaaaaaaaa2222222222 {"key_a": 21, "key_b": 22, "key_c": 23} -11 11111111111111111111 {"key_a": 1, "key_b": 2, "key_c": 3} -12 12121212121212121212 {"key_a": 21, "key_b": 22, "key_c": 23} -21 21212121212121212121 {"key_a": 1, "key_b": 2, "key_c": 3} -22 22222222222222222222 {"key_a": 21, "key_b": 22, "key_c": 23} -31 31313131313131313131 {"key_a": 1, "key_b": 2, "key_c": 3} -32 32323232323232323232 {"key_a": 21, "key_b": 22, "key_c": 23} -41 41414141414141414141 {"key_a": 1, "key_b": 2, "key_c": 3} -42 42424242424242424242 {"key_a": 21, "key_b": 22, "key_c": 23} -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt WHERE c2 > 500 AND c2 < 600; -c2 RIGHT(c3,20) c4 -501 01501501501501501501 {"key_a": 1, "key_b": 2, "key_c": 3} -502 02502502502502502502 {"key_a": 21, "key_b": 22, "key_c": 23} -511 11511511511511511511 {"key_a": 1, "key_b": 2, "key_c": 3} -512 12512512512512512512 {"key_a": 21, "key_b": 22, "key_c": 23} -521 21521521521521521521 {"key_a": 1, "key_b": 2, "key_c": 3} -522 22522522522522522522 {"key_a": 21, "key_b": 22, "key_c": 23} -531 31531531531531531531 {"key_a": 1, "key_b": 2, "key_c": 3} -532 32532532532532532532 {"key_a": 21, "key_b": 22, "key_c": 23} -541 41541541541541541541 {"key_a": 1, "key_b": 2, "key_c": 3} -542 42542542542542542542 {"key_a": 21, "key_b": 22, "key_c": 23} -551 51551551551551551551 {"key_a": 1, "key_b": 2, "key_c": 3} -552 52552552552552552552 {"key_a": 21, "key_b": 22, "key_c": 23} -561 61561561561561561561 {"key_a": 1, "key_b": 2, "key_c": 3} -562 62562562562562562562 {"key_a": 21, "key_b": 22, "key_c": 23} -571 71571571571571571571 {"key_a": 1, "key_b": 2, "key_c": 3} -572 72572572572572572572 {"key_a": 21, "key_b": 22, "key_c": 23} -581 81581581581581581581 {"key_a": 1, "key_b": 2, "key_c": 3} -582 82582582582582582582 {"key_a": 21, "key_b": 22, "key_c": 23} -591 91591591591591591591 {"key_a": 1, "key_b": 2, "key_c": 3} -592 92592592592592592592 {"key_a": 21, "key_b": 22, "key_c": 23} -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt ORDER BY c2 DESC LIMIT 10; -c2 RIGHT(c3,20) c4 -2001 20012001200120012001 {"key_a": 1, "key_b": 2, "key_c": 3} -1992 19921992199219921992 {"key_a": 21, "key_b": 22, "key_c": 23} -1991 19911991199119911991 {"key_a": 1, "key_b": 2, "key_c": 3} -1982 19821982198219821982 {"key_a": 21, "key_b": 22, "key_c": 23} -1981 19811981198119811981 {"key_a": 1, "key_b": 2, "key_c": 3} -1972 19721972197219721972 {"key_a": 21, "key_b": 22, "key_c": 23} -1971 19711971197119711971 {"key_a": 1, "key_b": 2, "key_c": 3} -1962 19621962196219621962 {"key_a": 21, "key_b": 22, "key_c": 23} -1961 19611961196119611961 {"key_a": 1, "key_b": 2, "key_c": 3} -1952 19521952195219521952 {"key_a": 21, "key_b": 22, "key_c": 23} -DROP DATABASE tde_db; -# Global privilege ENCRYPTION_KEY_ADMIN can replace super. -USE test; -CREATE USER encryption_admin@localhost IDENTIFIED BY 'foo'; -GRANT ENCRYPTION_KEY_ADMIN, CREATE ON *.* TO encryption_admin@localhost; -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -REVOKE ENCRYPTION_KEY_ADMIN ON *.* FROM encryption_admin@localhost; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR 42000: Access denied; you need (at least one of) the SUPER or ENCRYPTION_KEY_ADMIN privilege(s) for this operation -DROP USER encryption_admin@localhost; -DROP TABLE t1; -SET GLOBAL innodb_file_per_table=1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.test b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.test deleted file mode 100644 index 2e1c4a6acc4d..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc -# InnoDB transparent tablespace data encryption -# This test case will test basic encryption support features. - ---source include/no_valgrind_without_big.inc ---source include/have_innodb_max_16k.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/table_encrypt_3.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_4.result b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_4.result deleted file mode 100644 index a7d0657ceb1d..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_4.result +++ /dev/null @@ -1,165 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -DROP TABLE IF EXISTS t1; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -# Create a table with encryption -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -# Test export/import encrypted tablespace. -FLUSH TABLES test.t1 FOR EXPORT; -UNLOCK TABLES; -ALTER TABLE test.t1 DISCARD TABLESPACE; -ALTER TABLE test.t1 IMPORT TABLESPACE; -CHECK TABLE test.t1; -Table Op Msg_type Msg_text -test.t1 check status OK -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -SELECT * FROM test.t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -SELECT * FROM test.t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER TABLE test.t1 DISCARD TABLESPACE; -# Try import in another session. -ALTER TABLE test.t1 IMPORT TABLESPACE; -SELECT * FROM test.t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER TABLE test.t1 DISCARD TABLESPACE; -# Import without .cfg file is posible -# copying .cfp and .ibd file -ALTER TABLE test.t1 IMPORT TABLESPACE; -Warnings: -Warning 1810 InnoDB: IO Read error: (2, No such file or directory) Error opening './test/t1.cfg', will attempt to import without schema verification -SELECT * FROM test.t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT * FROM test.t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER TABLE test.t1 DISCARD TABLESPACE; -# Import without .cfp file -# copying .cfg and .ibd file -ALTER TABLE test.t1 IMPORT TABLESPACE; -ERROR HY000: Schema mismatch (Table is in an encrypted tablespace, but the encryption meta-data file cannot be found while importing.) -ALTER INSTANCE ROTATE INNODB MASTER KEY; -# Import without .idb file -# copying .cfp and .cfg file -ALTER TABLE test.t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Tablespace not found -ALTER INSTANCE ROTATE INNODB MASTER KEY; -# Schema mismatch dest table without encryption - fix result -DROP TABLE t1; -CREATE TABLE test.t1(c1 INT, c2 char(20)) ENGINE = InnoDB; -ALTER TABLE test.t1 DISCARD TABLESPACE; -ALTER TABLE test.t1 IMPORT TABLESPACE; -ERROR HY000: Schema mismatch (Encryption attribute in the file does not match the dictionary.) -# Import got expected error. -DROP TABLE t1; -CREATE TABLE test.t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ALTER TABLE test.t1 DISCARD TABLESPACE; -SET SESSION DEBUG="+d, fsp_header_rotate_encryption_failure"; -ALTER TABLE test.t1 IMPORT TABLESPACE; -ERROR HY000: Got error 168 - 'Unknown (generic) error from engine' from storage engine -Warnings: -Note 1051 Unknown table 'test.t1' -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_4.test b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_4.test deleted file mode 100644 index a39cc24d8b6d..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_4.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc -# InnoDB transparent tablespace data encryption -# This test case will test export/import encrypted tablespace. - ---source include/no_valgrind_without_big.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/table_encrypt_4.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_6.result b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_6.result deleted file mode 100644 index d1d9c3ae9c02..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_6.result +++ /dev/null @@ -1,74 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Taking backup of local manifest file for MySQL server instance -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB; -ALTER TABLE t1 ENCRYPTION="Y", algorithm=copy; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -DROP TABLE t1; -# Restore local manifest file for MySQL server instance from backup -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -# Restore local manifest file for MySQL server instance from backup -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -DROP TABLE t1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_6.test b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_6.test deleted file mode 100644 index e7c2c57ffc08..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_6.test +++ /dev/null @@ -1,11 +0,0 @@ ---source include/have_component_keyring_kmip.inc -# Test negative scenarios, lifted from other innodb/table_encrypt tests -# -# Create a table with encryption, should fail since keyring is not -# loaded - ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/table_encrypt_6.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_debug.result b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_debug.result deleted file mode 100644 index a702f440db19..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_debug.result +++ /dev/null @@ -1,220 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -# -# Set encryption ON for table `mysql` -# -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -SET debug='-d,skip_dd_table_access_check'; -# -# Test crash point `ib_crash_during_rotation_for_encryption` -# -SET SESSION DEBUG="+d,ib_encryption_rotate_crash"; -CREATE TABLE tde_db.t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -tde_db/t1 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -SHOW CREATE TABLE tde_db.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO tde_db.t1 VALUES(0, "aaaaa"); -INSERT INTO tde_db.t1 VALUES(1, "bbbbb"); -INSERT INTO tde_db.t1 VALUES(2, "ccccc"); -INSERT INTO tde_db.t1 VALUES(3, "ddddd"); -# Execute the statement that causes the crash -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR HY000: Lost connection to MySQL server during query -SET SESSION DEBUG="-d,ib_encryption_rotate_crash"; -Pattern "ib_encryption_rotate_crash" found -# Show that encryption is OK -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -tde_db/t1 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -INSERT INTO tde_db.t1 VALUES(4, "eeeee"); -SELECT * FROM tde_db.t1 ORDER BY c1; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -# Create a second table with encryption -CREATE TABLE tde_db.t2(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE tde_db.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -tde_db/t1 autoextend_size=0;encryption=Y; -tde_db/t2 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -INSERT INTO tde_db.t2 VALUES(0, "aaaaa"); -INSERT INTO tde_db.t2 VALUES(1, "bbbbb"); -# Remove the current auto.cnf file to make sure a new server uuid is -# generated at restart. -# Execute the statement that causes the crash -SET SESSION DEBUG="+d,ib_encryption_rotate_crash"; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR HY000: Lost connection to MySQL server during query -SET SESSION DEBUG="-d,ib_encryption_rotate_crash"; -Pattern "ib_encryption_rotate_crash" found -# Show that encryption is OK -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -tde_db/t1 autoextend_size=0;encryption=Y; -tde_db/t2 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -INSERT INTO tde_db.t1 VALUES(5, "fffff"); -SELECT * FROM tde_db.t1 ORDER BY c1; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -SELECT * FROM tde_db.t2 ORDER BY c1; -c1 c2 -0 aaaaa -1 bbbbb -# Rotate Encryption again without the Crash -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT * FROM tde_db.t1 ORDER BY c1 ; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -# Show that encryption is OK -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -tde_db/t1 autoextend_size=0;encryption=Y; -tde_db/t2 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -SELECT * FROM tde_db.t1 ORDER BY c1 ; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -SELECT * FROM tde_db.t2 ORDER BY c1 ; -c1 c2 -0 aaaaa -1 bbbbb -DROP TABLE tde_db.t2; -ALTER TABLESPACE mysql ENCRYPTION='N'; -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -tde_db/t1 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -# -# Test crash point `ib_crash_during_create_for_encryption` during a CREATE TABLE -# -SET SESSION DEBUG="+d,ib_crash_during_create_for_encryption"; -# Execute the statement that causes the crash -CREATE TABLE tde_db.t2(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Lost connection to MySQL server during query -SET SESSION DEBUG="-d,ib_crash_during_create_for_encryption"; -# Show encrypted tables. -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -tde_db/t1 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -SELECT * FROM tde_db.t1 ORDER BY c1 LIMIT 5; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -INSERT INTO tde_db.t1 VALUES(6, "ggggg"); -SELECT * FROM tde_db.t1 ORDER BY c1 ; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -SELECT * FROM tde_db.t2; -ERROR 42S02: Table 'tde_db.t2' doesn't exist -# -# Test crash point `ib_crash_during_decrypt_page` during an IMPORT TABLESPACE -# -FLUSH TABLE tde_db.t1 FOR EXPORT; -UNLOCK TABLES; -ALTER TABLE tde_db.t1 DISCARD TABLESPACE; -SET SESSION DEBUG="+d,ib_crash_during_decrypt_page"; -# Execute the statement that causes the crash -ALTER TABLE tde_db.t1 IMPORT TABLESPACE; -ERROR HY000: Lost connection to MySQL server during query -SET SESSION DEBUG="-d,ib_crash_during_decrypt_page"; -INSERT INTO tde_db.t1 VALUES(7, "hhhhh"); -ERROR HY000: Tablespace has been discarded for table 't1' -SELECT * FROM tde_db.t1 ORDER BY c1 ; -ERROR HY000: Tablespace has been discarded for table 't1' -DROP TABLE tde_db.t1; -DROP DATABASE tde_db; -# -# Bug #27307740 [ERROR] [MY-011066] INNODB: CORRUPT LOG RECORD FOUND -# DURING CRASH RECOVERY -# -CREATE DATABASE tde_db; -CREATE TABLE tde_db.test_tbl(c1 int) ENCRYPTION="Y" ENGINE=InnoDB; -SET SESSION DEBUG="+d, keyring_generate_fail"; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR HY000: Lost connection to MySQL server during query -SET SESSION debug="-d, keyring_generate_fail"; -SELECT COUNT(*) FROM tde_db.test_tbl; -COUNT(*) -0 -DROP TABLE tde_db.test_tbl; -DROP DATABASE tde_db; -SET GLOBAL innodb_file_per_table=1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_debug.test b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_debug.test deleted file mode 100644 index 603e11d8eb26..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_debug.test +++ /dev/null @@ -1,20 +0,0 @@ ---source include/have_component_keyring_kmip.inc -#------------------------------------------------------------------------------ -# InnoDB transparent tablespace data encryption -# This test case will test basic recovery from known DBUG_SUICIDE point . -# - ib_crash_during_rotation_for_encryption (assert during key rotation) -# - ib_crash_during_create_for_encryption (assert during create) -# - ib_crash_during_decrypt_page (assert during page decryption) -#------------------------------------------------------------------------------ - - --source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc -# Avoid CrashReporter popup on Mac ---source include/not_crashrep.inc -# innodb-force-recovery-crash needs debug ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/table_encrypt_debug.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_fts.result b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_fts.result deleted file mode 100644 index f68ba50dceea..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_fts.result +++ /dev/null @@ -1,57 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# Bug#30787535 : FULLTEXT INDEX TABLES CREATED IN ENCRYPTED SCHEMA ARE NOT ENCRYPTED -# -######### -# SETUP # -######### - -######################################################################### -# 1 : WITH KEYRING -######################################################################### -# Create a new 'unencrypted' table -CREATE TABLE t1 (id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -C1 TEXT(500), -C2 VARCHAR(200), -C3 VARCHAR(200)) ENCRYPTION='N' ENGINE=InnoDB; -set global innodb_buf_flush_list_now = 1; -# --------------------------------------------------------------- -# Test 1 : t1 un-encrypted, FTS tables should also be unencrypted -# --------------------------------------------------------------- -# Check that tablespace file is not encrypted -# Print result -table space is Unencrypted. -CREATE FULLTEXT INDEX idx ON t1(C1); -Warnings: -Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID -set global innodb_buf_flush_list_now = 1; -# Check that FTS tablespaces file is not encrypted -# Print result -table space is Unencrypted. -# --------------------------------------------------------------- -# Test 1 : t1 encrypted, FTS tables should also be unencrypted -# --------------------------------------------------------------- -ALTER TABLE t1 ENCRYPTION='Y'; -# Check that tablespace file is encrypted now -# Print result -table space is Encrypted. -# Check that FTS tablespace file is encrypted now -# Print result -table space is Encrypted. -########### -# CLEANUP # -########### -DROP TABLE test.t1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_fts.test b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_fts.test deleted file mode 100644 index a880ffd4133f..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_fts.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc -# Waiting time when (re)starting the server ---let $explicit_default_wait_counter=10000; - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/table_encrypt_fts.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_kill-master.opt b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_kill-master.opt deleted file mode 100644 index f4f26850b8a3..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_kill-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_buffer_pool_size=256M diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_kill.result b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_kill.result deleted file mode 100644 index 4c410a88fe12..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_kill.result +++ /dev/null @@ -1,210 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -DROP DATABASE IF EXISTS tde_db; -DROP TABLE IF EXISTS tde_db. t_encrypt; -CREATE DATABASE tde_db; -USE tde_db; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt(c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON, -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE TABLE tde_db.t_non_encrypt(c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON, -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENGINE = InnoDB; -CREATE PROCEDURE tde_db.populate_t_encrypt() -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 5000) DO -insert into tde_db.t_encrypt(c2,c3,c4,c7) VALUES(i,CONCAT(REPEAT('a',200),LPAD(CAST(i AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.populate_t_non_encrypt() -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 5000) DO -insert into tde_db.t_non_encrypt(c2,c3,c4,c7) VALUES(i,CONCAT(REPEAT('a',200),LPAD(CAST(i AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.update_t_encrypt() -begin -declare i int default 1; -declare ustr varchar(1000); -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 5000) DO -SET @sql_text = CONCAT (' UPDATE tde_db.t_encrypt SET c3 =', 'CONCAT(REPEAT(a,200),LPAD(CAST(',i, 'AS CHAR),4,0) ORDER BY RAND() LIMIT 1'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.delete_t_encrypt() -begin -declare i int default 1; -declare ustr varchar(1000); -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 5000) DO -SET @sql_text = CONCAT (' DELETE FROM tde_db.t_encrypt LIMIT 1'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.read_t_encrypt() -begin -declare i int default 1; -while (i <= 5000) DO -SELECT * FROM (SELECT * FROM tde_db.t_encrypt ORDER BY RAND() LIMIT 1) AS A WHERE A.c2 < 0 ; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.alter_t_encrypt() -begin -declare i int default 1; -declare has_error int default 0; -while (i <= 5000) DO -ALTER INSTANCE ROTATE INNODB MASTER KEY; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.create_t_encrypt(encrypt VARCHAR(5), tcnt INT) -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1050 SET has_error = 1; -SET i = tcnt ; -while (i <= 5000) DO -SET @sql_text = CONCAT('CREATE TABLE ',CONCAT('tde_db.t_encrypt_',encrypt,'_',i),' (c1 INT) ENCRYPTION="',encrypt,'"',' ENGINE=InnoDB'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -set i = i + 1; -end while; -end| -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` char(255) DEFAULT 'No text', - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -# Case1: insert on encrypt and non encrypt table in parallel during kill -# In connection con1 - Running insert on encrypt table -call tde_db.populate_t_encrypt(); -# In connection con2 - Running insert on encrypt table -call tde_db.populate_t_encrypt(); -# In connection con3 - Running insert into non encrypt table -call tde_db.populate_t_non_encrypt(); -# kill and restart the server -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -INSERT INTO tde_db.t_encrypt(c2,c3,c4,c7) VALUES(10000,CONCAT(REPEAT('a',200),LPAD(CAST(1 AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_non_encrypt LIMIT 10; -INSERT INTO tde_db.t_non_encrypt(c2,c3,c4,c7) VALUES(10000,CONCAT(REPEAT('a',200),LPAD(CAST(1 AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT 1; -1 -1 -# Case2: insert/update/delete on encrypt in parallel during kill -DROP TABLE tde_db.t_encrypt; -DROP TABLE tde_db.t_non_encrypt; -CREATE TABLE tde_db.t_encrypt(c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON, -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE TABLE tde_db.t_non_encrypt(c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON, -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENGINE = InnoDB; -# In connection con1 - Running insert on encrypt table -call tde_db.populate_t_encrypt(); -# In connection con2 - Running update on encrypt table -call tde_db.update_t_encrypt(); -# In connection con3 - Running delete on encrypt table -call tde_db.delete_t_encrypt(); -# kill and restart the server -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -INSERT INTO tde_db.t_encrypt(c2,c3,c4,c7) VALUES(10000,CONCAT(REPEAT('a',200),LPAD(CAST(1 AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_non_encrypt LIMIT 10; -INSERT INTO tde_db.t_non_encrypt(c2,c3,c4,c7) VALUES(10000,CONCAT(REPEAT('a',200),LPAD(CAST(1 AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT 1; -1 -1 -# Case3: select,create and insert on encrypt in parallel during kill -DROP TABLE tde_db.t_encrypt; -DROP TABLE tde_db.t_non_encrypt; -CREATE TABLE tde_db.t_encrypt(c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON, -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE TABLE tde_db.t_non_encrypt(c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON, -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENGINE = InnoDB; -# In connection con1 - Running insert on encrypt table -call tde_db.populate_t_encrypt(); -# In connection con2 - Running select on encrypt table -call tde_db.read_t_encrypt(); -# kill and restart the server -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -INSERT INTO tde_db.t_encrypt(c2,c3,c4,c7) VALUES(10000,CONCAT(REPEAT('a',200),LPAD(CAST(1 AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_non_encrypt LIMIT 10; -INSERT INTO tde_db.t_non_encrypt(c2,c3,c4,c7) VALUES(10000,CONCAT(REPEAT('a',200),LPAD(CAST(1 AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT 1; -1 -1 -DROP DATABASE tde_db; -SET GLOBAL innodb_file_per_table=1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_kill.test b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_kill.test deleted file mode 100644 index 7f3c6ef0046d..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_kill.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/no_valgrind_without_big.inc ---source include/big_test.inc -# Avoid CrashReporter popup on Mac ---source include/not_crashrep.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/table_encrypt_kill.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace.result b/mysql-test/suite/component_keyring_kmip/t/tablespace.result deleted file mode 100644 index ccc8350fa845..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace.result +++ /dev/null @@ -1,693 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# Pre-define user u1, which is used in different tests below. -CREATE USER u1@localhost; -GRANT ALL ON db1.* 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'; -# This test run CREATE/ALTER TABLESPACE in different configurations, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting default_table_encryption to true/false. -# - With and without ENCRYPTION clause. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - Test INFORMATION_SCHEMA.INNODB_TABLESPACES -# - Check for warnings generated. -# -````````````````````````````````````````````````````````` -# CREATE TABLESPACE with explicit ENCRYPTION clause -# table_encryption_privilege_check=false -# [CREATE TABLESPACE] Case 1 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 2 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -# [CREATE TABLESPACE] Case 3 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 4 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# CREATE TABLESPACE with explicit ENCRYPTION clause -# table_encryption_privilege_check=false -# [CREATE TABLESPACE] Case 5 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 6 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 7 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 8 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -# [CREATE TABLESPACE] Case 9 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SHOW WARNINGS; -ERROR HY000: Tablespace encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 10 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 11 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 12 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SHOW WARNINGS; -ERROR HY000: Tablespace encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Check for invalid ENCRYPTION clause value. -# [CREATE TABLESPACE] Case 13 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='k'; -SHOW WARNINGS; -ERROR HY000: Invalid encryption option. -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# The test cases run ALTER TABLESPACE (with no tables) -# See test tablespace_with_tables.test. -````````````````````````````````````````````````````````` -# Unencrypted TABLESPACE to Unencrypted TABLESPACE (Nop) -# -# [ALTER TABLESPACE] Case 1 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER TABLESPACE] Case 2 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Encrypted TABLESPACE to Encrypted TABLESPACE (Nop) -# -# [ALTER TABLESPACE] Case 3 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=true; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER TABLESPACE] Case 4 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=true; -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Unencrypted TABLESPACE to encrypted TABLESPACE -# with database encryption default 'n' -# -# [ALTER TABLESPACE] Case 5 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER TABLESPACE] Case 6 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -ERROR HY000: Tablespace encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3828 Tablespace encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Unencrypted TABLESPACE to encrypted TABLESPACE -# with database encryption default 'y' -# -# [ALTER TABLESPACE] Case 7 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET SESSION default_table_encryption=true; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER TABLESPACE] Case 8 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET SESSION default_table_encryption=true; -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Encrypted TABLESPACE to unencrypted TABLESPACE -# with database encryption default 'n' -# -# [ALTER TABLESPACE] Case 9 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER TABLESPACE] Case 10 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Encrypted TABLESPACE to unencrypted TABLESPACE -# with database encryption default 'y' -# -# [ALTER TABLESPACE] Case 11 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=true; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER TABLESPACE] Case 12 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=true; -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -ERROR HY000: Tablespace encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3828 Tablespace encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Check for Invalid encryption option. -# [ALTER TABLESPACE] Case 13 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='k'; -ERROR HY000: Invalid encryption option. -SHOW WARNINGS; -Level Code Message -Error 3184 Invalid encryption option. -Error 1533 Failed to alter: TABLESPACE ts1 -Error 1030 Got error 168 - 'Unknown (generic) error from engine' from storage engine -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# Cleanup -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace.test b/mysql-test/suite/component_keyring_kmip/t/tablespace.test deleted file mode 100644 index 98ef123d80e0..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/tablespace.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_1-master.opt b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_1-master.opt deleted file mode 100644 index 5df3ea9cdec1..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_1-master.opt +++ /dev/null @@ -1 +0,0 @@ ---initialize --innodb_page_size=16k diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_1.result b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_1.result deleted file mode 100644 index 3911e9470e0b..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_1.result +++ /dev/null @@ -1,1046 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# START : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB; -ALTER TABLESPACE encrypt_ts ENCRYPTION="Y"; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -DROP TABLESPACE encrypt_ts; -######################################################################### -# RESTART 1 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -DROP TABLE IF EXISTS t1; ---------------------------- -SYSTEM TABLESPACE ---------------------------- -CREATE TABLE t1(c int) ENCRYPTION="Y" tablespace innodb_system ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL innodb_file_per_table = 0; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -0 -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="N" ENGINE = InnoDB; -SHOW WARNINGS; -Level Code Message -DROP TABLE t1; -CREATE TABLE t1(c int) ENCRYPTION="Y" tablespace innodb_system ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -CREATE TABLE t1(c int) ENCRYPTION="N" tablespace innodb_system ENGINE = InnoDB; -SHOW WARNINGS; -Level Code Message -DROP TABLE t1; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -ALTER TABLESPACE innodb_system ENCRYPTION='Y'; -ERROR 42000: InnoDB: `innodb_system` is a reserved tablespace name. ---------------------------- -TEMPORARY TABLESPACE ---------------------------- -CREATE TEMPORARY TABLE t1(c int) ENCRYPTION="Y"; -ERROR HY000: InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -Error 1031 Table storage engine for 't1' doesn't have this option -CREATE TEMPORARY TABLE t1(c int) ENCRYPTION="N"; -ERROR HY000: InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -Error 1031 Table storage engine for 't1' doesn't have this option ------------------------------------------------- -CREATE TABLESPACE WITH INVALID ENCRYPTION OPTION ------------------------------------------------- -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='R'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=y; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'y' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=Y; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Y' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=n; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'n' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=N; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'N' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=0; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=null; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='TRUE'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=TRUE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRUE' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=True; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'True' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='True'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='true'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=true; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'true' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=FALSE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FALSE' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='FALSE'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=False; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'False' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='False'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=false; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'false' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='false'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=-1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=''; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=""; -ERROR HY000: Invalid encryption option. ----------------------------------------------------- -CREATE ENCRYPTED TABLESPACE IN MyISAM STORAGE ENGINE ----------------------------------------------------- -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=MyISAM encryption='Y'; -ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=MyISAM encryption='y'; -ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=MyISAM encryption='N'; -ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=MyISAM encryption='n'; -ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' ----------------------------------------------------- -CREATE ENCRYPTED TABLESPACE IN MEMORY STORAGE ENGINE ----------------------------------------------------- -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=Memory encryption='Y'; -ERROR HY000: Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=Memory encryption='y'; -ERROR HY000: Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=Memory encryption='N'; -ERROR HY000: Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=Memory encryption='n'; -ERROR HY000: Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' ----------------------------------------------- -CREATE TABLESPACE WITH VALID ENCRYPTION OPTION ----------------------------------------------- -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption="y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption="n"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N ------------------------------------------------ -ALTER TABLESPACE WITH INVALID ENCRYPTION OPTION ------------------------------------------------ -ALTER TABLESPACE encrypt_ts ENCRYPTION='R'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=0; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=TRUE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRUE' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION='TRUE'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=True; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'True' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION='True'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=true; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'true' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION='true'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=FALSE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FALSE' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION='FALSE'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=False; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'False' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION='False'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=false; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'false' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION='false'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=null; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=n; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'n' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=N; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'N' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=y; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'y' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=N; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'N' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=-1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=''; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=""; -ERROR HY000: Invalid encryption option. ---------------------------------------------- -ALTER TABLESPACE WITH VALID ENCRYPTION OPTION ---------------------------------------------- -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="n"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="n"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="n"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="n"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N ------------------------------------------ -CREATE/ALTER TABLE in FILE-PER-TABLE TABLESPACE ------------------------------------------ -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 Y -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -ALTER TABLE t1 encryption="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 N -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="N" ENGINE = InnoDB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 N -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 encryption="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 Y -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE=innodb_file_per_table ENCRYPTION="Y" ENGINE = InnoDB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 Y -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -ALTER TABLE t1 encryption="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 N -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE=innodb_file_per_table ENCRYPTION="N" ENGINE = InnoDB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 N -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 encryption="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 Y -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE=encrypt_ts ENGINE = InnoDB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE=encrypt_ts ENCRYPTION='Y' ENGINE = InnoDB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; --------------------------- -CREATE/ALTER TABLE IN GENERAL TABLESPACE --------------------------- -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION="Y" ENGINE = InnoDB; -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION="N" ENGINE = InnoDB; -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'unencrypted' table while using an 'encrypted' tablespace. -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION="R" ENGINE = InnoDB; -ERROR HY000: Invalid encryption option. -SHOW WARNINGS; -Level Code Message -Error 3184 Invalid encryption option. -Error 1031 Table storage engine for 't1' doesn't have this option -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION='Y' ENGINE = InnoDB; -ALTER TABLE t1 encryption='Y'; -ALTER TABLE t1 encryption='N'; -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -ALTER TABLE t1 encryption='R'; -ERROR HY000: Invalid encryption option. -DROP TABLE t1; -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION="N" ENGINE = InnoDB; -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION="R" ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENGINE = InnoDB; -ALTER TABLE t1 encryption='Y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE t1 encryption='N'; -ALTER TABLE t1 encryption='R'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP TABLE t1; -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -######################################################################### -# RESTART 2 : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 3 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -SET GLOBAL innodb_file_per_table=1; -DROP TABLE t1; -CREATE TABLE t1(c2 char(100) , FULLTEXT INDEX `idx1` (c2)) ENGINE=InnoDB -tablespace=encrypt_ts ENCRYPTION='Y'; -ALTER TABLE t1 DROP INDEX idx1; -ALTER TABLE t1 ADD COLUMN c4 CHAR(20); -DROP TABLE t1; ----------------------- -ALGORITHM=COPY/INPLACE ----------------------- -ALTER TABLESPACE encrypt_ts ENCRYPTION="N", algorithm=copy; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'algorithm=copy' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION="N", algorithm=inplace; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'algorithm=inplace' at line 1 -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENCRYPTION="N", algorithm=copy; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'algorithm=copy' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENCRYPTION="N", algorithm=inplace; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'algorithm=inplace' at line 1 ------------ -COMPRESSION ------------ -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' COMPRESSION = "ZLIB" ENCRYPTION = "Y" ENGINE = InnoDB; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COMPRESSION = "ZLIB" ENCRYPTION = "Y" ENGINE = InnoDB' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENCRYPTION = "Y" ENGINE = InnoDB; -ALTER TABLESPACE encrypt_ts COMPRESSION = "ZLIB"; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COMPRESSION = "ZLIB"' at line 1 -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encryt_ts_1k ADD DATAFILE 'encrypt_ts_1k.ibd' FILE_BLOCK_SIZE=1k ENCRYPTION='Y'; -CREATE TABLESPACE encryt_ts_2k ADD DATAFILE 'encrypt_ts_2k.ibd' FILE_BLOCK_SIZE=2k ENCRYPTION='Y'; -CREATE TABLESPACE encryt_ts_4k ADD DATAFILE 'encrypt_ts_4k.ibd' FILE_BLOCK_SIZE=4k ENCRYPTION='Y'; -CREATE TABLESPACE encryt_ts_8k ADD DATAFILE 'encrypt_ts_8k.ibd' FILE_BLOCK_SIZE=8k ENCRYPTION='Y'; -CREATE TABLESPACE encryt_ts_16k ADD DATAFILE 'encrypt_ts_16k.ibd' FILE_BLOCK_SIZE=16k ENCRYPTION='Y'; -CREATE TABLESPACE encryt_ts_32k ADD DATAFILE 'encrypt_ts_32k.ibd' FILE_BLOCK_SIZE=32k ENCRYPTION='Y'; -ERROR HY000: InnoDB: Cannot create a tablespace with FILE_BLOCK_SIZE=32768 because INNODB_PAGE_SIZE=16384. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: Cannot create a tablespace with FILE_BLOCK_SIZE=32768 because INNODB_PAGE_SIZE=16384. -Error 1528 Failed to create TABLESPACE encryt_ts_32k -Error 1031 Table storage engine for 'encryt_ts_32k' doesn't have this option -DROP tablespace encryt_ts_1k; -DROP tablespace encryt_ts_2k; -DROP tablespace encryt_ts_4k; -DROP tablespace encryt_ts_8k; -DROP tablespace encryt_ts_16k; -CREATE TABLESPACE encrypt_ts ENCRYPTION='Y' ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 10M -MAX_SIZE = 100M NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 10M -MAX_SIZE = 1' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENCRYPTION='Y' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M -MAX_SIZE = 100M NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB ENCRYPTION='Y' AUTOEXTEND_SIZE = 12M -MAX_SIZE = 100M NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M ENCRYPTION='Y' -MAX_SIZE = 100M NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M MAX_SIZE = 100M -ENCRYPTION='Y' NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M MAX_SIZE = 100M -NODEGROUP = 5 ENCRYPTION='Y' WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M MAX_SIZE = 100M -NODEGROUP = 5 WAIT ENCRYPTION='Y' COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M MAX_SIZE = 100M -NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' ENCRYPTION='Y' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M MAX_SIZE = 100M -NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M ENCRYPTION='Y'EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M MAX_SIZE = 100M -NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M ENCRYPTION='Y'; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB ENCRYPTION='Y'; -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -ALTER TABLESPACE encrypt_ts RENAME TO encrypt_ts_renamed; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts_renamed'; -NAME ENCRYPTION -encrypt_ts_renamed Y -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts_renamed` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; -DROP TABLESPACE encrypt_ts_renamed; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB ENCRYPTION='Y'; -CREATE PROCEDURE populate_t1() -BEGIN -DECLARE i int DEFAULT 1; -START TRANSACTION; -WHILE (i <= 10) DO -INSERT INTO t1 VALUES (i,CONCAT('a', i)); -SET i = i + 1; -END WHILE; -COMMIT; -END| -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y' ROW_FORMAT=COMPRESSED; -ERROR HY000: InnoDB: Tablespace `encrypt_ts` cannot contain a COMPRESSED table -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: Tablespace `encrypt_ts` cannot contain a COMPRESSED table -Error 1031 Table storage engine for 't1' doesn't have this option -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y' ROW_FORMAT=FIXED; -ERROR HY000: Table storage engine for 't1' doesn't have this option -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y' ROW_FORMAT=DYNAMIC; -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y' ROW_FORMAT=REDUNDANT; -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y' ROW_FORMAT=COMPACT; -DROP TABLE t1; -DROP PROCEDURE populate_t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y' KEY_BLOCK_SIZE=1; -ERROR HY000: InnoDB: Tablespace `encrypt_ts` cannot contain a COMPRESSED table -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: Tablespace `encrypt_ts` cannot contain a COMPRESSED table -Error 1031 Table storage engine for 't1' doesn't have this option -DROP TABLESPACE encrypt_ts; -SET block_encryption_mode = 'aes-256-cbc'; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB ENCRYPTION='Y'; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -CREATE TABLE tde_db.t1(c1 INT PRIMARY KEY, c2 char(50)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y'; -INSERT INTO tde_db.t1 VALUES(0, 'abc'); -INSERT INTO tde_db.t1 VALUES(1, 'xyz'); -INSERT INTO tde_db.t1 VALUES(2, null); -INSERT INTO tde_db.t1 VALUES(3, null); -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -DROP DATABASE tde_db; -DROP TABLESPACE encrypt_ts; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENCRYPTION ='Y' ENGINE=InnoDB; -CREATE TABLE tde_db.t_encrypt(c4 JSON , -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENGINE=InnoDB TABLESPACE=encrypt_ts ENCRYPTION='Y'; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - SPATIAL KEY `idx2` (`c7`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -INSERT INTO tde_db.t_encrypt(c4,c7) VALUES('{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -INSERT INTO tde_db.t_encrypt(c4,c7) select c4,c7 from tde_db.t_encrypt; -SELECT c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -SELECT c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 c6 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - SPATIAL KEY `idx2` (`c7`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE IF EXISTS tde_db.t_encrypt; -CREATE TABLE tde_db.t_encrypt(c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 char(100), c3 BLOB , FULLTEXT INDEX `idx1` (c2)) ENGINE=InnoDB TABLESPACE=encrypt_ts ENCRYPTION='Y'; -CREATE TABLE tde_db.t_encrypt1(c11 INT , c22 char(100), c33 BLOB , FULLTEXT INDEX `idx1` (c22)) ENGINE=InnoDB TABLESPACE=encrypt_ts ENCRYPTION='Y'; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c1` int NOT NULL AUTO_INCREMENT, - `c2` char(100) DEFAULT NULL, - `c3` blob, - PRIMARY KEY (`c1`), - FULLTEXT KEY `idx1` (`c2`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE tde_db.t_encrypt1; -Table Create Table -t_encrypt1 CREATE TABLE `t_encrypt1` ( - `c11` int DEFAULT NULL, - `c22` char(100) DEFAULT NULL, - `c33` blob, - FULLTEXT KEY `idx1` (`c22`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -CREATE TABLE tde_db.t_encrypt2 (f1 INT PRIMARY KEY, f2 CHAR(100), -FOREIGN KEY (f1) REFERENCES tde_db.t_encrypt(c1) ON UPDATE CASCADE) ENGINE=InnoDB TABLESPACE=encrypt_ts ENCRYPTION='Y'; -CREATE TRIGGER tde_db.trigger_encrypt_table AFTER INSERT ON tde_db.t_encrypt -FOR EACH ROW -begin -INSERT INTO tde_db.t_encrypt1 SET c11 = NEW.c1*-1, c22 = NEW.c2 , c33 = NEW.c3; -end| -INSERT INTO tde_db.t_encrypt(c2,c3) VALUES("transparent tablespace encryption",repeat('A', 200)); -INSERT INTO tde_db.t_encrypt(c2,c3) VALUES("general tablespace option",repeat('A', 200)); -INSERT INTO tde_db.t_encrypt(c2,c3) VALUES("page level encryption",repeat('A', 200)); -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(1,"transparent tablespace encryption"); -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(2,"general tablespace option"); -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -1 transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -3 page level encryption AAAAAAAAAAAAAAAAAAAA -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt WHERE MATCH c2 AGAINST ('tablespace'); -c1 c2 right(c3, 20) -1 transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt WHERE MATCH c2 AGAINST ('tablespace' IN BOOLEAN MODE); -c1 c2 right(c3, 20) -1 transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt WHERE MATCH c2 AGAINST ('+tablespace -encryption' IN BOOLEAN MODE); -c1 c2 right(c3, 20) -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -ALTER TABLE tde_db.t_encrypt DROP INDEX idx1; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -1 transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -3 page level encryption AAAAAAAAAAAAAAAAAAAA -ALTER TABLE tde_db.t_encrypt ADD COLUMN c4 CHAR(20) DEFAULT 'text'; -SELECT c1,c2,right(c3, 20),c4 FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) c4 -1 transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA text -2 general tablespace option AAAAAAAAAAAAAAAAAAAA text -3 page level encryption AAAAAAAAAAAAAAAAAAAA text -CREATE VIEW tde_db.t_encrypt_view AS SELECT c1,c2 FROM tde_db.t_encrypt; -SELECT c2 FROM tde_db.t_encrypt_view LIMIT 10; -c2 -transparent tablespace encryption -general tablespace option -page level encryption -SELECT A.c2,B.c2,right(B.c3,20) FROM tde_db.t_encrypt_view A , tde_db.t_encrypt B WHERE A.c2 = B.c2; -c2 c2 right(B.c3,20) -transparent tablespace encryption transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA -general tablespace option general tablespace option AAAAAAAAAAAAAAAAAAAA -page level encryption page level encryption AAAAAAAAAAAAAAAAAAAA -DROP VIEW tde_db.t_encrypt_view; -SELECT c11,c22,right(c33, 20) FROM tde_db.t_encrypt1 LIMIT 10; -c11 c22 right(c33, 20) --1 transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA --2 general tablespace option AAAAAAAAAAAAAAAAAAAA --3 page level encryption AAAAAAAAAAAAAAAAAAAA -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(2,"general tablespace option"); -ERROR 23000: Duplicate entry '2' for key 't_encrypt2.PRIMARY' -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(8,"general tablespace option"); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`tde_db`.`t_encrypt2`, CONSTRAINT `t_encrypt2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t_encrypt` (`c1`) ON UPDATE CASCADE) -SELECT f1,f2 FROM tde_db.t_encrypt2; -f1 f2 -1 transparent tablespace encryption -2 general tablespace option -UPDATE tde_db.t_encrypt SET c1=10 WHERE c1=1; -SELECT f1,f2 FROM tde_db.t_encrypt2; -f1 f2 -2 general tablespace option -10 transparent tablespace encryption -DROP DATABASE tde_db; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -CREATE TABLE tde_db.t_encrypt (c2 INT NOT NULL AUTO_INCREMENT ,c3 VARCHAR(255), c4 JSON ,c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED,c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL,c7 POINT NOT NULL SRID 0,spatial INDEX idx2 (c7) , PRIMARY KEY (c2,c3(100))) ENGINE=InnoDB TABLESPACE=encrypt_ts ENCRYPTION='Y'; -CREATE PROCEDURE tde_db.txn_t_encrypt() -BEGIN -declare i int default 0; -declare rowcnt int default 0; -START TRANSACTION; -WHILE (i <= 2000) DO -SET i = i + 1; -SET rowcnt = rowcnt + 1; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) VALUES (CONCAT(REPEAT('a',10),REPEAT(i,10)),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -IF (rowcnt = 3) THEN -UPDATE tde_db.t_encrypt SET c4 = '{ "key_a": 21, "key_b": 22, "key_c": 23 }' WHERE c2 = i-1 ; -DELETE FROM tde_db.t_encrypt WHERE c2 = i; -SAVEPOINT A; -END IF; -IF (rowcnt = 5) THEN -UPDATE tde_db.t_encrypt SET c4 = '{ "key_a": 41, "key_b": 42, "key_c": 43 }' WHERE c2 = i-1 ; -DELETE FROM tde_db.t_encrypt WHERE c2 = i; -SAVEPOINT B; -END IF; -IF (rowcnt = 10) THEN -ROLLBACK TO SAVEPOINT A; -COMMIT; -SET rowcnt = 0; -START TRANSACTION; -END IF; -END WHILE; -COMMIT; -end| -call tde_db.txn_t_encrypt(); -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -401 -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt LIMIT 10; -c2 RIGHT(c3,20) c4 -1 aaaaaaaaaa1111111111 {"key_a": 1, "key_b": 2, "key_c": 3} -2 aaaaaaaaaa2222222222 {"key_a": 21, "key_b": 22, "key_c": 23} -11 11111111111111111111 {"key_a": 1, "key_b": 2, "key_c": 3} -12 12121212121212121212 {"key_a": 21, "key_b": 22, "key_c": 23} -21 21212121212121212121 {"key_a": 1, "key_b": 2, "key_c": 3} -22 22222222222222222222 {"key_a": 21, "key_b": 22, "key_c": 23} -31 31313131313131313131 {"key_a": 1, "key_b": 2, "key_c": 3} -32 32323232323232323232 {"key_a": 21, "key_b": 22, "key_c": 23} -41 41414141414141414141 {"key_a": 1, "key_b": 2, "key_c": 3} -42 42424242424242424242 {"key_a": 21, "key_b": 22, "key_c": 23} -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt WHERE c2 > 500 AND c2 < 600; -c2 RIGHT(c3,20) c4 -501 01501501501501501501 {"key_a": 1, "key_b": 2, "key_c": 3} -502 02502502502502502502 {"key_a": 21, "key_b": 22, "key_c": 23} -511 11511511511511511511 {"key_a": 1, "key_b": 2, "key_c": 3} -512 12512512512512512512 {"key_a": 21, "key_b": 22, "key_c": 23} -521 21521521521521521521 {"key_a": 1, "key_b": 2, "key_c": 3} -522 22522522522522522522 {"key_a": 21, "key_b": 22, "key_c": 23} -531 31531531531531531531 {"key_a": 1, "key_b": 2, "key_c": 3} -532 32532532532532532532 {"key_a": 21, "key_b": 22, "key_c": 23} -541 41541541541541541541 {"key_a": 1, "key_b": 2, "key_c": 3} -542 42542542542542542542 {"key_a": 21, "key_b": 22, "key_c": 23} -551 51551551551551551551 {"key_a": 1, "key_b": 2, "key_c": 3} -552 52552552552552552552 {"key_a": 21, "key_b": 22, "key_c": 23} -561 61561561561561561561 {"key_a": 1, "key_b": 2, "key_c": 3} -562 62562562562562562562 {"key_a": 21, "key_b": 22, "key_c": 23} -571 71571571571571571571 {"key_a": 1, "key_b": 2, "key_c": 3} -572 72572572572572572572 {"key_a": 21, "key_b": 22, "key_c": 23} -581 81581581581581581581 {"key_a": 1, "key_b": 2, "key_c": 3} -582 82582582582582582582 {"key_a": 21, "key_b": 22, "key_c": 23} -591 91591591591591591591 {"key_a": 1, "key_b": 2, "key_c": 3} -592 92592592592592592592 {"key_a": 21, "key_b": 22, "key_c": 23} -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt ORDER BY c2 DESC LIMIT 10; -c2 RIGHT(c3,20) c4 -2001 20012001200120012001 {"key_a": 1, "key_b": 2, "key_c": 3} -1992 19921992199219921992 {"key_a": 21, "key_b": 22, "key_c": 23} -1991 19911991199119911991 {"key_a": 1, "key_b": 2, "key_c": 3} -1982 19821982198219821982 {"key_a": 21, "key_b": 22, "key_c": 23} -1981 19811981198119811981 {"key_a": 1, "key_b": 2, "key_c": 3} -1972 19721972197219721972 {"key_a": 21, "key_b": 22, "key_c": 23} -1971 19711971197119711971 {"key_a": 1, "key_b": 2, "key_c": 3} -1962 19621962196219621962 {"key_a": 21, "key_b": 22, "key_c": 23} -1961 19611961196119611961 {"key_a": 1, "key_b": 2, "key_c": 3} -1952 19521952195219521952 {"key_a": 21, "key_b": 22, "key_c": 23} -DROP DATABASE tde_db; -DROP TABLESPACE encrypt_ts; -######################################################################### -# RESTART 4 : WITH KEYRING AND --INNODB_DIRECTORIES -######################################################################### -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'MYSQL_TMP_DIR/encrypt_ts.ibd' ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -CREATE DATABASE tde_db; -CREATE TABLE tde_db.t1(c1 INT PRIMARY KEY, c2 char(50)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y'; -INSERT INTO tde_db.t1 VALUES(0, 'abc'); -INSERT INTO tde_db.t1 VALUES(1, 'xyz'); -SELECT * FROM tde_db.t1; -c1 c2 -0 abc -1 xyz -# Remote tablespace listing -encrypt_ts.ibd -DROP TABLE tde_db.t1; -DROP DATABASE tde_db; -######################################################################### -# Cleanup -######################################################################### -DROP TABLESPACE encrypt_ts; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_1.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_1.test deleted file mode 100644 index 0d51e409e64d..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_1.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/no_valgrind_without_big.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/tablespace_encrypt_1.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_10.result b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_10.result deleted file mode 100644 index 80a96160117d..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_10.result +++ /dev/null @@ -1,515 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# START : WITHOUT KEYRING - -######### -# SETUP # -######### -# Taking backup of local manifest file for MySQL server instance -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -#-------------------------- TEST 1 -------------------------------------# -# RESTART 1 : WITH KEYRING -# Restore local manifest file for MySQL server instance from backup -######################################################################## -# ALTER TABLESPACE : Unencrypted => Encrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# RESTART 2 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before flushing page 0 at the end -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" not found -# RESTART 3 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" found -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 4 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before flushing page 0 at the end -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 5 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 6 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 2 -------------------------------------# -# RESTART 7 : WITH KEYRING -######################################################################## -# ALTER TABLESPACE : Unencrypted => Encrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# RESTART 8 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just after flushing page 0 at the end -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" not found -# RESTART 9 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" found -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 10 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just after flushing page 0 at the end -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 11 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 12 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 3 -------------------------------------# -# RESTART 13 : WITH KEYRING -######################################################################## -# ALTER TABLESPACE : Unencrypted => Encrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# RESTART 14 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before resetting_progress on page 0 -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" not found -# RESTART 15 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" found -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 16 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before resetting_progress on page 0 -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 17 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 18 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 4 -------------------------------------# -# RESTART 19 : WITH KEYRING -# Encrypt the tablespace. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 20 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before updating flags -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 21 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 22 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 5 -------------------------------------# -# RESTART 23 : WITH KEYRING -######################################################################## -# ALTER TABLESPACE : Unencrypted => Encrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# RESTART 24 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before encryption processing is started -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" not found -# RESTART 25 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" found -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 26 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before encryption processing is started -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 27 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 28 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 6 -------------------------------------# -# RESTART 29 : WITH KEYRING -######################################################################## -# ALTER TABLESPACE : Unencrypted => Encrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# RESTART 30 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just after encryption processing is finished -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" not found -# RESTART 31 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" found -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 32 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just after encryption processing is finished -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 33 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 34 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 7 -------------------------------------# -# RESTART 35 : WITH KEYRING -######################################################################## -# ALTER TABLESPACE : Unencrypted => Encrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# RESTART 36 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just after inserting DDL Log Entry -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" not found -# RESTART 37 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" found -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 38 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just after inserting DDL Log Entry -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 39 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 40 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -########### -# Cleanup # -########### -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -# RESTART 41 : final -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_10.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_10.test deleted file mode 100644 index 7419ac764edf..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_10.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc ---source include/big_test.inc ---source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_10.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_11.result b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_11.result deleted file mode 100644 index 49e3d8854708..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_11.result +++ /dev/null @@ -1,96 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######### -# SETUP # -######### -######################################################################### -# RESTART 1 : WITH KEYRING PLUGIN -######################################################################### -#-------------------------- TEST 1 -------------------------------------# -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -# Set Encryption process to crash just after making DDL Entry -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################### -# RESTART 2 : WITH KEYRING PLUGIN after crash -######################################################################### -# INJECT error TOO_MANY_CONCURRENT_TXNS in startup location DDL_Log_remove_inject_startup_error_1. -# It will cause FATAL error and server abort. -# Search the failure pattern in error log -Pattern "ENCRYPTION for tablespace encrypt_ts:[0-9]+ could not be done successfully" found -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -######################################################################### -# RESTART 3 : normally -######################################################################### -#-------------------------- TEST 2 -------------------------------------# -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -# Set Encryption process to crash just after making DDL Entry -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################### -# RESTART 4 : WITH KEYRING PLUGIN after crash -######################################################################### -# INJECT error TOO_MANY_CONCURRENT_TXNS in startup location DDL_Log_remove_inject_startup_error_2. -# It will cause FATAL error and server abort. -# Search the failure pattern in error log -Pattern "\[FATAL\] Error in DDL Log recovery during Post-Recovery processing." found -######################################################################### -# RESTART 4 : normally -######################################################################### -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -########### -# Cleanup # -########### -######################################################################### -# RESTART 5 : final -######################################################################### -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_11.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_11.test deleted file mode 100644 index da7c1bc9f439..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_11.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc ---source include/big_test.inc ---source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_11.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_2-master.opt b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_2-master.opt deleted file mode 100644 index 5df3ea9cdec1..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_2-master.opt +++ /dev/null @@ -1 +0,0 @@ ---initialize --innodb_page_size=16k diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_2.result b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_2.result deleted file mode 100644 index ab733e7e60cc..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_2.result +++ /dev/null @@ -1,441 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# START : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -######### -# SETUP # -######### -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -############################################################# -# TEST 1 : CRASH DURING ALTER ENCRYPT A TABLESPACE. -############################################################# - -######################################################################### -# RESTART 1 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -############################################################ -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -# (crash at page 10) # -############################################################ -# Set Encryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# Restart after crash -# Wait for Encryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Encryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 2 : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 3 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -############################################################ -# ALTER TABLESPACE 2 : Encrypted => Unencrypted # -# (crash at page 10) # -############################################################ -# Set Unencryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# Restart after crash -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 4 : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#################################################################### -# TEST 2 : CRASH DURING ALTER ENCRYPT A TABLESPACE (Compressed). -#################################################################### - -CREATE TABLESPACE compress_ts ADD DATAFILE 'compress_ts.ibd' ENGINE=InnoDB -ENCRYPTION="N" FILE_BLOCK_SIZE=8192; -CREATE TABLE t2(c1 char(100)) ENGINE=InnoDB TABLESPACE compress_ts -ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='compress_ts'; -NAME ENCRYPTION -compress_ts N -SELECT * FROM t2 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 5 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -############################################################ -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -# (crash at page 10) # -############################################################ -# Set Encryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE compress_ts ENCRYPTION='Y'; -# Restart after crash -# Wait for Encryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Encryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='compress_ts'; -NAME ENCRYPTION -compress_ts Y -SELECT * FROM t2 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 6 : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t2 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 7 WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='compress_ts'; -NAME ENCRYPTION -compress_ts Y -SELECT * FROM t2 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -############################################################ -# ALTER TABLESPACE 2 : Encrypted => Unencrypted # -# (crash at page 10) # -############################################################ -# Set Unencryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE compress_ts ENCRYPTION='N'; -# Restart after crash -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='compress_ts'; -NAME ENCRYPTION -compress_ts N -SELECT * FROM t2 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 8 : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t2 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -DROP TABLE t2; -DROP TABLESPACE compress_ts; -############################################################# -# TEST 3 : CRASH BEFORE/AFTER ENCRYPTION PROCESSING. -############################################################# - -######################################################################### -# RESTART 9 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -# Set server to crash just before encryption processing starts -SET SESSION debug="+d,alter_encrypt_tablespace_crash_before_processing"; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# Restart after crash -# Wait for Unencryption processing to finish in background thread -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Set server to crash just after encryption processing finishes -SET SESSION debug="-d,alter_encrypt_tablespace_crash_before_processing"; -SET SESSION debug="+d,alter_encrypt_tablespace_crash_after_processing"; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# Restart after crash -# Wait for Unencryption processing to finish in background thread -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -############################################################# -# TEST 4 : CRASH DURING KEY ROTATION. -############################################################# - -######################################################################### -# RESTART 10 : WITH KEYRING -######################################################################### -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -# Set server to crash while rotating encryption -SET SESSION debug="+d,ib_crash_during_rotation_for_encryption"; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -# Restart after crash -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SET SESSION debug="-d,ib_crash_during_rotation_for_encryption"; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -############################################################### -# TEST 5 : CRASH DURING CREATING AN ENCRYPTED TABLESPACE -############################################################### - -# Set server to crash while creating an encrypted tablespace -SET SESSION debug="+d,ib_crash_during_create_tablespace_for_encryption"; -# Try to create an encrypted tablespace. It will cause server to crash. -CREATE TABLESPACE encrypt_ts_2 ADD DATAFILE 'encrypt_ts_2.ibd' ENGINE=InnoDB ENCRYPTION="Y"; -# Restart after crash -SET SESSION debug="-d,ib_crash_during_create_tablespace_for_encryption"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE "%encrypt_ts%"; -NAME ENCRYPTION -encrypt_ts Y -############################################################### -# TEST 6 : DMLs ALLOWED AND DDLs BLOCKED TEST -############################################################### -SELECT ENABLED FROM performance_schema.setup_instruments -WHERE NAME='wait/lock/metadata/sql/mdl'; -ENABLED -YES -SET DEBUG_SYNC = 'innodb_alter_encrypt_tablespace SIGNAL s1 WAIT_FOR s2'; -ALTER TABLESPACE encrypt_ts ENCRYPTION='N';; -# Session 2 -SET DEBUG_SYNC = 'now WAIT_FOR s1'; -OBJECT_TYPE OBJECT_NAME LOCK_TYPE LOCK_DURATION LOCK_STATUS -TABLESPACE encrypt_ts EXCLUSIVE TRANSACTION GRANTED -DESCRIBE t1; -Field Type Null Key Default Extra -c1 char(100) YES NULL -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` char(100) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SELECT COUNT(*) FROM t1; -COUNT(*) -4096 -INSERT INTO t1 VALUES ("SOME VALUES"); -SELECT COUNT(*) from t1; -COUNT(*) -4097 -ALTER TABLE t1 ADD COLUMN (c2 int);; -# Monitoring session -OBJECT_TYPE OBJECT_NAME LOCK_TYPE LOCK_DURATION LOCK_STATUS -TABLESPACE encrypt_ts EXCLUSIVE TRANSACTION GRANTED -# Wait for MDL request by con2 to appear in metadata_locks table. -OBJECT_TYPE OBJECT_NAME LOCK_TYPE LOCK_DURATION LOCK_STATUS -TABLE t1 SHARED_UPGRADABLE TRANSACTION PENDING -SET DEBUG_SYNC = 'now SIGNAL s2'; -# Connection default -# Connection con2 -# Connection default -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE "%encrypt_ts%"; -NAME ENCRYPTION -encrypt_ts N -DESCRIBE t1; -Field Type Null Key Default Extra -c1 char(100) YES NULL -c2 int YES NULL -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` char(100) DEFAULT NULL, - `c2` int DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -########### -# Cleanup # -########### -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_2.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_2.test deleted file mode 100644 index f2fce888fbb4..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_2.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/big_test.inc ---source include/have_debug.inc -# --source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/tablespace_encrypt_2.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_3.result b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_3.result deleted file mode 100644 index 820348389214..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_3.result +++ /dev/null @@ -1,168 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# START : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -######### -# SETUP # -######### -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' - ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 1 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -# Monitoring connection -UPDATE performance_schema.setup_consumers SET ENABLED='YES'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM performance_schema.setup_consumers -WHERE NAME LIKE "%stages%"; -NAME ENABLED -events_stages_current YES -events_stages_history YES -events_stages_history_long YES -SELECT * FROM performance_schema.setup_instruments -WHERE NAME LIKE "%encryption%"; -NAME ENABLED TIMED PROPERTIES VOLATILITY DOCUMENTATION -wait/synch/mutex/innodb/resume_encryption_cond_mutex YES YES 0 NULL -wait/synch/cond/innodb/resume_encryption_cond YES YES 0 NULL -stage/innodb/alter tablespace (encryption) YES YES progress 0 NULL -select count(*) from performance_schema.events_stages_current -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -count(*) -0 -# Default connection -############################################################ -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -############################################################ - -# Set Encryption process to wait after page 5 so that we can monitor -# progress in performance_schema table -SET DEBUG_SYNC = 'alter_encrypt_tablespace_wait_after_page5 SIGNAL s1 WAIT_FOR s2'; -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# Monitoring connection -SET DEBUG_SYNC = 'now WAIT_FOR s1'; -# Wait for Encryption progress monitoring to appear in PFS table -# Wait for some progress to appear in PFS table -select WORK_ESTIMATED, WORK_COMPLETED -FROM performance_schema.events_stages_current -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)'; -WORK_ESTIMATED WORK_COMPLETED -6 5 -SET DEBUG_SYNC = 'now SIGNAL s2'; -# Default connection -# Once done, select count from PFS tables -SELECT COUNT(*) -FROM performance_schema.events_stages_current -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -COUNT(*) -0 -SELECT COUNT(*) -FROM performance_schema.events_stages_history -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_history_long -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_global_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_by_user_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_by_host_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_by_account_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -# Check that Encryption done successfully. -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 2 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 3 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -UPDATE performance_schema.setup_consumers SET ENABLED='NO'; -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -########### -# Cleanup # -########### -SELECT COUNT(*) FROM t1; -COUNT(*) -32 -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_3.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_3.test deleted file mode 100644 index a78047ef0521..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_3.test +++ /dev/null @@ -1,7 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/no_valgrind_without_big.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_3.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_4.result b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_4.result deleted file mode 100644 index f64684ae7a87..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_4.result +++ /dev/null @@ -1,623 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# START : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -######### -# SETUP # -######### -######################################################################### -# RESTART 1 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -######################################################################### -# Non Partitioned Table # -######################################################################### - -DROP TABLE IF EXISTS t1; -# Create an Encrypted and an Unencrypted tablespace -CREATE TABLESPACE encrypt_ts add datafile 'encrypt_ts.ibd' ENCRYPTION='Y'; -CREATE TABLESPACE unencrypt_ts add datafile 'unencrypt_ts.ibd' ENCRYPTION='N'; -# Create table with "encryption" option in general tablespace -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='n'; -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'unencrypted' table while using an 'encrypted' tablespace. -CREATE TABLE t1 (c int) TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -CREATE TABLE t1 (c int) TABLESPACE=innodb_system ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -DROP TABLE t1; -#------------------------------------------------------- -# general [encrypted] => general [unencrypted] -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='Y'; -ALTER TABLE t1 TABLESPACE=unencrypt_ts ENCRYPTION='N', ALGORITHM=INPLACE; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 TABLESPACE=unencrypt_ts ENCRYPTION='N', ALGORITHM=COPY; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -# general [unencrypted] => general [encrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -ALTER TABLE t1 TABLESPACE=encrypt_ts ENCRYPTION='Y', ALGORITHM=INPLACE; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -# Changing encryption type without explicit ENCRYPTION clause fails. -ALTER TABLE t1 TABLESPACE=encrypt_ts, ALGORITHM=COPY; -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -ALTER TABLE t1 TABLESPACE=encrypt_ts, ALGORITHM=INPLACE; -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -ALTER TABLE t1 TABLESPACE=encrypt_ts ENCRYPTION='Y', ALGORITHM=COPY; -#------------------------------------------------------- -# general [encrypted] => file-per-table [unencrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='Y'; -ALTER TABLE t1 TABLESPACE=innodb_file_per_table, ALGORITHM=INPLACE; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 TABLESPACE=innodb_file_per_table, ALGORITHM=COPY; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n', ALGORITHM=INPLACE; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n', ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -# general [encrypted] => file-per-table [encrypted] -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION= 'Y'; -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y', ALGORITHM=INPLACE; -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y', ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -#------------------------------------------------------- -# general [unencrypted] => file-per-table [unencrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=innodb_file_per_table, ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=innodb_file_per_table, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -# general [unencrypted] => file-per-table [encrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y', ALGORITHM=INPLACE; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y', ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -# general [unencrypted] => file-per-table [unencrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n', ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n', ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -#------------------------------------------------------- -# file-per-table [unencrypted] => general [encrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=encrypt_ts ENCRYPTION='Y', ALGORITHM=INPLACE; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=encrypt_ts ENCRYPTION='Y', ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -# file-per-table [encrypted] => general [encrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -ALTER TABLE t1 TABLESPACE=encrypt_ts, ALGORITHM=INPLACE; -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -ALTER TABLE t1 TABLESPACE=encrypt_ts, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -# file-per-table [encrypted] => general [unencrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -ALTER TABLE t1 TABLESPACE=unencrypt_ts ENCRYPTION='N', ALGORITHM=INPLACE; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 TABLESPACE=unencrypt_ts ENCRYPTION='N', ALGORITHM=COPY; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -# file-per-table [unencrypted] => general [unencrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=unencrypt_ts, ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=unencrypt_ts, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -#------------------------------------------------------- -# ALTER TABLE ADD COLUMN/INDEX WITH MOVING TO DIFFERENT TABLESPACE -CREATE TABLESPACE encrypt_ts1 add datafile 'encrypt_ts1.ibd' ENCRYPTION='Y'; -CREATE TABLESPACE unencrypt_ts1 add datafile 'unencrypt_ts1.ibd' ENCRYPTION='N'; -# ALGORITHM=DEFAULT -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='Y'; -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=unencrypt_ts ENCRYPTION='N'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=encrypt_ts1; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -ALTER TABLE t1 ADD INDEX (c), TABLESPACE=encrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=unencrypt_ts1; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 ADD INDEX (c), TABLESPACE=unencrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 ADD INDEX (c2), TABLESPACE=encrypt_ts ENCRYPTION='Y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`), - KEY `c2` (`c2`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; -# ALGORITHM=INPLACE -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='Y'; -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=unencrypt_ts ENCRYPTION='N', ALGORITHM=INPLACE; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=encrypt_ts1 ENCRYPTION='Y', ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -ALTER TABLE t1 ADD INDEX (c), TABLESPACE=encrypt_ts, ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=unencrypt_ts1, ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 ADD INDEX (c), TABLESPACE=unencrypt_ts, ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 ADD INDEX (c2), TABLESPACE=encrypt_ts ENCRYPTION='Y', ALGORITHM=INPLACE; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -# ALGORITHM=COPY -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='Y'; -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=unencrypt_ts ENCRYPTION='N', ALGORITHM=COPY; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=encrypt_ts1, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -ALTER TABLE t1 ADD INDEX (c), TABLESPACE=encrypt_ts, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=unencrypt_ts1, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 ADD INDEX (c), TABLESPACE=unencrypt_ts, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 ADD INDEX (c2), TABLESPACE=encrypt_ts ENCRYPTION='Y', ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`), - KEY `c2` (`c2`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; -######################################################################### -# Partitioned Table # -######################################################################### - -DROP TABLE IF EXISTS t1; -# Create table without explicit tablespace name -CREATE TABLE t1 (id INT, name VARCHAR(50)) -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -# Try to ALTER TABLE to have general tablespace at table level -ALTER TABLE t1 TABLESPACE=unencrypt_ts; -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -# Alter encryption option -ALTER TABLE t1 ENCRYPTION='Y'; -DROP TABLE t1; -# Create table with general tablespace at table level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -TABLESPACE=encrypt_ts ENCRYPTION='Y' - PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Create table with system tablespace at table level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -TABLESPACE=innodb_system -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Create table with innodb_file_per_table tablespace at table level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -TABLESPACE=innodb_file_per_table -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -DROP TABLE t1; -# Create table with general tablespace at partition level -CREATE TABLE t1 (id INT, name VARCHAR(50)) ENCRYPTION='Y' - PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30) TABLESPACE=encrypt_ts); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Create table with system tablespace at partition level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30) TABLESPACE=innodb_system); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Create table with innodb_file_per_table tablespace at partition level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30) TABLESPACE=innodb_file_per_table); -DROP TABLE t1; -# Create table with ENCRYPTION='y' option -CREATE TABLE t1 (id INT, name VARCHAR(50)) -ENCRYPTION='Y' - PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -INSERT INTO t1 VALUES (5,'test'); -INSERT INTO t1 VALUES (12,'test1'); -INSERT INTO t1 VALUES (22,'test2'); -# Truncate specific partition of encrypted table -ALTER TABLE t1 TRUNCATE PARTITION p0; -# Alter encryption option -ALTER TABLE t1 ENCRYPTION='N'; -DROP TABLE t1; -# Create table with ENCRYPTION='y' option and innodb_file_per_table -# tablespace at table level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -ENCRYPTION='Y' TABLESPACE=innodb_file_per_table -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -# Alter encryption option -ALTER TABLE t1 ENCRYPTION='N'; -# Alter table to move a partition to general tablespace. -ALTER TABLE t1 REORGANIZE PARTITION P2 INTO ( -PARTITION P2 VALUES LESS THAN (30) TABLESPACE=encrypt_ts); -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'unencrypted' table while using an 'encrypted' tablespace. -ALTER TABLE t1 REORGANIZE PARTITION P2 INTO ( -PARTITION P2 VALUES LESS THAN (30) TABLESPACE=unencrypt_ts); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Alter table to move a partition to system tablespace. -ALTER TABLE t1 REORGANIZE PARTITION P2 INTO ( -PARTITION P2 VALUES LESS THAN (30) TABLESPACE=innodb_system); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Alter table to move a partition to file_per_table tablespace. -ALTER TABLE t1 REORGANIZE PARTITION P2 INTO ( -PARTITION P2 VALUES LESS THAN (30) TABLESPACE=innodb_file_per_table); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB, - PARTITION P2 VALUES LESS THAN (30) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB) */ -# Alter table to add a new partition in general tablespace -ALTER TABLE t1 ADD PARTITION ( -PARTITION p3 VALUES LESS THAN (40) tablespace=encrypt_ts); -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'unencrypted' table while using an 'encrypted' tablespace. -ALTER TABLE t1 ADD PARTITION ( -PARTITION p3 VALUES LESS THAN (40) tablespace=unencrypt_ts); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Alter table to add a new partition in innodb_system tablespace -ALTER TABLE t1 ADD PARTITION ( -PARTITION p3 VALUES LESS THAN (40) tablespace=innodb_system); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Alter table to add a new partition in innodb_file_per_table tablespace -ALTER TABLE t1 ADD PARTITION ( -PARTITION p3 VALUES LESS THAN (40) tablespace=innodb_file_per_table); -# Alter table to add a new partition without giving tablespace -ALTER TABLE t1 ADD PARTITION ( -PARTITION p4 VALUES LESS THAN (50)); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB, - PARTITION P2 VALUES LESS THAN (30) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB, - PARTITION p3 VALUES LESS THAN (40) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB, - PARTITION p4 VALUES LESS THAN (50) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB) */ -# Alter table to add a new partition with encryption option at partition -# level. -ALTER TABLE t1 ADD PARTITION ( -PARTITION p5 VALUES LESS THAN (60) encryption='Y'); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'encryption='Y')' at line 2 -DROP TABLE t1; -# Create table with ENCRYPTION='y' option and general tablespace -# at table level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -ENCRYPTION='Y' TABLESPACE=encrypt_ts -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Create table with ENCRYPTION='y' option and general tablespace -# at partition level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -ENCRYPTION='Y' - PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30) TABLESPACE=encrypt_ts); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -########### -# Cleanup # -########### -DROP TABLE IF EXISTS t1; -DROP TABLESPACE encrypt_ts; -DROP TABLESPACE encrypt_ts1; -DROP TABLESPACE unencrypt_ts; -DROP TABLESPACE unencrypt_ts1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_4.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_4.test deleted file mode 100644 index cb2c136e38a9..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_4.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/no_valgrind_without_big.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_4.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_5-master.opt b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_5-master.opt deleted file mode 100644 index 5df3ea9cdec1..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_5-master.opt +++ /dev/null @@ -1 +0,0 @@ ---initialize --innodb_page_size=16k diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_5.result b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_5.result deleted file mode 100644 index 5590b6d28448..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_5.result +++ /dev/null @@ -1,103 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######### -# SETUP # -######### - -######################################################################### -# WITH KEYRING -######################################################################### -# Create a new 'unencrypted' tablespace 'encrypt_ts' -SELECT NAME, FLAG, SPACE_TYPE FROM information_schema.INNODB_TABLESPACES -where NAME="encrypt_ts"; -NAME FLAG SPACE_TYPE -create tablespace encrypt_ts add datafile 'encrypt_ts.ibd' - engine=INNODB encryption='N'; -SELECT NAME, FLAG, SPACE_TYPE FROM information_schema.INNODB_TABLESPACES -where NAME="encrypt_ts"; -NAME FLAG SPACE_TYPE -encrypt_ts 18432 General -# Create a table test.t1 in 'encrypt_ts' tablespace and insert some records. -create table test.t1 (c char(20)) tablespace encrypt_ts; -insert into test.t1 values ("samplerecord"); -set global innodb_buf_flush_list_now = 1; -############################################################# -# INITIAL SETUP : Tablespace is created as unencrypted # -# A table is created and rows are inserted # -############################################################# -# Check that tablespace file is not encrypted yet -# Print result -table space is Unencrypted. -############################################################ -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -############################################################ -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -set global innodb_buf_flush_list_now = 1; -# Check that tablespace file is encrypted now -# Print result -table space is Encrypted. -############################################################ -# ALTER TABLESPACE 2 : Encrypted => Unencrypted # -############################################################ -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -set global innodb_buf_flush_list_now = 1; -# Check that tablespace file is not encrypted now -# Print result -table space is Unencrypted. - -################# CRASH/RECOVERY TESTING ################### - -############################################################ -# ALTER TABLESPACE 3 : Unencrypted => Encrypted # -# (crash at page 10) # -############################################################ -SELECT COUNT(*) FROM test.t1; -COUNT(*) -4096 -set global innodb_buf_flush_list_now = 1; -# Check that tablespace file is still unencrypted -# Print result -table space is Unencrypted. -# Set Encryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# Wait for Encryption processing to finish in background thread -# After restart/recovery, check that Encryption was roll-forward and -# tablespace file is encrypted now -# Print result -table space is Encrypted. -############################################################ -# ALTER TABLESPACE 4 : Encrypted => Unencrypted # -# (crash at page 10) # -############################################################ -SELECT COUNT(*) FROM test.t1; -COUNT(*) -4096 -# Check that tablespace file is Encrypted -# Print result -table space is Encrypted. -# Set Encryption process to crash after page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# Wait for Unencryption processing to finish in background thread -# After restart/recovery, check that Unencryption was roll-forward and -# tablespace file is Unencrypted now -# Print result -table space is Unencrypted. -########### -# CLEANUP # -########### -DROP TABLE test.t1; -DROP TABLESPACE encrypt_ts; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_5.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_5.test deleted file mode 100644 index 0b0b44ec827e..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_5.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc ---source include/big_test.inc -# --source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_5.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_7.result b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_7.result deleted file mode 100644 index 4ebaee88f2c1..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_7.result +++ /dev/null @@ -1,539 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# START : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -######### -# SETUP # -######### -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -#-------------------------- TEST 0 -------------------------------------# -######################################################################### -# RESTART 1 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -######################################################################## -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -# crash just before flushing page 0 at the end # -######################################################################## -# Set process to crash just before flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################### -# RESTART 2 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Encryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Encryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 3 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 4 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE 2 : Encrypted => Unencrypted # -# crash just before flushing page 0 at the end # -######################################################################## -# Set process to crash just before flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -######################################################################### -# RESTART 5 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 6 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 1 -------------------------------------# -######################################################################### -# RESTART 7 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -######################################################################## -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -# crash just before flushing page 0 at the end # -######################################################################## -# Set process to crash just before flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_before_flushing_page_0'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################### -# RESTART 8 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Encryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Encryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 9 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 10 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE 2 : Encrypted => Unencrypted # -# crash just before flushing page 0 at the end # -######################################################################## -# Set process to crash just before flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_before_flushing_page_0'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -######################################################################### -# RESTART 11 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 12 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 13 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -######################################################################## -# ALTER TABLESPACE 3 : Unencrypted => Encrypted # -# crash just after flushing page 0 at the end # -######################################################################## -# Set process to crash just after flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_flushing_page_0'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################### -# RESTART 14 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Encryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Encryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 15 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 16 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE 4 : Encrypted => Unencrypted # -# crash just after flushing page 0 at the end # -######################################################################## -# Set process to crash just after flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_flushing_page_0'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -######################################################################### -# RESTART 17 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 18 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 2 -------------------------------------# -######################################################################### -# RESTART 19 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE 5 : Encrypted => unencrypted # -# crash just before updating ts flags on page0 # -######################################################################## -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# Set process to crash just after flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_before_updating_flags'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -######################################################################### -# RESTART 20 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 21 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 22 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE 6 : Encrypted => unencrypted # -# crash just before resetting progress onpage 0 # -######################################################################## -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# Set process to crash just after flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_before_resetting_progress'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -######################################################################### -# RESTART 23 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 24: WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 3 -------------------------------------# -######################################################################### -# RESTART 25 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd'; -CREATE TABLE t1 (C CHAR(10)) TABLESPACE=encrypt_ts; -SET GLOBAL innodb_limit_optimistic_insert_debug=2; -INSERT INTO t1 VALUES("SOMEVALUE"); -INSERT INTO t1 VALUES("SOMEVALUE"); -INSERT INTO t1 VALUES("SOMEVALUE"); -INSERT INTO t1 VALUES("SOMEVALUE"); -INSERT INTO t1 VALUES("SOMEVALUE"); -INSERT INTO t1 VALUES("SOMEVALUE"); -INSERT INTO t1 VALUES("SOMEVALUE"); -# Make sure checkpoint is not moved -SET GLOBAL innodb_log_checkpoint_now = ON; -SET GLOBAL innodb_page_cleaner_disabled_debug = 1; -SET GLOBAL innodb_dict_stats_disabled_debug = 1; -SET GLOBAL innodb_master_thread_disabled_debug = 1; -# Following encryption will create a new tablespace key (KEY1) -# KEY1 will be written on REDO log -ALTER TABLESPACE encrypt_ts encryption='Y'; -# Following unencryption will remove tablespace key -ALTER TABLESPACE encrypt_ts encryption='N'; -SET SESSION debug= '+d,alter_encrypt_tablespace_page_6'; -SET SESSION debug= '+d,flush_each_dirtied_page'; -# Following encryption will create a new tablespace key (KEY2) -# KEY2 will be written on REDO log -# Flush dirtied pages encrypted with KEY2 before crash -ALTER TABLESPACE encrypt_ts encryption='Y'; -######################################################################### -# RESTART 26: WITH KEYRING PLUGIN after crash -######################################################################### -########### -# Cleanup # -########### -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_7.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_7.test deleted file mode 100644 index fdedd67834a7..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_7.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/big_test.inc ---source include/have_debug.inc -# --source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_7.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_8.result b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_8.result deleted file mode 100644 index 7b517f9f44d0..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_8.result +++ /dev/null @@ -1,47 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# RESTART 1 : WITH KEYRING -######################################################################### -SET SESSION debug= '+d,ddl_btree_build_insert_return_interrupt'; - -######### -# SETUP # -######### -CREATE PROCEDURE populate_t1() -BEGIN -DECLARE i int DEFAULT 1; -START TRANSACTION; -WHILE (i <= 10000) DO -INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); -SET i = i + 1; -END WHILE; -COMMIT; -END| -CREATE TABLE t1(class INT, id INT, title VARCHAR(100)) encryption='N'; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' encryption='N'; -ALTER TABLE t1 TABLESPACE=encrypt_ts, ALGORITHM=INPLACE; -ERROR 70100: Query execution was interrupted -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################### -# RESTART 2 : WITH KEYRING PLUGIN -######################################################################### -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -########### -# Cleanup # -########### -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -DROP PROCEDURE populate_t1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_8.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_8.test deleted file mode 100644 index d9d66aa407af..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_8.test +++ /dev/null @@ -1,7 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/no_valgrind_without_big.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_8.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_9.result b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_9.result deleted file mode 100644 index f9c7c5c933d7..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_9.result +++ /dev/null @@ -1,89 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# START : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -######### -# SETUP # -######### -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -############################################################# -# TEST 1 : CRASH DURING ALTER ENCRYPT A TABLESPACE. -############################################################# - -######################################################################### -# RESTART 1 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -############################################################ -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -# (crash at page 10) # -############################################################ -# Set Encryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SET GLOBAL innodb_log_checkpoint_now = ON; -SET GLOBAL innodb_page_cleaner_disabled_debug = 1; -SET GLOBAL innodb_dict_stats_disabled_debug = 1; -SET GLOBAL innodb_master_thread_disabled_debug = 1; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# Restart after crash without Keyring plugin loaded -# Taking backup of local manifest file for MySQL server instance -Pattern "CORRUPT LOG RECORD FOUND" found -# Server shouldn't have restarted, so query should fail. -SELECT * from test.t1 limit 10; -Got one of the listed errors -######################################################################### -# RESTART 2 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -# Server should have restarted properly. -SELECT * from test.t1 limit 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -########### -# Cleanup # -########### -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_9.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_9.test deleted file mode 100644 index 538f70fc2352..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_9.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc ---source include/big_test.inc ---source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_9.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_with_tables.result b/mysql-test/suite/component_keyring_kmip/t/tablespace_with_tables.result deleted file mode 100644 index 5be7d7b29e5a..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_with_tables.result +++ /dev/null @@ -1,1020 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# Pre-define user u1, which is used in different tests below. -CREATE USER u1@localhost; -GRANT ALL ON db1.* 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'; -# The test cases run ALTER TABLESPACE to check its encryption mode. -# The importance of this test is to check the way ALTER TABLESPACE -# updates the ENCRYPTION clause of tables in it. -# We run this command in various configuration as, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting per database default encryption to true/false. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - Check for warnings generated. -# -````````````````````````````````````````````````````````` -# Unencrypted TABLESPACE to Unencrypted TABLESPACE (Nop) -# [ALTER TABLESPACE] Case 1 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 2 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Encrypted TABLESPACE to Encrypted TABLESPACE (Nop) -# [ALTER TABLESPACE] Case 3 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 4 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 5 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Unencrypted TABLESPACE to encrypted TABLESPACE -# with database encryption default 'n' -# [ALTER TABLESPACE] Case 6 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Reject creating encrypted table in database with default encryption='n' -# [ALTER TABLESPACE] Case 7 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -ERROR HY000: This tablespace can't be encrypted, because one of table's schema has default encryption OFF and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3829 This tablespace can't be encrypted, because one of table's schema has default encryption OFF and user doesn't have enough privilege. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 8 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# With some tables without ENCRYPTION clause; -# [ALTER TABLESPACE] Case 9 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Reject creating encrypted table in database with default encryption='n' -# [ALTER TABLESPACE] Case 10 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -ERROR HY000: This tablespace can't be encrypted, because one of table's schema has default encryption OFF and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3829 This tablespace can't be encrypted, because one of table's schema has default encryption OFF and user doesn't have enough privilege. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 11 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# With all tables without ENCRYPTION clause; -# [ALTER TABLESPACE] Case 12 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Request to create encrypted tablespace with default_table_encryption='n' -# [ALTER TABLESPACE] Case 13 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -ERROR HY000: This tablespace can't be encrypted, because one of table's schema has default encryption OFF and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3829 This tablespace can't be encrypted, because one of table's schema has default encryption OFF and user doesn't have enough privilege. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 14 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Unencrypted TABLESPACE to encrypted TABLESPACE -# with database encryption 'y' -# [ALTER TABLESPACE] Case 15 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 16 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 17 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# Case 17.1 With some tables without ENCRYPTION clause; -# CREATE table using unencrypted tablespace without -# ENCRYPTION clause would inherit ENCRYPTION from database. -# This makes CREATE TABLE fail because the ENCRYPTION clause -# and the tablespace encryption type mismatches. The test -# encryption.create_table does test this. -# Case 17.2 With all tables without ENCRYPTION clause; -# Behavior would be same as described in Case 17.1 -````````````````````````````````````````````````````````` -# Encrypted TABLESPACE to unencrypted TABLESPACE -# with database encryption 'n' -# [ALTER TABLESPACE] Case 18 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 19 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 20 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Encrypted TABLESPACE to unencrypted TABLESPACE -# with database encryption 'y' -# [ALTER TABLESPACE] Case 21 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW WARNINGS; -Level Code Message -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='N' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='N' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Request to create unencrypted tablespace with default_table_encryption='y' -# [ALTER TABLESPACE] Case 22 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -ERROR HY000: This tablespace can't be decrypted, because one of table's schema has default encryption ON and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3830 This tablespace can't be decrypted, because one of table's schema has default encryption ON and user doesn't have enough privilege. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 23 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW WARNINGS; -Level Code Message -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='N' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='N' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# Clean up. -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_with_tables.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_with_tables.test deleted file mode 100644 index a1dcb972b8cf..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/tablespace_with_tables.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/encryption/tablespace_with_tables_tests.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/udf_test-master.opt b/mysql-test/suite/component_keyring_kmip/t/udf_test-master.opt deleted file mode 100644 index 61ad7d05024b..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/udf_test-master.opt +++ /dev/null @@ -1 +0,0 @@ -$KEYRING_UDF_OPT diff --git a/mysql-test/suite/component_keyring_kmip/t/udf_test.result b/mysql-test/suite/component_keyring_kmip/t/udf_test.result deleted file mode 100644 index f4ee49da948b..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/udf_test.result +++ /dev/null @@ -1,177 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kmip -# Creating local configuration file for keyring component: component_keyring_kmip -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# ---------------------------------------------------------------------- -# Setting up Keyring UDFs -INSTALL PLUGIN keyring_udf SONAME 'keyring_udf.so'; -CREATE FUNCTION keyring_key_store RETURNS INTEGER SONAME 'keyring_udf.so'; -CREATE FUNCTION keyring_key_generate RETURNS INTEGER SONAME 'keyring_udf.so'; -CREATE FUNCTION keyring_key_fetch RETURNS sTRING SONAME 'keyring_udf.so'; -CREATE FUNCTION keyring_key_type_fetch RETURNS STRING SONAME 'keyring_udf.so'; -CREATE FUNCTION keyring_key_length_fetch RETURNS INTEGER SONAME 'keyring_udf.so'; -CREATE FUNCTION keyring_key_remove RETURNS INTEGER SONAME 'keyring_udf.so'; -# ---------------------------------------------------------------------- -# Tests for AES key type -# keyring_key_generate tests -SELECT keyring_key_generate('AES_g1', 'AES', 16); -keyring_key_generate('AES_g1', 'AES', 16) -1 -SELECT keyring_key_generate('AES_g2', 'AES', 32); -keyring_key_generate('AES_g2', 'AES', 32) -1 -SELECT keyring_key_generate('AES_g3', 'AES', 64); -keyring_key_generate('AES_g3', 'AES', 64) -1 -# keyring_key_store tests -SELECT keyring_key_store('AES_s1', 'AES', 'Quick brown fox jumped over the lazy dog'); -keyring_key_store('AES_s1', 'AES', 'Quick brown fox jumped over the lazy dog') -1 -SELECT keyring_key_store('AES_s2', 'AES', 'Old MacDonald had a farm'); -keyring_key_store('AES_s2', 'AES', 'Old MacDonald had a farm') -1 -SELECT keyring_key_store('AES_s3', 'AES', 'Quis custodiet ipsos custodes'); -keyring_key_store('AES_s3', 'AES', 'Quis custodiet ipsos custodes') -1 -# keyring_key_fetch tests -SELECT keyring_key_fetch('AES_g1') INTO @aes_g1_fetched; -SELECT keyring_key_fetch('AES_g2') INTO @aes_g2_fetched; -SELECT keyring_key_fetch('AES_g3') INTO @aes_g3_fetched; -SELECT LENGTH(@aes_g1_fetched); -LENGTH(@aes_g1_fetched) -16 -SELECT LENGTH(@aes_g2_fetched); -LENGTH(@aes_g2_fetched) -32 -SELECT LENGTH(@aes_g3_fetched); -LENGTH(@aes_g3_fetched) -64 -SELECT keyring_key_fetch('AES_s1'); -keyring_key_fetch('AES_s1') -Quick brown fox jumped over the lazy dog -SELECT keyring_key_fetch('AES_s2'); -keyring_key_fetch('AES_s2') -Old MacDonald had a farm -SELECT keyring_key_fetch('AES_s3'); -keyring_key_fetch('AES_s3') -Quis custodiet ipsos custodes -# keyring key_type_fetch tests -SELECT keyring_key_type_fetch('AES_g1'); -keyring_key_type_fetch('AES_g1') -AES -SELECT keyring_key_type_fetch('AES_g2'); -keyring_key_type_fetch('AES_g2') -AES -SELECT keyring_key_type_fetch('AES_g3'); -keyring_key_type_fetch('AES_g3') -AES -SELECT keyring_key_type_fetch('AES_s1'); -keyring_key_type_fetch('AES_s1') -AES -SELECT keyring_key_type_fetch('AES_s2'); -keyring_key_type_fetch('AES_s2') -AES -SELECT keyring_key_type_fetch('AES_s3'); -keyring_key_type_fetch('AES_s3') -AES -# keyring key_length_fetch tests -SELECT keyring_key_length_fetch('AES_g1'); -keyring_key_length_fetch('AES_g1') -16 -SELECT keyring_key_length_fetch('AES_g2'); -keyring_key_length_fetch('AES_g2') -32 -SELECT keyring_key_length_fetch('AES_g3'); -keyring_key_length_fetch('AES_g3') -64 -SELECT keyring_key_length_fetch('AES_s1'); -keyring_key_length_fetch('AES_s1') -40 -SELECT keyring_key_length_fetch('AES_s2'); -keyring_key_length_fetch('AES_s2') -24 -SELECT keyring_key_length_fetch('AES_s3'); -keyring_key_length_fetch('AES_s3') -29 -# Restarting the server -# keyring_key_fetch tests after restart -SELECT keyring_key_fetch('AES_g1') INTO @aes_g1_fetched_after_restart; -SELECT keyring_key_fetch('AES_g2') INTO @aes_g2_fetched_after_restart; -SELECT keyring_key_fetch('AES_g3') INTO @aes_g3_fetched_after_restart; -SELECT LENGTH(@aes_g1_fetched_after_restart); -LENGTH(@aes_g1_fetched_after_restart) -16 -SELECT LENGTH(@aes_g2_fetched_after_restart); -LENGTH(@aes_g2_fetched_after_restart) -32 -SELECT LENGTH(@aes_g3_fetched_after_restart); -LENGTH(@aes_g3_fetched_after_restart) -64 -SELECT keyring_key_fetch('AES_s1'); -keyring_key_fetch('AES_s1') -Quick brown fox jumped over the lazy dog -SELECT keyring_key_fetch('AES_s2'); -keyring_key_fetch('AES_s2') -Old MacDonald had a farm -SELECT keyring_key_fetch('AES_s3'); -keyring_key_fetch('AES_s3') -Quis custodiet ipsos custodes -# keyring key_type_fetch tests after restart -SELECT keyring_key_type_fetch('AES_g1'); -keyring_key_type_fetch('AES_g1') -AES -SELECT keyring_key_type_fetch('AES_g2'); -keyring_key_type_fetch('AES_g2') -AES -SELECT keyring_key_type_fetch('AES_g3'); -keyring_key_type_fetch('AES_g3') -AES -# keyring key_length_fetch tests after restart -SELECT keyring_key_length_fetch('AES_g1'); -keyring_key_length_fetch('AES_g1') -16 -SELECT keyring_key_length_fetch('AES_g2'); -keyring_key_length_fetch('AES_g2') -32 -SELECT keyring_key_length_fetch('AES_g3'); -keyring_key_length_fetch('AES_g3') -64 -# keyring_key_remove tests -SELECT keyring_key_remove('AES_g1'); -keyring_key_remove('AES_g1') -1 -SELECT keyring_key_remove('AES_g2'); -keyring_key_remove('AES_g2') -1 -SELECT keyring_key_remove('AES_g3'); -keyring_key_remove('AES_g3') -1 -SELECT keyring_key_remove('AES_s1'); -keyring_key_remove('AES_s1') -1 -SELECT keyring_key_remove('AES_s2'); -keyring_key_remove('AES_s2') -1 -SELECT keyring_key_remove('AES_s3'); -keyring_key_remove('AES_s3') -1 -# ---------------------------------------------------------------------- -# Clean-up -DROP FUNCTION keyring_key_store; -DROP FUNCTION keyring_key_fetch; -DROP FUNCTION keyring_key_remove; -DROP FUNCTION keyring_key_generate; -DROP FUNCTION keyring_key_type_fetch; -DROP FUNCTION keyring_key_length_fetch; -UNINSTALL PLUGIN keyring_udf; -# ---------------------------------------------------------------------- -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kmip -# Removing global configuration file for keyring component: component_keyring_kmip -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/udf_test.test b/mysql-test/suite/component_keyring_kmip/t/udf_test.test deleted file mode 100644 index 14c151bf27d8..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/udf_test.test +++ /dev/null @@ -1,8 +0,0 @@ ---source include/have_component_keyring_kmip.inc -# Keyring UDF tests with component_keyring_kmip -# ---let $skip_secret_tests = 1 - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/keyring_udf_test.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_basic.result b/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_basic.result deleted file mode 100644 index 15451ea69483..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_basic.result +++ /dev/null @@ -1,178 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kmip -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# WL#9289 InnoDB transparent tablespace data encryption for undo log -# create bootstrap file -# Stop the MTR default DB server -# Test1: bootstrap with 2 undo tablespaces and with keyring. -# Run the bootstrap command with keyring -# Start the DB server with undo log encryption disabled, and no keyring. -# Taking backup of global manifest file for MySQL server -# Enable undo log encryption, should report error in server log, since keyring is not loaded. -SET GLOBAL innodb_undo_log_encrypt = ON; -Warnings: -Warning 7014 InnoDB: Undo log can't be encrypted if the keyring is not loaded. -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -# Start the DB server with undo log encryption disabled and keyring loaded. It should success. -# Restore global manifest file for MySQL server from backup -# Enable undo log encryption, shouldn't report error in server log. -SET GLOBAL innodb_undo_log_encrypt = ON; -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION='Y' ENGINE = InnoDB; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ENCRYPTION='Y' -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -CREATE TABLE t2(c1 INT, c2 char(20)) ENGINE = InnoDB; -INSERT INTO t2 select * from t1; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -SELECT * FROM t2 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -# Start the DB server with undo log encryption enabled and keyring loaded. It should success. -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -SELECT * FROM t2 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -DROP TABLE t1,t2; -# Search for particular string of encryption metadata, should success since it's encrypted. -Pattern "lCC" found -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB; -START TRANSACTION; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -SET GLOBAL innodb_undo_log_encrypt = OFF; -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -SET GLOBAL innodb_undo_log_encrypt = ON; -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -COMMIT; -START TRANSACTION; -INSERT INTO t1 VALUES(6, "ggggg"); -SET GLOBAL innodb_undo_log_encrypt = OFF; -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -SET GLOBAL innodb_undo_log_encrypt = ON; -INSERT INTO t1 VALUES(9, "jjjjj"); -# Kill and restart to confirm the encryption info can be retrieved properly. -# Kill the server -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -DELETE FROM t1; -START TRANSACTION; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -# Start the DB server with undo log encryption disabled and keyring loaded. It should succeed. -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -ALTER INSTANCE ROTATE INNODB MASTER KEY; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -FLUSH ENGINE LOGS; -# Start the DB server with undo log encryption and keyring loaded. It should success. -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -# Cleanup -DROP TABLE t1; -# restart the server with MTR default -# Remove residue files -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kmip -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_basic.test b/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_basic.test deleted file mode 100644 index 9a46659bf16a..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_basic.test +++ /dev/null @@ -1,11 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/big_test.inc ---source include/not_parallel.inc ---source include/no_valgrind_without_big.inc ---source include/have_innodb_max_16k.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/mats/undo_encrypt_basic.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_bootstrap.result b/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_bootstrap.result deleted file mode 100644 index 2e13afd45829..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_bootstrap.result +++ /dev/null @@ -1,45 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kmip -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# create bootstrap file -# Stop the MTR default DB server -# Taking backup of global manifest file for MySQL server -# Run the bootstrap command with no keyring -# Restore global manifest file for MySQL server from backup -# Run the bootstrap command with keyring -# Search for particular string of encryption metadata, should success since it's encrypted. -Pattern "lCC" found -# Taking backup of global manifest file for MySQL server -# Start the DB server with undo log encryption disabled and keyring loaded. It should success. -# Restore global manifest file for MySQL server from backup -SET GLOBAL innodb_undo_log_encrypt = ON; -CREATE TABLE tab1(c1 INT, c2 VARCHAR(30)); -START TRANSACTION; -INSERT INTO tab1 VALUES (100,REPEAT('a',5)),(200,REPEAT('b',5)); -SELECT * FROM tab1; -c1 c2 -100 aaaaa -200 bbbbb -COMMIT; -SET GLOBAL innodb_undo_log_encrypt = OFF; -START TRANSACTION; -INSERT INTO tab1 VALUES (300,REPEAT('a',5)),(400,REPEAT('b',5)); -COMMIT; -SELECT * FROM tab1; -c1 c2 -100 aaaaa -200 bbbbb -300 aaaaa -400 bbbbb -DROP TABLE tab1; -Pattern "lCC" found -Pattern "lCC" found -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kmip -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_bootstrap.test b/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_bootstrap.test deleted file mode 100644 index f01d882c1dce..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_bootstrap.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/big_test.inc ---source include/not_parallel.inc ---source include/big_test.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/mats/undo_encrypt_bootstrap.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_crash.result b/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_crash.result deleted file mode 100644 index f66c0f02f176..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_crash.result +++ /dev/null @@ -1,44 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kmip -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# bug#30209760 : ASSERTION FAILURE: SRV0START.CC:969:SUCCESS THREAD -# -######### -# SETUP # -######### -# Create path for ibdata* & undo* files -# create bootstrap file -# Stop the MTR default DB server -######################################################################### -# INITIALIZE NEW SERVER -######################################################################### -# Taking backup of global manifest file for MySQL server -# Server should be initialized successfully. -######################################################################### -# RESTART 2 : WITH KEYRING. -innodb_undo_log_encrypt=ON. -Crash server before purge thread could start. -######################################################################### -# Restore global manifest file for MySQL server from backup -######################################################################### -# RESTART 3 : WITH KEYRING. -innodb_undo_log_encrypt=ON. -Skip rotating default master key in master thread -######################################################################### -######################################################################### -# RESTART 4 : WITH KEYRING. -innodb_undo_log_encrypt=OFF. -######################################################################### -########### -# CLEANUP # -########### -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kmip -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_crash.test b/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_crash.test deleted file mode 100644 index b9fefb274707..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/undo_encrypt_crash.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/big_test.inc ---source include/not_parallel.inc ---source include/have_debug.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/innodb/undo_encrypt_crash.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kmip/t/undo_tablespace_encrypt.result b/mysql-test/suite/component_keyring_kmip/t/undo_tablespace_encrypt.result deleted file mode 100644 index 372e54ff2684..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/undo_tablespace_encrypt.result +++ /dev/null @@ -1,82 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kmip -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# Bug #29492911 : ENABLING UNDO-TABLESPACE ENCRYPTION DOESN'T MARK TABLESPACE ENCRYPTION FLAG -# -SHOW VARIABLES LIKE "%innodb_undo_log_encrypt%"; -Variable_name Value -innodb_undo_log_encrypt OFF -# Taking backup of global manifest file for MySQL server -############################################################################### -# With keyring and innodb_undo_log_encrypt=ON -############################################################################### -# Restore global manifest file for MySQL server from backup -SHOW VARIABLES LIKE "%innodb_undo_log_encrypt%"; -Variable_name Value -innodb_undo_log_encrypt ON -# Create a new UNDO tablespace. Should be created as ENCRYPTED. -CREATE UNDO TABLESPACE undo_3 ADD DATAFILE 'undo_3.ibu'; -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo Y active -innodb_undo_002 Undo Y active -undo_3 Undo Y active -SET GLOBAL innodb_undo_log_encrypt=OFF; -SHOW VARIABLES LIKE "%innodb_undo_log_encrypt%"; -Variable_name Value -innodb_undo_log_encrypt OFF -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo N active -innodb_undo_002 Undo N active -undo_3 Undo N active -# Create a new UNDO tablespace. Should be created as UNENCRYPTED. -CREATE UNDO TABLESPACE undo_4 ADD DATAFILE 'undo_4.ibu'; -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo N active -innodb_undo_002 Undo N active -undo_3 Undo N active -undo_4 Undo N active -SET GLOBAL innodb_undo_log_encrypt=ON; -SHOW VARIABLES LIKE "%innodb_undo_log_encrypt%"; -Variable_name Value -innodb_undo_log_encrypt ON -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo Y active -innodb_undo_002 Undo Y active -undo_3 Undo Y active -undo_4 Undo Y active -############################################################################### -# With keyring and innodb_undo_log_encrypt=OFF -############################################################################### -ALTER UNDO TABLESPACE undo_3 set INACTIVE; -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo N active -innodb_undo_002 Undo N active -undo_3 Undo N inactive -undo_4 Undo N active -DROP UNDO TABLESPACE undo_3; -ALTER UNDO TABLESPACE undo_4 set INACTIVE; -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo N active -innodb_undo_002 Undo N active -undo_4 Undo N inactive -DROP UNDO TABLESPACE undo_4; -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo N active -innodb_undo_002 Undo N active -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kmip -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kmip/t/undo_tablespace_encrypt.test b/mysql-test/suite/component_keyring_kmip/t/undo_tablespace_encrypt.test deleted file mode 100644 index fcec7366a070..000000000000 --- a/mysql-test/suite/component_keyring_kmip/t/undo_tablespace_encrypt.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kmip.inc ---source include/big_test.inc ---source include/not_parallel.inc ---source include/have_innodb_16k.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/innodb/undo_tablespace_encrypt.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kms/inc/setup_component.inc b/mysql-test/suite/component_keyring_kms/inc/setup_component.inc deleted file mode 100644 index 8dce882ff8f0..000000000000 --- a/mysql-test/suite/component_keyring_kms/inc/setup_component.inc +++ /dev/null @@ -1,34 +0,0 @@ -# Setup test to use keyring component - -# Used environment variables: -# KMS_REGION -# KMS_KEY -# KMS_AUTH_KEY -# KMS_SECURE_ACCESS_KEY - ---echo # ---------------------------------------------------------------------- ---echo # Setup - ---let PLUGIN_DIR_OPT = $KEYRING_KMS_COMPONENT_OPT - -# Data directory location ---let CURRENT_DATADIR = `SELECT @@datadir` - ---let COMPONENT_LIBRARY = `SELECT SUBSTRING_INDEX('$KEYRING_KMS_COMPONENT_LOAD', '=', -1)` ---let COMPONENT_DIR = $KEYRING_KMS_COMPONENT_DIR ---let COMPONENT_NAME = `SELECT SUBSTRING_INDEX('$COMPONENT_LIBRARY', '.', 1)` ---source include/keyring_tests/helper/global_keyring_create_config.inc - -# Create local keyring config ---let KEYRING_KMS_PATH = `SELECT CONCAT( '$MYSQLTEST_VARDIR', '/keyring_kms')` ---let KEYRING_CONFIG_CONTENT = `SELECT CONCAT('{ \"path\": \"', '$KEYRING_KMS_PATH', '\", \"region\": \"', '$KMS_REGION', '\", \"kms_key\": \"', '$KMS_KEY', '\", \"auth_key\": \"', '$KMS_AUTH_KEY', '\", \"secret_access_key\": \"', '$KMS_SECRET_ACCESS_KEY', '\", \"read_only\": false }')` ---source include/keyring_tests/helper/local_keyring_create_config.inc - -# Create local manifest file for current server instance ---let LOCAL_MANIFEST_CONTENT = `SELECT CONCAT('{ \"components\": \"file://', '$COMPONENT_NAME', '\" }')` ---source include/keyring_tests/helper/instance_create_manifest.inc - -# Restart server with manifest file ---source include/keyring_tests/helper/start_server_with_manifest.inc ---echo # ---------------------------------------------------------------------- - diff --git a/mysql-test/suite/component_keyring_kms/inc/setup_component_customized.inc b/mysql-test/suite/component_keyring_kms/inc/setup_component_customized.inc deleted file mode 100644 index 5304306f1977..000000000000 --- a/mysql-test/suite/component_keyring_kms/inc/setup_component_customized.inc +++ /dev/null @@ -1,23 +0,0 @@ -# Setup test to use keyring component - ---echo # ---------------------------------------------------------------------- ---echo # Setup - ---let PLUGIN_DIR_OPT = $KEYRING_KMS_COMPONENT_OPT - ---let COMPONENT_LIBRARY = `SELECT SUBSTRING_INDEX('$KEYRING_KMS_COMPONENT_LOAD', '=', -1)` ---let COMPONENT_DIR = $KEYRING_KMS_COMPONENT_DIR ---let COMPONENT_NAME = `SELECT SUBSTRING_INDEX('$COMPONENT_LIBRARY', '.', 1)` ---let GLOBAL_MANIFEST_CONTENT = `SELECT CONCAT('{ \"components\": \"file://', '$COMPONENT_NAME', '\" }')` -# Create manifest file for mysqld binary ---source include/keyring_tests/helper/binary_create_customized_manifest.inc - -# Create global keyring config ---let KEYRING_KMS_PATH = `SELECT CONCAT( '$MYSQLTEST_VARDIR', '/keyring_kms')` ---let KEYRING_CONFIG_CONTENT = `SELECT CONCAT('{ \"path\": \"', '$KEYRING_KMS_PATH', '\", \"region\": \"', '$KMS_REGION', '\", \"kms_key\": \"', '$KMS_KEY', '\", \"auth_key\": \"', '$KMS_AUTH_KEY', '\", \"secret_access_key\": \"', '$KMS_SECRET_ACCESS_KEY', '\", \"read_only\": false }')` ---source include/keyring_tests/helper/global_keyring_create_customized_config.inc - -# Restart server with manifest file ---source include/keyring_tests/helper/start_server_with_manifest.inc ---echo # ---------------------------------------------------------------------- - diff --git a/mysql-test/suite/component_keyring_kms/inc/teardown_component.inc b/mysql-test/suite/component_keyring_kms/inc/teardown_component.inc deleted file mode 100644 index 851f15551049..000000000000 --- a/mysql-test/suite/component_keyring_kms/inc/teardown_component.inc +++ /dev/null @@ -1,19 +0,0 @@ -# Teardown - ---echo # ---------------------------------------------------------------------- ---echo # Teardown -# Remove local manifest file for current server instance ---source include/keyring_tests/helper/instance_remove_manifest.inc - -# Remove keyring kms ---source include/keyring_tests/helper/local_keyring_kms_remove.inc - -# Remove local keyring config ---source include/keyring_tests/helper/local_keyring_remove_config.inc - -# Remove global keyring config ---source include/keyring_tests/helper/global_keyring_remove_config.inc - -# Restart server without manifest file ---source include/keyring_tests/helper/cleanup_server_with_manifest.inc ---echo # ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/inc/teardown_component_customized.inc b/mysql-test/suite/component_keyring_kms/inc/teardown_component_customized.inc deleted file mode 100644 index a09667e487e8..000000000000 --- a/mysql-test/suite/component_keyring_kms/inc/teardown_component_customized.inc +++ /dev/null @@ -1,15 +0,0 @@ -# Teardown - ---echo # ---------------------------------------------------------------------- ---echo # Teardown ---source include/keyring_tests/helper/local_keyring_kms_remove.inc - -# Drop global keyring config ---source include/keyring_tests/helper/global_keyring_remove_config.inc - -# Remove manifest file for mysqld binary ---source include/keyring_tests/helper/binary_remove_manifest.inc - -# Restart server without manifest file ---source include/keyring_tests/helper/cleanup_server_with_manifest.inc ---echo # ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/alter_rename_table.result b/mysql-test/suite/component_keyring_kms/r/alter_rename_table.result deleted file mode 100644 index 0108bff30b87..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/alter_rename_table.result +++ /dev/null @@ -1,1779 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# 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'; -# The test cases run ALTER TABLE RENAME to move tables from one database -# to another, with tables using file-per-table or general -# tablespace. And these operations are run in below configuration, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting per database default encryption to 'y' and 'n' -# - Setting table's encryption mode to 'y' and 'n'. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - -# - Check for warnings generated. -# -````````````````````````````````````````````````````````` -# Test using innodb_file_per_table tablespace. -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=false -# [ALTER TABLE ... RENAME ...] Case 1 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# 1.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 1.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 1.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -# [ALTER TABLE ... RENAME ...] Case 2 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# 2.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 2.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 2.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 3 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# 3.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 3.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 3.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt2 -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -# [ALTER TABLE ... RENAME ...] Case 4 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 4.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 4.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 4.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 5 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# 5.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 5.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 5.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt2 -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -# [ALTER TABLE ... RENAME ...] Case 6 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 6.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 6.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 6.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -````````````````````````````````````````````````````````` -# Test using general tablespace. -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=false -# [ALTER TABLE ... RENAME ...] Case 7 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# 7.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 7.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 7.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 8 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# 8.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 8.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 8.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 9 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# 9.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 9.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 9.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt2 -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 10 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 10.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 10.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 10.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 11 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# 11.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 11.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 11.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt2 -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 12 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 12.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 12.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 12.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=false -# [ALTER TABLE ... RENAME ...] Case 13 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# 13.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30); -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 13.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30); -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 13.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 14 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# 14.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30); -# 14.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30); -# 14.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 15 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# 15.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 15.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 15.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt2 -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 16 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 16.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30); -# 16.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30); -# 16.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 17 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# 17.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30); -# 17.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30); -# 17.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt2 -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 18 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 18.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30); -# 18.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30); -# 18.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=false -# [ALTER TABLE ... RENAME ...] Case 19 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# 19.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30); -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 19.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30); -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 19.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 20 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# 20.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30); -# 20.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30); -# 20.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 21 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# 21.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 21.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 21.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt2 -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 22 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 22.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30); -# 22.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30); -# 22.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 23 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# 23.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30); -# 23.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30); -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30); -# 23.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt2 -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 24 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 24.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30); -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30); -# 24.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30); -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30); -# 24.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30); -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30); -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# Cleanup -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/alter_table.result b/mysql-test/suite/component_keyring_kms/r/alter_table.result deleted file mode 100644 index 37c503183eb0..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/alter_table.result +++ /dev/null @@ -1,2862 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# Pre-define user u1, which is used in different tests below. -CREATE USER u1@localhost; -GRANT ALL ON db1.* 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'; -# This test run ALTER TABLE in different configurations, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting default_table_encryption to true/false. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - Test SHOW CREATE TABLE -# - Test INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS -# - Check for warnings generated. -# -# See comments in alter_table.inc for more details. -````````````````````````````````````````````````````````` -# Test using user tablespace 'ts1' -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=OFF and default per-db encryption OFF -# [ALTER TABLE] Case 1 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 2 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# Moving encrypted tablespace to unencrypted tablespace is rejected. -# [ALTER TABLE] Case 3 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 ENCRYPTION='y' -t3 -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 4 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=OFF and default per-db encryption ON -# [ALTER TABLE] Case 5 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 6 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# Moving encrypted tablespace to unencrypted tablespace is rejected. -# [ALTER TABLE] Case 7 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='y' -t3 ENCRYPTION='n' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 8 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=ON and default per-db encryption OFF -# [ALTER TABLE] Case 9 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# Request to create encrypted table to unencrypted database is rejected. -# [ALTER TABLE] Case 10 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 11 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -# Grant TABLE_ENCRYPTION_ADMIN if requested. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# Moving encrypted tablespace to unencrypted tablespace is rejected. -# [ALTER TABLE] Case 12 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 ENCRYPTION='y' -t3 -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 13 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=ON and default per-db encryption ON -# [ALTER TABLE] Case 14 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 15 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 16 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# Moving encrypted tablespace to unencrypted tablespace is rejected. -# [ALTER TABLE] Case 17 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -# Grant TABLE_ENCRYPTION_ADMIN if requested. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='y' -t3 ENCRYPTION='n' -t4 ENCRYPTION='y' -# Cleanup -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -# [ALTER TABLE] Case 18 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=ts1 ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# Using 'innodb_system' tablespace -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=OFF and default per-db encryption OFF -# [ALTER TABLE] Case 19 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 20 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 -t3 ENCRYPTION='y' -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 21 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 ENCRYPTION='y' -t3 -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 22 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=OFF and default per-db encryption ON -# [ALTER TABLE] Case 23 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 24 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='n' -t3 ENCRYPTION='y' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 25 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='y' -t3 ENCRYPTION='n' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 26 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=ON and default per-db encryption OFF -# [ALTER TABLE] Case 27 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Request to create encrypted table to unencrypted database is rejected. -# [ALTER TABLE] Case 28 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 29 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -# Grant TABLE_ENCRYPTION_ADMIN if requested. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 -t3 ENCRYPTION='y' -t4 -# Cleanup -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 30 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 ENCRYPTION='y' -t3 -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 31 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=ON and default per-db encryption ON -# [ALTER TABLE] Case 32 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 33 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='n' -t3 ENCRYPTION='y' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Request to create unencrypted table under database with default -# encryption=ON is rejected. -# [ALTER TABLE] Case 34 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 35 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -# Grant TABLE_ENCRYPTION_ADMIN if requested. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='y' -t3 ENCRYPTION='n' -t4 ENCRYPTION='y' -# Cleanup -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Creating a encrypted table is rejected in system tablespace -# [ALTER TABLE] Case 36 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Test using 'innodb_file_per_table' -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=OFF and default per-db encryption OFF -# [ALTER TABLE] Case 37 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 38 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 39 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 40 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=OFF and default per-db encryption ON -# [ALTER TABLE] Case 41 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 42 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 43 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 44 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=ON and default per-db encryption OFF -# [ALTER TABLE] Case 45 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Request to create encrypted table to database with default -# encryption=OFF is rejected. -# [ALTER TABLE] Case 46 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 47 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -# Grant TABLE_ENCRYPTION_ADMIN if requested. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 48 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 -t2 -t3 -t4 -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 49 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=ON and default per-db encryption ON -# [ALTER TABLE] Case 50 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 51 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -````````````````````````````````````````````````````````` -# Request to create unencrypted table to database with default -# encryption=ON is rejected. -# [ALTER TABLE] Case 52 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `tsA` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 53 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -# Grant TABLE_ENCRYPTION_ADMIN if requested. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -t2 ENCRYPTION='n' -t3 ENCRYPTION='n' -t4 ENCRYPTION='n' -# Cleanup -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE tsA; -# [ALTER TABLE] Case 54 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLESPACE tsA ADD DATAFILE 'ts_a.ibd' ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.t3 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -CREATE TABLE db1.t4 (f1 int) TABLESPACE=tsA ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Run ALTER TABLE and check for errors/warnings -ALTER TABLE db1.t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t2 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t3 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ALTER TABLE db1.t4 TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# Verify the ENCRYPTION clause value. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_SCHEMA='db1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -t2 ENCRYPTION='y' -t3 ENCRYPTION='y' -t4 ENCRYPTION='y' -# Cleanup -DROP DATABASE db1; -DROP TABLESPACE tsA; -# Cleanup -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/clone_local_encrypt.result b/mysql-test/suite/component_keyring_kms/r/clone_local_encrypt.result deleted file mode 100644 index e91773250865..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/clone_local_encrypt.result +++ /dev/null @@ -1,481 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kms -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Prepare for creating Encrypted Table -# create bootstrap file -# Create and start mysqld with keyring plugin. -## Install plugin -INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN'; -CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB); -CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) -PARTITION BY KEY(col1) PARTITIONS 5; -CREATE PROCEDURE execute_dml( -p_dml_type INT, -p_key_min INT, -p_key_range INT, -p_loop_count INT, -p_frequency INT, -p_is_rand INT) -BEGIN -DECLARE v_idx INT DEFAULT 0; -DECLARE v_commit INT DEFAULT 0; -DECLARE v_key INT DEFAULT 0; -/* Loop and INSERT data at random position */ -WHILE(v_idx < p_loop_count) DO -/* Generate key between 1 to p_loop_count */ -IF p_is_rand = 1 THEN -SET v_key = p_key_min + FLOOR(RAND() * p_key_range); -ELSE -SET v_key = p_key_min + (v_idx % p_key_range); -END IF; -CASE p_dml_type -WHEN 0 THEN -SET @clol3_text = CONCAT('Clone Test Row - ', v_key); -INSERT INTO t1 VALUES(v_key, v_key * 10, -@clol3_text, REPEAT('Large Column Data ', 2048)) -ON DUPLICATE KEY UPDATE col2 = col2 + 1; -INSERT INTO t2 VALUES(v_key, v_key * 10, -@clol3_text, REPEAT('Large Column Data ', 2048)) -ON DUPLICATE KEY UPDATE col2 = col2 + 1; -WHEN 1 THEN -UPDATE t1 SET col2 = v_idx + 1 WHERE col1 = v_key; -UPDATE t2 SET col2 = v_idx + 1 WHERE col1 = v_key; -WHEN 2 THEN -DELETE FROM t1 WHERE col1 = v_key; -DELETE FROM t2 WHERE col1 = v_key; -ELSE -DELETE FROM t1; -DELETE FROM t2; -END CASE; -SET v_idx = v_idx + 1; -/* Commit or rollback work at specified frequency. */ -IF v_idx % p_frequency = 0 THEN -SET v_commit = FLOOR(RAND() * 2); -IF v_commit = 0 AND p_is_rand = 1 THEN -ROLLBACK; -START TRANSACTION; -ELSE -COMMIT; -START TRANSACTION; -END IF; -END IF; -END WHILE; -END| -# In connection default - starting clone -SET DEBUG_SYNC = 'clone_file_copy SIGNAL set_encryption WAIT_FOR resume_clone'; -SET GLOBAL clone_autotune_concurrency = OFF; -SET GLOBAL clone_max_concurrency = 8; -CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR'; -# In connection con1 - Set redo and undo encryption -SET DEBUG_SYNC = 'now WAIT_FOR set_encryption'; -SHOW VARIABLES LIKE 'innodb_redo_log_encrypt'; -Variable_name Value -innodb_redo_log_encrypt OFF -SET GLOBAL innodb_redo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_redo_log_encrypt'; -Variable_name Value -innodb_redo_log_encrypt ON -SHOW VARIABLES LIKE 'innodb_undo_log_encrypt'; -Variable_name Value -innodb_undo_log_encrypt OFF -SET GLOBAL innodb_undo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_undo_log_encrypt'; -Variable_name Value -innodb_undo_log_encrypt ON -SET DEBUG_SYNC = 'now SIGNAL resume_clone'; -# In connection default - finishing Clone -SET GLOBAL innodb_redo_log_encrypt = OFF; -SET GLOBAL innodb_undo_log_encrypt = OFF; -DROP TABLE t1; -DROP TABLE t2; -CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) -ROW_FORMAT = COMPRESSED ENCRYPTION = "Y"; -CREATE TABLESPACE tbs1 ADD DATAFILE 'tbs1_data1.ibd' ENCRYPTION="Y"; -CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) -ENCRYPTION="Y" TABLESPACE = tbs1; -SET GLOBAL innodb_redo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_redo_log_encrypt'; -Variable_name Value -innodb_redo_log_encrypt ON -SET GLOBAL innodb_undo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_undo_log_encrypt'; -Variable_name Value -innodb_undo_log_encrypt ON -call execute_dml(0, 0, 200, 200, 100, 0); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SELECT count(*) from t1; -count(*) -200 -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -SELECT count(*) from t2; -count(*) -200 -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SET GLOBAL innodb_buf_flush_list_now = 1; -SET GLOBAL clone_autotune_concurrency = OFF; -SET GLOBAL clone_max_concurrency = 8; -CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR'; -select ID, STATE, ERROR_NO from performance_schema.clone_status; -ID STATE ERROR_NO -1 Completed 0 -select ID, STAGE, STATE from performance_schema.clone_progress; -ID STAGE STATE -1 DROP DATA Completed -1 FILE COPY Completed -1 PAGE COPY Completed -1 REDO COPY Completed -1 FILE SYNC Completed -1 RESTART Not Started -1 RECOVERY Not Started -# Restart cloned database -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SELECT count(*) from t1; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -SELECT count(*) from t2; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -call execute_dml(3, 0, 1, 1, 1, 0); -call execute_dml(0, 0, 200, 200, 100, 0); -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SET GLOBAL innodb_redo_log_encrypt = ON; -SET GLOBAL innodb_undo_log_encrypt = ON; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -# In connection default - Cloning database -SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1'; -SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2'; -SET GLOBAL clone_autotune_concurrency = OFF; -SET GLOBAL clone_max_concurrency = 8; -CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR'; -# In connection con1 - Running Update Random [0 - 200 Key Range] -SET DEBUG_SYNC = 'now WAIT_FOR start_dml1'; -START TRANSACTION; -CALL execute_dml(1, 0, 200, 500, 100, 1); -COMMIT; -# Flush all dirty buffers -SET GLOBAL innodb_buf_flush_list_now = 1; -SET DEBUG_SYNC = 'now SIGNAL resume_clone1'; -SET DEBUG_SYNC = 'now WAIT_FOR start_dml2'; -START TRANSACTION; -CALL execute_dml(1, 0, 200, 500, 100, 1); -COMMIT; -SET DEBUG_SYNC = 'now SIGNAL resume_clone2'; -# In connection default - Cloning database -# Restart cloned database -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SELECT count(*) from t1; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -SELECT count(*) from t2; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -call execute_dml(3, 0, 1, 1, 1, 0); -call execute_dml(0, 0, 200, 200, 100, 0); -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -DROP TABLE t1; -DROP TABLE t2; -DROP PROCEDURE execute_dml; -DROP TABLESPACE tbs1; -UNINSTALL PLUGIN clone; -SET DEBUG_SYNC = 'RESET'; -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kms -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/clone_remote_encrypt.result b/mysql-test/suite/component_keyring_kms/r/clone_remote_encrypt.result deleted file mode 100644 index bfc97fae4480..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/clone_remote_encrypt.result +++ /dev/null @@ -1,484 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kms -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Prepare for creating Encrypted Table -# create bootstrap file -# Create and start mysqld with keyring plugin. -## Install plugin -INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN'; -CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB); -CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) -PARTITION BY KEY(col1) PARTITIONS 5; -CREATE PROCEDURE execute_dml( -p_dml_type INT, -p_key_min INT, -p_key_range INT, -p_loop_count INT, -p_frequency INT, -p_is_rand INT) -BEGIN -DECLARE v_idx INT DEFAULT 0; -DECLARE v_commit INT DEFAULT 0; -DECLARE v_key INT DEFAULT 0; -/* Loop and INSERT data at random position */ -WHILE(v_idx < p_loop_count) DO -/* Generate key between 1 to p_loop_count */ -IF p_is_rand = 1 THEN -SET v_key = p_key_min + FLOOR(RAND() * p_key_range); -ELSE -SET v_key = p_key_min + (v_idx % p_key_range); -END IF; -CASE p_dml_type -WHEN 0 THEN -SET @clol3_text = CONCAT('Clone Test Row - ', v_key); -INSERT INTO t1 VALUES(v_key, v_key * 10, -@clol3_text, REPEAT('Large Column Data ', 2048)) -ON DUPLICATE KEY UPDATE col2 = col2 + 1; -INSERT INTO t2 VALUES(v_key, v_key * 10, -@clol3_text, REPEAT('Large Column Data ', 2048)) -ON DUPLICATE KEY UPDATE col2 = col2 + 1; -WHEN 1 THEN -UPDATE t1 SET col2 = v_idx + 1 WHERE col1 = v_key; -UPDATE t2 SET col2 = v_idx + 1 WHERE col1 = v_key; -WHEN 2 THEN -DELETE FROM t1 WHERE col1 = v_key; -DELETE FROM t2 WHERE col1 = v_key; -ELSE -DELETE FROM t1; -DELETE FROM t2; -END CASE; -SET v_idx = v_idx + 1; -/* Commit or rollback work at specified frequency. */ -IF v_idx % p_frequency = 0 THEN -SET v_commit = FLOOR(RAND() * 2); -IF v_commit = 0 AND p_is_rand = 1 THEN -ROLLBACK; -START TRANSACTION; -ELSE -COMMIT; -START TRANSACTION; -END IF; -END IF; -END WHILE; -END| -# In connection default - starting clone -SET DEBUG_SYNC = 'clone_file_copy SIGNAL set_encryption WAIT_FOR resume_clone'; -SET GLOBAL clone_autotune_concurrency = OFF; -SET GLOBAL clone_max_concurrency = 8; -SET GLOBAL clone_valid_donor_list = 'HOST:PORT'; -CLONE INSTANCE FROM USER@HOST:PORT IDENTIFIED BY '' DATA DIRECTORY = 'CLONE_DATADIR'; -# In connection con1 - Set redo and undo encryption -SET DEBUG_SYNC = 'now WAIT_FOR set_encryption'; -SHOW VARIABLES LIKE 'innodb_redo_log_encrypt'; -Variable_name Value -innodb_redo_log_encrypt OFF -SET GLOBAL innodb_redo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_redo_log_encrypt'; -Variable_name Value -innodb_redo_log_encrypt ON -SHOW VARIABLES LIKE 'innodb_undo_log_encrypt'; -Variable_name Value -innodb_undo_log_encrypt OFF -SET GLOBAL innodb_undo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_undo_log_encrypt'; -Variable_name Value -innodb_undo_log_encrypt ON -SET DEBUG_SYNC = 'now SIGNAL resume_clone'; -# In connection default - finishing Clone -SET GLOBAL innodb_redo_log_encrypt = OFF; -SET GLOBAL innodb_undo_log_encrypt = OFF; -DROP TABLE t1; -DROP TABLE t2; -CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) -ROW_FORMAT = COMPRESSED ENCRYPTION = "Y"; -CREATE TABLESPACE tbs1 ADD DATAFILE 'tbs1_data1.ibd' ENCRYPTION="Y"; -CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) -ENCRYPTION="Y" TABLESPACE = tbs1; -SET GLOBAL innodb_redo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_redo_log_encrypt'; -Variable_name Value -innodb_redo_log_encrypt ON -SET GLOBAL innodb_undo_log_encrypt = ON; -SHOW VARIABLES LIKE 'innodb_undo_log_encrypt'; -Variable_name Value -innodb_undo_log_encrypt ON -call execute_dml(0, 0, 200, 200, 100, 0); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SELECT count(*) from t1; -count(*) -200 -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -SELECT count(*) from t2; -count(*) -200 -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SET GLOBAL innodb_buf_flush_list_now = 1; -SET GLOBAL clone_autotune_concurrency = OFF; -SET GLOBAL clone_max_concurrency = 8; -SET GLOBAL clone_valid_donor_list = 'HOST:PORT'; -CLONE INSTANCE FROM USER@HOST:PORT IDENTIFIED BY '' DATA DIRECTORY = 'CLONE_DATADIR'; -select ID, STATE, ERROR_NO from performance_schema.clone_status; -ID STATE ERROR_NO -1 Completed 0 -select ID, STAGE, STATE from performance_schema.clone_progress; -ID STAGE STATE -1 DROP DATA Completed -1 FILE COPY Completed -1 PAGE COPY Completed -1 REDO COPY Completed -1 FILE SYNC Completed -1 RESTART Not Started -1 RECOVERY Not Started -# Restart cloned database -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SELECT count(*) from t1; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -SELECT count(*) from t2; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -call execute_dml(3, 0, 1, 1, 1, 0); -call execute_dml(0, 0, 200, 200, 100, 0); -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SET GLOBAL innodb_redo_log_encrypt = ON; -SET GLOBAL innodb_undo_log_encrypt = ON; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -# In connection default - Cloning database -SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1'; -SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2'; -SET GLOBAL clone_autotune_concurrency = OFF; -SET GLOBAL clone_max_concurrency = 8; -SET GLOBAL clone_valid_donor_list = 'HOST:PORT'; -CLONE INSTANCE FROM USER@HOST:PORT IDENTIFIED BY '' DATA DIRECTORY = 'CLONE_DATADIR'; -# In connection con1 - Running Update Random [0 - 200 Key Range] -SET DEBUG_SYNC = 'now WAIT_FOR start_dml1'; -START TRANSACTION; -CALL execute_dml(1, 0, 200, 500, 100, 1); -COMMIT; -# Flush all dirty buffers -SET GLOBAL innodb_buf_flush_list_now = 1; -SET DEBUG_SYNC = 'now SIGNAL resume_clone1'; -SET DEBUG_SYNC = 'now WAIT_FOR start_dml2'; -START TRANSACTION; -CALL execute_dml(1, 0, 200, 500, 100, 1); -COMMIT; -SET DEBUG_SYNC = 'now SIGNAL resume_clone2'; -# In connection default - Cloning database -# Restart cloned database -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -SELECT count(*) from t1; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `col1` int NOT NULL, - `col2` int DEFAULT NULL, - `col3` varchar(64) DEFAULT NULL, - `col4` blob, - PRIMARY KEY (`col1`) -) /*!50100 TABLESPACE `tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!80016 ENCRYPTION='Y' */ -SELECT count(*) from t2; -count(*) -200 -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -0 Clone Test Row - 0 umn Data Large Column Data Large -1 Clone Test Row - 1 umn Data Large Column Data Large -2 Clone Test Row - 2 umn Data Large Column Data Large -3 Clone Test Row - 3 umn Data Large Column Data Large -4 Clone Test Row - 4 umn Data Large Column Data Large -5 Clone Test Row - 5 umn Data Large Column Data Large -6 Clone Test Row - 6 umn Data Large Column Data Large -7 Clone Test Row - 7 umn Data Large Column Data Large -8 Clone Test Row - 8 umn Data Large Column Data Large -9 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col3 SUBSTRING(col4, 1000, 32) -199 Clone Test Row - 199 umn Data Large Column Data Large -198 Clone Test Row - 198 umn Data Large Column Data Large -197 Clone Test Row - 197 umn Data Large Column Data Large -196 Clone Test Row - 196 umn Data Large Column Data Large -195 Clone Test Row - 195 umn Data Large Column Data Large -194 Clone Test Row - 194 umn Data Large Column Data Large -193 Clone Test Row - 193 umn Data Large Column Data Large -192 Clone Test Row - 192 umn Data Large Column Data Large -191 Clone Test Row - 191 umn Data Large Column Data Large -190 Clone Test Row - 190 umn Data Large Column Data Large -call execute_dml(3, 0, 1, 1, 1, 0); -call execute_dml(0, 0, 200, 200, 100, 0); -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -0 0 Clone Test Row - 0 umn Data Large Column Data Large -1 10 Clone Test Row - 1 umn Data Large Column Data Large -2 20 Clone Test Row - 2 umn Data Large Column Data Large -3 30 Clone Test Row - 3 umn Data Large Column Data Large -4 40 Clone Test Row - 4 umn Data Large Column Data Large -5 50 Clone Test Row - 5 umn Data Large Column Data Large -6 60 Clone Test Row - 6 umn Data Large Column Data Large -7 70 Clone Test Row - 7 umn Data Large Column Data Large -8 80 Clone Test Row - 8 umn Data Large Column Data Large -9 90 Clone Test Row - 9 umn Data Large Column Data Large -SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10; -col1 col2 col3 SUBSTRING(col4, 1000, 32) -199 1990 Clone Test Row - 199 umn Data Large Column Data Large -198 1980 Clone Test Row - 198 umn Data Large Column Data Large -197 1970 Clone Test Row - 197 umn Data Large Column Data Large -196 1960 Clone Test Row - 196 umn Data Large Column Data Large -195 1950 Clone Test Row - 195 umn Data Large Column Data Large -194 1940 Clone Test Row - 194 umn Data Large Column Data Large -193 1930 Clone Test Row - 193 umn Data Large Column Data Large -192 1920 Clone Test Row - 192 umn Data Large Column Data Large -191 1910 Clone Test Row - 191 umn Data Large Column Data Large -190 1900 Clone Test Row - 190 umn Data Large Column Data Large -DROP TABLE t1; -DROP TABLE t2; -DROP PROCEDURE execute_dml; -DROP TABLESPACE tbs1; -UNINSTALL PLUGIN clone; -SET DEBUG_SYNC = 'RESET'; -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kms -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/create_table.result b/mysql-test/suite/component_keyring_kms/r/create_table.result deleted file mode 100644 index 6a05739daa9a..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/create_table.result +++ /dev/null @@ -1,1024 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# Pre-define user u1, which is used in different tests below. -CREATE USER u1@localhost; -GRANT ALL ON db1.* 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'; -# This test run CREATE TABLE in different configurations, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting default_table_encryption to true/false. -# - With and without ENCRYPTION clause. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - Test SHOW CREATE TABLE -# - Test INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS -# - Check for warnings generated. -# -````````````````````````````````````````````````````````` -# Test CREATE TABLE on DATABASE with ENCRYPTION 'y/n' -# and with different values for system variable -# 'table_encryption_privilege_check' and 'default_table_encryption' -````````````````````````````````````````````````````````` -# CREATE TABLE without ENCRYPTION clause -# [CREATE TABLE] Case 1 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int); -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 2 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int); -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='Y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 3 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int); -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 4 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int); -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='Y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# CREATE TABLE with ENCRYPTION clause -# [CREATE TABLE] Case 5 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 6 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 7 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 8 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 9 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 10 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 11 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 12 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Check with invalid ENCRYPTION value -# [CREATE TABLE] Case 13 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='k'; -ERROR HY000: Invalid encryption option. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# With innodb_file_per_table=off and -# Test CREATE TABLE without ENCRYPTION clause. -SET GLOBAL innodb_file_per_table = OFF; -# [CREATE TABLE] Case 14 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int); -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 15 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int); -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 16 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int); -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 17 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int); -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# With explicit ENCRYPTION clause -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 18 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 19 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 20 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 21 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 22 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 23 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 24 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 25 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) ENCRYPTION='n'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# With innodb_file_per_table = ON. -# Test CREATE TABLE with explicit TABLESPACE=innodb_file_per_table -SET GLOBAL innodb_file_per_table = ON; -````````````````````````````````````````````````````````` -# Without ENCRYPTION clause -# [CREATE TABLE] Case 26 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 27 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='Y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 28 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 29 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='Y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# With ENCRYPTION clause -# [CREATE TABLE] Case 30 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 31 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 32 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 33 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='n' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 34 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 35 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 36 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 37 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Test CREATE TABLE with TABLESPACE=innodb_system -````````````````````````````````````````````````````````` -# Without ENCRYPTION clause -# [CREATE TABLE] Case 38 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 39 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 40 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 41 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# With ENCRYPTION clause -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 42 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 43 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 44 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 45 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# The statement would fail even with user owning TABLE_ENCRYPTION_ADMIN -# with ER_ILLEGAL_HA_CREATE_OPTION because one cannot create -# encrypted table in system tablespace. -# [CREATE TABLE] Case 46 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 47 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails because we cannot created a encrypted table in system tablespace. -# [CREATE TABLE] Case 48 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 49 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=innodb_system ENCRYPTION='n'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Test CREATE TABLE with general TABLESPACE -````````````````````````````````````````````````````````` -# With unencrypted general tablespace and without ENCRYPTION clause. -# [CREATE TABLE] Case 50 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# The table ENCRYPTION clause is inherited from database and this -# does not match tablespace encryption type. -# [CREATE TABLE] Case 51 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 52 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# The table ENCRYPTION clause is inherited from database and this -# does not match tablespace encryption type. -# [CREATE TABLE] Case 53 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# With ENCRYPTION clause -# [CREATE TABLE] Case 54 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 55 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 56 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 57 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='n' -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 58 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 59 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# [CREATE TABLE] Case 60 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE db1.t1; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -````````````````````````````````````````````````````````` -# Fails as there is mismatch between table and database encryption. -# [CREATE TABLE] Case 61 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# GRANT user the TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -# REVOKE TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -# Cleanup -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/database.result b/mysql-test/suite/component_keyring_kms/r/database.result deleted file mode 100644 index 3daa02251225..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/database.result +++ /dev/null @@ -1,1053 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# Pre-define user u1, which is used in different tests below. -CREATE USER u1@localhost; -GRANT ALL ON db1.* 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'; -# This test run CREATE/ALTER DATABASE in different configurations, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting default_table_encryption to true/false. -# - With and without ENCRYPTION clause. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - Test SHOW CREATE DATABASE -# - Test INFORMATION_SCHEMA.SCHEMATA -# - Check for warnings generated. -# -````````````````````````````````````````````````````````` -# CREATE DATABASE without DEFAULT ENCRYPTION clause -# and with different values for system variable -# 'table_encryption_privilege_check' and 'default_table_encryption' -# [CREATE DATABASE] Case 1 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 2 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 3 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 4 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 5 ) -````````````````````````````````````````````````````````` -# Granting TABLE_ENCRYPTION_ADMIN for user. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# Revoke TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 6 ) -````````````````````````````````````````````````````````` -# Granting TABLE_ENCRYPTION_ADMIN for user. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# Revoke TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# CREATE DATABASE with DEFAULT ENCRYPTION clause 'y/n' -# and with different values for system variable -# 'table_encryption_privilege_check' and 'default_table_encryption'. -# [CREATE DATABASE] Case 7 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 8 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 9 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 10 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Without the keyword DEFAULT. -# [CREATE DATABASE] Case 11 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 12 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 13 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 14 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# We expect failure because the encryption request is different from -# global 'default_table_encryption' setting. -# [CREATE DATABASE] Case 15 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -ERROR HY000: Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3827 Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 16 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 17 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# We expect failure because the encryption request is different from -# global 'default_table_encryption' setting. -# [CREATE DATABASE] Case 18 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -ERROR HY000: Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3827 Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 19 ) -````````````````````````````````````````````````````````` -# Granting TABLE_ENCRYPTION_ADMIN for user. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# Revoke TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 20 ) -````````````````````````````````````````````````````````` -# Granting TABLE_ENCRYPTION_ADMIN for user. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# Revoke TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 21 ) -````````````````````````````````````````````````````````` -# Granting TABLE_ENCRYPTION_ADMIN for user. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# Revoke TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE DATABASE] Case 22 ) -````````````````````````````````````````````````````````` -# Granting TABLE_ENCRYPTION_ADMIN for user. -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# Revoke TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# With invalid value for DEFAULT ENCRYPTION -# [CREATE DATABASE] Case 23 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false;; -CREATE DATABASE db1 DEFAULT ENCRYPTION='k'; -ERROR HY000: Incorrect argument (should be Y or N) value: 'k' -SHOW WARNINGS; -Level Code Message -Error 1525 Incorrect argument (should be Y or N) value: 'k' -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Check with legacy syntax. -CREATE DATABASE `db1` /*!80016 DEFAULT ENCRYPTION='Y' */; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -DROP DATABASE db1; -````````````````````````````````````````````````````````` -# See that we ignore the clause with invalid mysql version. -CREATE DATABASE `db1` /*!99999 DEFAULT ENCRYPTION='Y' */; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -DROP DATABASE db1; -````````````````````````````````````````````````````````` -# ALTER DATABASE withDEFAULT ENCRYPTION clause 'y/n' -# and with different values for system variable -# 'table_encryption_privilege_check' and 'default_table_encryption' -````````````````````````````````````````````````````````` -# Following cases are with database DEFAULT ENCRYPTION 'y' -# [ALTER DATABASE] Case 1 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 2 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 3 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 4 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 5 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# We expect failure because the encryption request is different from -# global 'default_table_encryption' setting. -# [ALTER DATABASE] Case 6 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -ERROR HY000: Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3827 Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# We expect failure because the encryption request is different from -# global 'default_table_encryption' setting. -# [ALTER DATABASE] Case 7 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -ERROR HY000: Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3827 Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 8 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 9 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 10 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 11 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 12 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Following cases are with database DEFAULT ENCRYPTION 'y' -# [ALTER DATABASE] Case 13 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 14 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 15 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 16 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 17 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# We expect failure because the encryption request is different from -# global 'default_table_encryption' setting. -# [ALTER DATABASE] Case 18 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -ERROR HY000: Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3827 Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# We expect failure because the encryption request is different from -# global 'default_table_encryption' setting. -# [ALTER DATABASE] Case 19 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -ERROR HY000: Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3827 Database default encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 20 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 21 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 22 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 23 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 NO -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER DATABASE] Case 24 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -# GRANT TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET SESSION default_table_encryption=true;; -SET GLOBAL table_encryption_privilege_check=true; -ALTER DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -# REVOKE TABLE_ENCRYPTION_ADMIN -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Invalid encryption option. -# [ALTER DATABASE] Case 25 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SET SESSION default_table_encryption=false;; -SET GLOBAL table_encryption_privilege_check=false; -ALTER DATABASE db1 DEFAULT ENCRYPTION='k'; -ERROR HY000: Incorrect argument (should be Y or N) value: 'k' -SHOW WARNINGS; -Level Code Message -Error 1525 Incorrect argument (should be Y or N) value: 'k' -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='Y' */ -SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION -FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; -SCHEMA_NAME DEFAULT_ENCRYPTION -db1 YES -DROP DATABASE db1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# Cleanup -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/encrypt_explicit.result b/mysql-test/suite/component_keyring_kms/r/encrypt_explicit.result deleted file mode 100644 index d95bada8a088..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/encrypt_explicit.result +++ /dev/null @@ -1,59 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kms -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# wl9508: Show that explicit and implicit undo tablespaces can be encrypted. -# -use test; -CREATE table tab1(c1 int); -# create bootstrap file -# Stop the MTR default DB server -# Taking backup of global manifest file for MySQL server -# Run the bootstrap command of datadir1 -# Restore global manifest file for MySQL server from backup -SELECT @@datadir; -@@datadir -MYSQLD_DATADIR1/ -SHOW VARIABLES LIKE 'keyring_file%'; -Variable_name Value -SELECT @@innodb_undo_log_encrypt; -@@innodb_undo_log_encrypt -1 -CREATE UNDO TABLESPACE undo_003 ADD DATAFILE 'undo_003.ibu'; -CREATE DATABASE nath; -use nath; -CREATE TABLE tab2(c1 int , c2 varchar(10)) Engine=InnoDB ENCRYPTION='Y'; -INSERT INTO tab2 VALUES(2, 'VISH'); -CREATE INDEX ix2 ON tab2(c2) ; -CREATE UNDO TABLESPACE undo_004 ADD DATAFILE 'undo_004.ibu'; -ALTER UNDO TABLESPACE undo_003 SET INACTIVE; -ALTER UNDO TABLESPACE undo_004 SET INACTIVE; -DELETE FROM tab2; -DROP UNDO TABLESPACE undo_003; -DROP UNDO TABLESPACE undo_004; -DROP TABLE tab2; -DROP DATABASE nath; -# Stop the encrypt server -SELECT @@datadir; -@@datadir -MYSQLD_OLD_DATADIR -use test; -DROP TABLE tab1; -# -# bug#29006275 : ENCRYPTION MASTER KEY IS GENERATED WITH BLANK UUID -# -# Stop the non-encrypted server -# Run the bootstrap command of datadir1 -# Show that a master key with a blank Server UUID is not used. -SELECT * FROM performance_schema.keyring_keys where KEY_ID='INNODBKey--1'; -KEY_ID KEY_OWNER BACKEND_KEY_ID -# Stop the encrypted server -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kms -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/engine.result b/mysql-test/suite/component_keyring_kms/r/engine.result deleted file mode 100644 index 7c8c1b025aaa..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/engine.result +++ /dev/null @@ -1,176 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# Check for use of ENCRYPTION clause on tables using engines that -# does not support encryption. -# -# 1. Requesting encryption on SE that does not support encryption. -# -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=HEAP ENCRYPTION='y'; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=MyISAM ENCRYPTION='y'; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=MyISAM ENCRYPTION='w'; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -# 2. -# Requesting unencrypted tables on SE that does not support -# encryption. This is allowed. Verify that we do not store -# ENCRYPTION clause. -# -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=HEAP ENCRYPTION='N'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE t1; -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=HEAP ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE t1; -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=MyISAM ENCRYPTION=''; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -DROP TABLE t1; -# 3. -# Move tables to and from different storage engine. -# -CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=InnoDB ENCRYPTION='y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -# 4. -# Moving encrypted table to SE that doesn't support encryption. -ALTER TABLE t1 ENGINE=MyISAM; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -ALTER TABLE t1 ENGINE=HEAP; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -# 5. -# Moving encrypted table to SE that doesn't support encryption. -# with a explicit request to decrypt the table is allowed. -ALTER TABLE t1 ENGINE=MyISAM ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -ALTER TABLE t1 ENGINE=Heap ENCRYPTION='N'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -ALTER TABLE t1 ENGINE=CSV ENCRYPTION=''; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -# 6. -# Moving unencrypted table from SE that doesn't support encryption -# to SE that does support encryption is allowed. -ALTER TABLE t1 ENGINE=InnoDB ENCRYPTION='y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE t1; -# Same as 4/5/6 using general tablespace: -# -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE t1 (f1 INT NOT NULL) TABLESPACE=ts1 ENCRYPTION='y'; -# 4. -# Moving encrypted table to SE that doesn't support encryption. -ALTER TABLE t1 ENGINE=MyISAM; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -ALTER TABLE t1 ENGINE=HEAP; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -# 5. -# Moving encrypted table to SE that doesn't support encryption. -# with a explicit request to decrypt the table is allowed. -ALTER TABLE t1 ENGINE=MyISAM ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -# 6. -# Moving unencrypted table from SE that doesn't support encryption -# to SE that does support encryption is allowed. -ALTER TABLE t1 ENGINE=InnoDB TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 -ALTER TABLE t1 ENCRYPTION='y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int NOT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME='t1'; -TABLE_NAME CREATE_OPTIONS -t1 ENCRYPTION='y' -DROP TABLE t1; -DROP TABLESPACE ts1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/import_compress_encrypt.result b/mysql-test/suite/component_keyring_kms/r/import_compress_encrypt.result deleted file mode 100644 index 400ff65b2b2f..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/import_compress_encrypt.result +++ /dev/null @@ -1,111 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# Bug#31313533 : IMPORT FAILS FOR ENCRYPT AND COMPRESSION ENABLED TDE TABLES -# -# SETUP -# -# Try to create a table with ZLib compression with strict mode OFF. -# If there is an error about Punch Hole not supported, make InnoDB -# think that Punch Hole is working but actually ignore the calls. -# -CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB"; -DROP TABLE t1; - -# Test 1 : Check that EXPORT and IMPORT is working fine on same FS - -CREATE TABLE t1(c1 int NOT NULL AUTO_INCREMENT, -c2 varchar(65000) DEFAULT NULL, -c3 varchar(255) GENERATED ALWAYS AS (substr(c2,2,100)) STORED, -c4 varchar(255) GENERATED ALWAYS AS (substr(c2,10,200)) VIRTUAL, -b bit(64) DEFAULT NULL, -p_c1 bigint DEFAULT NULL, -PRIMARY KEY (c1)) ENGINE=Innodb AUTO_INCREMENT=50001 DEFAULT CHARSET=latin1 COMPRESSION='zlib' ENCRYPTION='Y'; -SELECT c1, HEX(SUBSTRING(c2, 10, 10)), HEX(SUBSTRING(c3, 10, 10)), -HEX(SUBSTRING(c4, 10, 10)), HEX(b) -FROM t1 ORDER BY c1 limit 10; -c1 HEX(SUBSTRING(c2, 10, 10)) HEX(SUBSTRING(c3, 10, 10)) HEX(SUBSTRING(c4, 10, 10)) HEX(b) -50001 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50002 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50003 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50004 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50005 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50006 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50007 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50008 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50009 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50010 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -# Flush tables for export -FLUSH TABLES t1 FOR EXPORT; -# Copy .cfp .cfg .ibd file to temp -UNLOCK TABLES; -DROP TABLE t1; -CREATE TABLE t1(c1 int NOT NULL AUTO_INCREMENT, -c2 varchar(65000) DEFAULT NULL, -c3 varchar(255) GENERATED ALWAYS AS (substr(c2,2,100)) STORED, -c4 varchar(255) GENERATED ALWAYS AS (substr(c2,10,200)) VIRTUAL, -b bit(64) DEFAULT NULL, -p_c1 bigint DEFAULT NULL, -PRIMARY KEY (c1)) ENGINE=Innodb AUTO_INCREMENT=50001 DEFAULT CHARSET=latin1 COMPRESSION='zlib' ENCRYPTION='Y'; -ALTER TABLE t1 DISCARD TABLESPACE; -# Copy .cfp/.cfg and .ibd files from temp to datadir -# Start import -ALTER TABLE t1 IMPORT TABLESPACE; -SELECT c1, HEX(SUBSTRING(c2, 10, 10)), HEX(SUBSTRING(c3, 10, 10)), -HEX(SUBSTRING(c4, 10, 10)), HEX(b) FROM t1 ORDER BY c1 limit 10; -c1 HEX(SUBSTRING(c2, 10, 10)) HEX(SUBSTRING(c3, 10, 10)) HEX(SUBSTRING(c4, 10, 10)) HEX(b) -50001 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50002 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50003 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50004 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50005 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50006 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50007 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50008 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50009 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50010 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -# Cleanup -DROP TABLE t1; - -# Test 2 : Check that EXPORT and IMPORT is working fine on different FS - -# Copy and unzip the dir having cfg/cfg/ibd file from a different FS Block Size -CREATE TABLE t1(c1 int NOT NULL AUTO_INCREMENT, -c2 varchar(65000) DEFAULT NULL, -c3 varchar(255) GENERATED ALWAYS AS (substr(c2,2,100)) STORED, -c4 varchar(255) GENERATED ALWAYS AS (substr(c2,10,200)) VIRTUAL, -b bit(64) DEFAULT NULL, -p_c1 bigint DEFAULT NULL, -PRIMARY KEY (c1)) ENGINE=Innodb AUTO_INCREMENT=50001 DEFAULT CHARSET=latin1 COMPRESSION='zlib' ENCRYPTION='Y'; -ALTER TABLE t1 DISCARD TABLESPACE; -# Copy .cfp/.cfg and .ibd files from temp to datadir -# Start import -ALTER TABLE t1 IMPORT TABLESPACE; -SELECT c1, HEX(SUBSTRING(c2, 10, 10)), HEX(SUBSTRING(c3, 10, 10)), -HEX(SUBSTRING(c4, 10, 10)), HEX(b) FROM t1 ORDER BY c1 limit 10; -c1 HEX(SUBSTRING(c2, 10, 10)) HEX(SUBSTRING(c3, 10, 10)) HEX(SUBSTRING(c4, 10, 10)) HEX(b) -50001 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50002 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50003 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50004 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50005 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50006 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50007 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50008 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50009 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -50010 066C8ADC3EC72175CA77 6C8ADC3EC72175CA77CE 77CEF1FBCA5BFE739000 A -# Cleanup -DROP TABLE t1; -# Remove copied files -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/keyring_component_status.result b/mysql-test/suite/component_keyring_kms/r/keyring_component_status.result deleted file mode 100644 index 5996705d5402..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/keyring_component_status.result +++ /dev/null @@ -1,40 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -CALL mtr.add_suppression("No suitable 'keyring_component_metadata_query' service implementation found to fulfill the request"); -# -# Bug#32390719: QUERYING KEYRING_COMPONENT_STATUS TABLE -# GENERATES AN ERROR IN THE SERVER LOG -# -SELECT * FROM performance_schema.keyring_component_status; -STATUS_KEY STATUS_VALUE -Component_name component_keyring_kms -Author Percona Corporation -License GPL -Implementation_name component_keyring_kms -Version 1.0 -Component_status Active -Data_file MYSQLTEST_VARDIR/keyring_kms -Read_only No -KeyId 67520c9a-06c0-416b-8ec3-eac1894eef82 -SELECT PRIO, ERROR_CODE, SUBSYSTEM, DATA FROM performance_schema.error_log WHERE ERROR_CODE='MY-013712'; -PRIO ERROR_CODE SUBSYSTEM DATA -# Restarting server without keyring component -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM performance_schema.keyring_component_status; -STATUS_KEY STATUS_VALUE -SELECT PRIO, ERROR_CODE, SUBSYSTEM, DATA FROM performance_schema.error_log WHERE ERROR_CODE='MY-013712'; -PRIO ERROR_CODE SUBSYSTEM DATA -Warning MY-013712 Server No suitable 'keyring_component_metadata_query' service implementation found to fulfill the request. -# Restore local manifest file for MySQL server instance from backup -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/load.result b/mysql-test/suite/component_keyring_kms/r/load.result deleted file mode 100644 index 40eea0e4ee15..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/load.result +++ /dev/null @@ -1,14 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/log_encrypt_1.result b/mysql-test/suite/component_keyring_kms/r/log_encrypt_1.result deleted file mode 100644 index f07fd922cf3c..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/log_encrypt_1.result +++ /dev/null @@ -1,126 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Kill the server -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -# Kill the server -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -# Kill the server -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -DELETE FROM t1; -START TRANSACTION; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -# Kill the server -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -DROP TABLE t1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/log_encrypt_2.result b/mysql-test/suite/component_keyring_kms/r/log_encrypt_2.result deleted file mode 100644 index b00ad92e58e0..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/log_encrypt_2.result +++ /dev/null @@ -1,164 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Kill the server -SHOW VARIABLES LIKE "%innodb_redo_log_encrypt%"; -Variable_name Value -innodb_redo_log_encrypt ON -DROP TABLE IF EXISTS t1; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -# Kill the server -SHOW VARIABLES LIKE "%innodb_redo_log_encrypt%"; -Variable_name Value -innodb_redo_log_encrypt ON -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER INSTANCE ROTATE INNODB MASTER KEY; -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -# Kill the server -SHOW VARIABLES LIKE "%innodb_redo_log_encrypt%"; -Variable_name Value -innodb_redo_log_encrypt ON -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -DROP TABLE t1; -# Kill the server -SHOW VARIABLES LIKE "%innodb_redo_log_encrypt%"; -Variable_name Value -innodb_redo_log_encrypt ON -SET block_encryption_mode = 'aes-256-cbc'; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -CREATE TABLE tde_db.t1(c1 INT PRIMARY KEY, c2 char(50)) ENCRYPTION = 'Y' ENGINE = InnoDB; -INSERT INTO tde_db.t1 VALUES(0, 'abc'); -INSERT INTO tde_db.t1 VALUES(1, 'xyz'); -INSERT INTO tde_db.t1 VALUES(2, null); -INSERT INTO tde_db.t1 VALUES(3, null); -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -# Mysqldump output - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `tde_db` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; - -USE `tde_db`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `t1` ( - `c1` int NOT NULL, - `c2` char(50) DEFAULT NULL, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y'; -/*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO `t1` VALUES (0,'abc'),(1,'xyz'),(2,NULL),(3,NULL); -# Redirecting mysqlpump output to MYSQL_TMP_DIR/mysqlpump_encrypt.sql -DROP DATABASE tde_db; -Pattern "ALTER INSTANCE ROTATE INNODB MASTER KEY" found -# Loading tables from mysqlpump_encrypt.sql -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -INSERT INTO tde_db.t1 VALUES(4, null); -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -4 NULL -DROP DATABASE tde_db; -# Kill the server -SET GLOBAL innodb_file_per_table=1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/log_encrypt_3.result b/mysql-test/suite/component_keyring_kms/r/log_encrypt_3.result deleted file mode 100644 index 51467a287f1d..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/log_encrypt_3.result +++ /dev/null @@ -1,196 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Kill the server -CREATE DATABASE tde_db; -USE tde_db; -# Kill the server -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -SET GLOBAL innodb_redo_log_encrypt = 1; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t1 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t2 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t2 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -1 aaaaaaaaaa -SET GLOBAL innodb_redo_log_encrypt = 0; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -OFF -CREATE TABLE tde_db.t3 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t3 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t4 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t4 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -1 aaaaaaaaaa -FLUSH LOGS; -# Kill the server -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -1 aaaaaaaaaa -DROP TABLE tde_db.t1,tde_db.t2,tde_db.t3,tde_db.t4; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -CREATE TABLE tde_db.t2 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -START TRANSACTION; -SET GLOBAL innodb_redo_log_encrypt = 1; -INSERT INTO t1 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -INSERT INTO t2 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -1 aaaaaaaaaa -ROLLBACK; -START TRANSACTION; -INSERT INTO t1 (a, b) VALUES (2, REPEAT('a', 6*512*512)); -INSERT INTO t2 (a, b) VALUES (2, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -2 aaaaaaaaaa -COMMIT; -CREATE TABLE tde_db.t3 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -CREATE TABLE tde_db.t4 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -START TRANSACTION; -SET GLOBAL innodb_redo_log_encrypt = 0; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -OFF -INSERT INTO t3 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -INSERT INTO t4 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -1 aaaaaaaaaa -ROLLBACK; -START TRANSACTION; -INSERT INTO t3 (a, b) VALUES (2, REPEAT('a', 6*512*512)); -INSERT INTO t4 (a, b) VALUES (2, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -2 aaaaaaaaaa -COMMIT; -# Kill the server -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -2 aaaaaaaaaa -SET GLOBAL innodb_redo_log_encrypt = 0; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -OFF -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -2 aaaaaaaaaa -SET GLOBAL innodb_redo_log_encrypt = 1; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -2 aaaaaaaaaa -CREATE USER encryptnonprivuser@localhost IDENTIFIED BY 'noauth'; -GRANT SELECT ON *.* to encryptnonprivuser@localhost; -FLUSH PRIVILEGES; -# In connection 1 - with encryptnonprivuser -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -SET GLOBAL innodb_redo_log_encrypt = 0; -ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -SET GLOBAL innodb_undo_log_encrypt = 0; -ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation -SELECT @@global.innodb_undo_log_encrypt ; -@@global.innodb_undo_log_encrypt -0 -SET GLOBAL innodb_redo_log_encrypt = 1; -ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -SET GLOBAL innodb_undo_log_encrypt = 1; -ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation -SELECT @@global.innodb_undo_log_encrypt ; -@@global.innodb_undo_log_encrypt -0 -# In connection default -DROP TABLE tde_db.t1,tde_db.t2,tde_db.t3,tde_db.t4; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/log_encrypt_5.result b/mysql-test/suite/component_keyring_kms/r/log_encrypt_5.result deleted file mode 100644 index e09b5e7b74e7..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/log_encrypt_5.result +++ /dev/null @@ -1,84 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kms -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# create bootstrap file -# Stop the MTR default DB server -# Run the bootstrap command of datadir1 -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -SET GLOBAL innodb_redo_log_encrypt = 1; -SET GLOBAL innodb_undo_log_encrypt = 1; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t1 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t2 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t2 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -1 aaaaaaaaaa -SET GLOBAL innodb_redo_log_encrypt = 0; -SET GLOBAL innodb_undo_log_encrypt = 0; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -OFF -CREATE TABLE tde_db.t3 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t3 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t4 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t4 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -1 aaaaaaaaaa -SET GLOBAL innodb_redo_log_encrypt = 1; -SET GLOBAL innodb_undo_log_encrypt = 1; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t5 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t5 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t5; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t6 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t6 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t6; -a LEFT(b,10) -1 aaaaaaaaaa -START TRANSACTION; -INSERT INTO t5 (a, b) VALUES (2, REPEAT('a', 6*512*512)); -INSERT INTO t6 (a, b) VALUES (2, REPEAT('a', 6*512*512)); -COMMIT; -START TRANSACTION; -INSERT INTO t5 (a, b) VALUES (3, REPEAT('a', 6*512*512)); -INSERT INTO t6 (a, b) VALUES (3, REPEAT('a', 6*512*512)); -ROLLBACK; -SELECT a,LEFT(b,10) FROM tde_db.t5; -a LEFT(b,10) -1 aaaaaaaaaa -2 aaaaaaaaaa -SELECT a,LEFT(b,10) FROM tde_db.t6; -a LEFT(b,10) -1 aaaaaaaaaa -2 aaaaaaaaaa -DROP TABLE tde_db.t1,tde_db.t2,tde_db.t3,tde_db.t4,tde_db.t5,tde_db.t6; -DROP DATABASE tde_db; -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kms -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/log_encrypt_6.result b/mysql-test/suite/component_keyring_kms/r/log_encrypt_6.result deleted file mode 100644 index 221b26728c5f..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/log_encrypt_6.result +++ /dev/null @@ -1,86 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kms -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# create bootstrap file -# Stop the MTR default DB server -# Run the bootstrap command of datadir1 -# Start the DB server with datadir1 -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -SELECT status_key, status_value FROM -performance_schema.keyring_component_status -WHERE status_key LIKE '%name%' OR status_key LIKE '%status%'; -status_key status_value -Component_name component_keyring_kms -Implementation_name component_keyring_kms -Component_status Active -SET GLOBAL innodb_redo_log_encrypt = 1; -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t1 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t1; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t2 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t2 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t2; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t3 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t3 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t3; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t4 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t4 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t4; -a LEFT(b,10) -1 aaaaaaaaaa -SELECT @@global.innodb_redo_log_encrypt ; -@@global.innodb_redo_log_encrypt -ON -CREATE TABLE tde_db.t5 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; -INSERT INTO t5 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t5; -a LEFT(b,10) -1 aaaaaaaaaa -CREATE TABLE tde_db.t6 (a BIGINT PRIMARY KEY, b LONGBLOB) -ENCRYPTION='Y' ENGINE=InnoDB; -INSERT INTO t6 (a, b) VALUES (1, REPEAT('a', 6*512*512)); -SELECT a,LEFT(b,10) FROM tde_db.t6; -a LEFT(b,10) -1 aaaaaaaaaa -DROP DATABASE tde_db; -# Taking backup of global manifest file for MySQL server -# Try starting without keyring : Error -# Search for error message -Pattern "Redo log was encrypted, but keyring is not loaded" found -Pattern "Aborting" found -# Restart without keyring plugin possible if redo files removed -# Start the DB server with datadir1 -# Try starting without keyring and --innodb_force_recovery=SRV_FORCE_NO_LOG_REDO. -# Start the DB server with datadir1 -SELECT 1; -1 -1 -# Restore global manifest file for MySQL server from backup -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kms -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/log_encrypt_kill.result b/mysql-test/suite/component_keyring_kms/r/log_encrypt_kill.result deleted file mode 100644 index 227880481ffc..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/log_encrypt_kill.result +++ /dev/null @@ -1,251 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kms -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Taking backup of global manifest file for MySQL server -SELECT @@global.innodb_redo_log_encrypt; -@@global.innodb_redo_log_encrypt -OFF -SET GLOBAL innodb_redo_log_encrypt = 1; -Warnings: -Warning 7013 InnoDB: Redo log cannot be encrypted if the keyring is not loaded. -SET GLOBAL innodb_undo_log_encrypt = 1; -Warnings: -Warning 7014 InnoDB: Undo log can't be encrypted if the keyring is not loaded. -SELECT status_key, status_value FROM -performance_schema.keyring_component_status -WHERE status_key LIKE '%name%' OR status_key LIKE '%status%'; -status_key status_value -CREATE TABLE tne_1(c1 INT, c2 varchar(2000)) ENGINE = InnoDB; -INSERT INTO tne_1 VALUES (1,REPEAT('a',1990)),(2,REPEAT('b',1990)),(100,REPEAT('c',1990)); -SELECT c1,LEFT(c2,10) FROM tne_1; -c1 LEFT(c2,10) -1 aaaaaaaaaa -2 bbbbbbbbbb -100 cccccccccc -DROP TABLE tne_1; -# Stop the MTR default DB server -Pattern "Redo log cannot be encrypted if the keyring is not loaded." found -# create bootstrap file -# Restore global manifest file for MySQL server from backup -# Prepare new datadir -# Run the bootstrap command with keyring -# Starting server with keyring plugin -SELECT @@global.innodb_redo_log_encrypt; -@@global.innodb_redo_log_encrypt -OFF -SET GLOBAL innodb_redo_log_encrypt = 1; -SELECT @@global.innodb_undo_log_encrypt; -@@global.innodb_undo_log_encrypt -0 -SET GLOBAL innodb_undo_log_encrypt = 1; -SELECT @@global.innodb_undo_log_encrypt; -@@global.innodb_undo_log_encrypt -1 -SELECT status_key, status_value FROM -performance_schema.keyring_component_status -WHERE status_key LIKE '%name%' OR status_key LIKE '%status%'; -status_key status_value -Component_name component_keyring_kms -Implementation_name component_keyring_kms -Component_status Active -SET GLOBAL innodb_redo_log_encrypt = 0; -SELECT @@global.innodb_redo_log_encrypt; -@@global.innodb_redo_log_encrypt -OFF -SET GLOBAL innodb_undo_log_encrypt = 0; -SELECT @@global.innodb_undo_log_encrypt; -@@global.innodb_undo_log_encrypt -0 -SELECT status_key, status_value FROM -performance_schema.keyring_component_status -WHERE status_key LIKE '%name%' OR status_key LIKE '%status%'; -status_key status_value -Component_name component_keyring_kms -Implementation_name component_keyring_kms -Component_status Active -DROP TABLE IF EXISTS t1; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -CREATE TABLE tde_db.t_encrypt(c2 INT NOT NULL PRIMARY KEY, -c3 LONGBLOB -) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE TABLE tde_db.t_non_encrypt(c2 INT NOT NULL PRIMARY KEY, -c3 LONGBLOB -) ENGINE = InnoDB; -CREATE PROCEDURE tde_db.populate_table_set_redo_encrypt(IN table_name VARCHAR(50)) -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 2000) DO -SET @sql_text = CONCAT('INSERT INTO ',table_name, '(c2,c3) VALUES (' , i,',' ,'CONCAT(REPEAT("a",6*512*512)))'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -set i = i + 1; -IF i%10 = 0 THEN SET GLOBAL innodb_redo_log_encrypt = 1; -END IF; -IF i%20 = 0 THEN SET GLOBAL innodb_redo_log_encrypt = 0; -END IF; -IF i%15 = 0 THEN SET GLOBAL innodb_undo_log_encrypt = 1; -END IF; -IF i%30 = 0 THEN SET GLOBAL innodb_undo_log_encrypt = 0; -END IF; -end while; -end| -CREATE PROCEDURE tde_db.update_table(IN table_name VARCHAR(50)) -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 2000) DO -SET @sql_text = CONCAT('UPDATE ',table_name, ' SET c2 = c2 * -1 ORDER BY RAND() LIMIT 2'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.delete_table(IN table_name VARCHAR(50)) -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 2000) DO -SET @sql_text = CONCAT('DELETE FROM ',table_name, ' ORDER BY RAND() LIMIT 2'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.transaction_table(IN table_name VARCHAR(50)) -begin -declare i int default 1; -declare iflag int default -1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -SET i = 3000; -START TRANSACTION; -while (i <= 9000) DO -SET @sql_text = CONCAT('INSERT INTO ',table_name, '(c2,c3) VALUES (' , i,',' ,'CONCAT(REPEAT("a",6*512*512)))'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -SET @sql_text = CONCAT('UPDATE ',table_name, ' SET c2 = c2 * -1 ORDER BY RAND() LIMIT 2'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -set i = i + 1; -IF i%10 = 0 THEN SET GLOBAL innodb_redo_log_encrypt = 1; -END IF; -IF i%20 = 0 THEN SET GLOBAL innodb_redo_log_encrypt = 0; -END IF; -IF i%15 = 0 THEN SET GLOBAL innodb_undo_log_encrypt = 1; -END IF; -IF i%30 = 0 THEN SET GLOBAL innodb_undo_log_encrypt = 0; -END IF; -IF i%10 = 0 THEN -SET @sql_text = CONCAT('DELETE FROM ',table_name, ' ORDER BY RAND() LIMIT 2'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -START TRANSACTION; -SET iflag = -1 * iflag; -END IF; -IF i%9 = 0 THEN -IF iflag < 0 THEN -COMMIT; -ELSE -ROLLBACK; -END IF; -END IF; -end while; -end| -CREATE PROCEDURE tde_db.create_table_rotate_key() -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 2000) DO -IF i%10 = 0 THEN -SET @sql_text = CONCAT('CREATE TABLE ',CONCAT('tde_db.t_non_encrypt_',encrypt,'_',i),' (c1 INT) ' ,' ENGINE=InnoDB'); -ELSE -SET @sql_text = CONCAT('CREATE TABLE ',CONCAT('tde_db.t_encrypt_',encrypt,'_',i),' (c1 INT) ENCRYPTION="Y"' ,' ENGINE=InnoDB'); -END IF; -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.query_table(IN table_name VARCHAR(50)) -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 2000) DO -SET @sql_text = CONCAT('SELECT * FROM ',table_name, ' ORDER BY RAND() LIMIT 2'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -set i = i + 1; -end while; -end| -# In connection con1 - Running insert with redo_log_encrypt variable -call tde_db.populate_table_set_redo_encrypt('tde_db.t_encrypt'); -# In connection con2 - Running insert on non encrypt table -call tde_db.populate_table_set_redo_encrypt('tde_db.t_non_encrypt'); -# Starting server with keyring -SELECT COUNT(*)>0 FROM tde_db.t_encrypt; -COUNT(*)>0 -# -SELECT COUNT(*)>0 FROM tde_db.t_non_encrypt; -COUNT(*)>0 -# -DELETE FROM tde_db.t_encrypt; -DELETE FROM tde_db.t_non_encrypt; -# In connection con1 - Running insert with redo_log_encrypt variable -call tde_db.populate_table_set_redo_encrypt('tde_db.t_encrypt'); -# In connection con2 - Running insert on non encrypt table -call tde_db.populate_table_set_redo_encrypt('tde_db.t_non_encrypt'); -# In connection con3 - Running update on encrypt -call tde_db.table_update('tde_db.t_encrypt'); -# In connection con4 - Running update non encrypt -call tde_db.table_update('tde_db.t_non_encrypt'); -# In connection con5 - Running delete on encrypt -call tde_db.table_delete('tde_db.t_encrypt'); -# In connection con6 - Running delete on non encrypt -call tde_db.table_delete('tde_db.t_non_encrypt'); -# In connection con7 - Running transaction on encrypt -call tde_db.transaction_table('tde_db.t_encrypt'); -# In connection con8 - Running transaction on non encrypt -call tde_db.transaction_table('tde_db.t_non_encrypt'); -# In connection con9 - Running create encrypt and non encrypt table with rotate key -call tde_db.create_table_rotate_key(); -# In connection con10 - Running query on encrypt table -call tde_db.query_table('tde_db.t_encrypt'); -# In connection con11 - Running query on non encrypt table -call tde_db.query_table('tde_db.t_non_encrypt'); -# Starting server with keyring -SELECT COUNT(*) > 1 FROM tde_db.t_encrypt; -COUNT(*) > 1 -# -SELECT COUNT(*) > 1 FROM tde_db.t_non_encrypt; -COUNT(*) > 1 -# -# In connection con1 - Running insert with redo_log_encrypt variable -call tde_db.populate_table_set_redo_encrypt('tde_db.t_encrypt'); -# In connection con2 - Running insert on non encrypt table -call tde_db.populate_table_set_redo_encrypt('tde_db.t_non_encrypt'); -DROP DATABASE tde_db; -# Taking backup of global manifest file for MySQL server -# restart -# Restore global manifest file for MySQL server from backup -# -# Cleanup -# -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kms -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/mysql_ts_alter_encrypt_1.result b/mysql-test/suite/component_keyring_kms/r/mysql_ts_alter_encrypt_1.result deleted file mode 100644 index 202362a640e7..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/mysql_ts_alter_encrypt_1.result +++ /dev/null @@ -1,222 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- - -############################################################# -# TEST 1 : NORMAL ALTER ENCRYPT mysql TABLESPACE. -############################################################# - -######################################################################### -# RESTART 1 : WITH KEYRING -######################################################################### -SET debug='+d,skip_dd_table_access_check'; -# Initially, mysql should be unencrypted by default -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N; -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -ALTER TABLESPACE mysql ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; - -############################################################# -# TEST 2 : CRASH DURING ALTER ENCRYPT mysql TABLESPACE. -############################################################# - -############################################################ -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -# (crash at page 10) # -############################################################ -# Set Encryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE mysql ENCRYPTION='Y'; -# Restart after crash -SET debug='+d,skip_dd_table_access_check'; -# Wait for Encryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Encryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -######################################################################### -# RESTART 2 : WITH KEYRING -######################################################################### -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -############################################################ -# ALTER TABLESPACE 2 : Encrypted => Unencrypted # -# (crash at page 10) # -############################################################ -# Set Unencryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE mysql ENCRYPTION='N'; -# Restart after crash -SET debug='+d,skip_dd_table_access_check'; -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; -ALTER TABLESPACE mysql ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; -######################################################################### -# RESTART 3 : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; -############################################################# -# TEST 3 : CRASH BEFORE/AFTER ENCRYPTION PROCESSING. -############################################################# - -######################################################################### -# RESTART 4 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SET debug='+d,skip_dd_table_access_check'; -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -# Set server to crash just before encryption processing starts -SET SESSION debug="+d,alter_encrypt_tablespace_crash_before_processing"; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE mysql ENCRYPTION='N'; -# Restart after crash -SET debug='+d,skip_dd_table_access_check'; -# Wait for Unencryption processing to finish in background thread -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -# Set server to crash just after encryption processing finishes -SET SESSION debug="-d,alter_encrypt_tablespace_crash_before_processing"; -SET SESSION debug="+d,alter_encrypt_tablespace_crash_after_processing"; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE mysql ENCRYPTION='N'; -# Restart after crash -SET debug='+d,skip_dd_table_access_check'; -# Wait for Unencryption processing to finish in background thread -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; -############################################################# -# TEST 4 : CRASH DURING KEY ROTATION. -############################################################# - -######################################################################### -# RESTART 5 : WITH KEYRING -######################################################################### -SET debug='+d,skip_dd_table_access_check'; -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -# Set server to crash while rotating encryption -SET SESSION debug="+d,ib_crash_during_rotation_for_encryption"; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -# Restart after crash -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -SET SESSION debug="-d,ib_crash_during_rotation_for_encryption"; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -############################################################# -# TEST 5 : PRIVILEGE CHECK. -############################################################# - -CREATE DATABASE priv_test; -CREATE USER myuser@'localhost'; -GRANT ALL ON priv_test.* TO myuser@'localhost'; -#connection con1 -ALTER TABLESPACE mysql ENCRYPTION='Y'; -ERROR 42000: Access denied; you need (at least one of) the CREATE TABLESPACE privilege(s) for this operation -#connection default -GRANT CREATE TABLESPACE ON mysql.* TO myuser@'localhost'; -ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES -GRANT CREATE TABLESPACE ON *.* TO myuser@'localhost'; -#connection con1 -ALTER TABLESPACE mysql ENCRYPTION='N'; -#connection default -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; -#connection con1 -ALTER TABLESPACE mysql ENCRYPTION='Y'; -#connection default -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -DROP DATABASE priv_test; -DROP USER myuser@localhost; -########### -# Cleanup # -########### -ALTER TABLESPACE mysql ENCRYPTION='N'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE NAME='mysql'; -NAME OPTIONS -mysql encryption=N;explicit_encryption=1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/mysql_ts_alter_encrypt_2.result b/mysql-test/suite/component_keyring_kms/r/mysql_ts_alter_encrypt_2.result deleted file mode 100644 index 0ad8d8fde125..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/mysql_ts_alter_encrypt_2.result +++ /dev/null @@ -1,336 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######### -# SETUP # -######### - -# Taking backup of local manifest file for MySQL server instance -######################################################################### -# START : WITHOUT KEYRING -######################################################################### -ALTER TABLESPACE mysql ENCRYPTION='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -ALTER TABLESPACE mysql ENCRYPTION='N'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 1 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup --------------------------------------------------- -By Default, mysql tablespace should be unencrypted --------------------------------------------------- -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql N -# Print result -table space is Encrypted. -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -# Print result -table space is Encrypted. ------------------------------------------------------ -ALTER mysql TABLESPACE WITH INVALID ENCRYPTION OPTION ------------------------------------------------------ -ALTER TABLESPACE mysql ENCRYPTION='R'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='TRUE'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='True'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='true'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION=TRUE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRUE' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=True; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'True' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=true; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'true' at line 1 -ALTER TABLESPACE mysql ENCRYPTION='FALSE'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='False'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='false'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION=FALSE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FALSE' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=False; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'False' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=false; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'false' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=0; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=null; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=-1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=n; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'n' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=N; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'N' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=y; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'y' at line 1 -ALTER TABLESPACE mysql ENCRYPTION=Y; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Y' at line 1 -ALTER TABLESPACE mysql ENCRYPTION='1'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='1True'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='@'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION='null'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION=''; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE mysql ENCRYPTION=""; -ERROR HY000: Invalid encryption option. ----------------------------------------------------- -ALTER MYSQL TABLESPACE WITH VALID ENCRYPTION OPTION ----------------------------------------------------- -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -ALTER TABLESPACE mysql ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -ALTER TABLESPACE mysql ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql N -ALTER TABLESPACE mysql ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql N -ALTER TABLESPACE mysql ENCRYPTION="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -ALTER TABLESPACE mysql ENCRYPTION="y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -ALTER TABLESPACE mysql ENCRYPTION="n"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql N -ALTER TABLESPACE mysql ENCRYPTION="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql N ------------------------------------------------------ -Create/Alter table using mysql.tablespace ------------------------------------------------------ -CREATE TABLE t1(i int) TABLESPACE mysql; -ERROR HY000: The table 't1' may not be created in the reserved tablespace 'mysql'. -CREATE TEMPORARY TABLE t1(i int) TABLESPACE mysql; -ERROR HY000: The table 't1' may not be created in the reserved tablespace 'mysql'. -CREATE TABLE t1(i int); -ALTER TABLE t1 TABLESPACE mysql; -ERROR HY000: The table 't1' may not be created in the reserved tablespace 'mysql'. -DROP TABLE t1; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB; -CREATE TABLE t1(i int) TABLESPACE encrypt_ts; -ALTER TABLE t1 TABLESPACE mysql; -ERROR HY000: The table 't1' may not be created in the reserved tablespace 'mysql'. -DROP TABLE t1; -CREATE TABLE t1(i int) TABLESPACE innodb_system; -ALTER TABLE t1 TABLESPACE mysql; -ERROR HY000: The table 't1' may not be created in the reserved tablespace 'mysql'. -DROP TABLE t1; -ALTER TABLE mysql.component TABLESPACE mysql; -CREATE TEMPORARY TABLE t1(i int); -ALTER TABLE t1 TABLESPACE mysql; -ERROR HY000: The table 't1' may not be created in the reserved tablespace 'mysql'. -DROP TABLE t1; ------------------------------------------------------ -Create view using mysql.tablespace ------------------------------------------------------ -CREATE TABLE t1(i int); -INSERT INTO t1 VALUES(1); -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -CREATE VIEW v1 AS SELECT * FROM t1 TABLESPACE mysql; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql' at line 1 -DROP TABLE t1; ------------------------------------------------------------- -Alter DD table part of mysql.tablespace to other tablespaces ------------------------------------------------------------- -ALTER TABLE mysql.events TABLESPACE innodb_file_per_table ENCRYPTION='Y'; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE innodb_file_per_table; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE innodb_temporary ENCRYPTION='Y'; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE innodb_temporary; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE innodb_system ENCRYPTION='Y'; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE innodb_system; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE encrypt_ts ENCRYPTION='Y'; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -ALTER TABLE mysql.events TABLESPACE encrypt_ts; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -DROP TABLESPACE encrypt_ts; -------------------------------------------------------- -Delete/truncate/drop DD table part of mysql tablespace -------------------------------------------------------- -DELETE FROM mysql.events; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -TRUNCATE TABLE mysql.events; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. -DROP TABLE mysql.events; -ERROR HY000: Access to data dictionary table 'mysql.events' is rejected. --------------------------------------------------- -Alter encryption of table part of mysql tablespace --------------------------------------------------- -ALTER TABLE mysql.component ENCRYPTION='Y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE mysql.component ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE mysql.component ENCRYPTION='N'; -ALTER TABLE mysql.component ENCRYPTION='n'; ---------------------------------------------------------------------- -Metadata for a table in mysql ts should not show encryption attribute ---------------------------------------------------------------------- -SHOW CREATE TABLE mysql.plugin; -Table Create Table -plugin CREATE TABLE `plugin` ( - `name` varchar(64) NOT NULL DEFAULT '', - `dl` varchar(128) NOT NULL DEFAULT '', - PRIMARY KEY (`name`) -) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='MySQL plugins' -------------------- -Drop mysql database -------------------- -DROP DATABASE mysql; -ERROR HY000: Access to system schema 'mysql' is rejected. ------------------------------------------------------ -Other DDL operation not allowed on 'mysql' tablespace ------------------------------------------------------ -CREATE TABLESPACE mysql ADD DATAFILE 'mysql.ibd' ENGINE=INNODB; -ERROR 42000: InnoDB: `mysql` is a reserved tablespace name. -DROP TABLESPACE mysql; -ERROR 42000: InnoDB: `mysql` is a reserved tablespace name. -ALTER TABLESPACE mysql RENAME TO xyz; -ERROR 42000: InnoDB: `mysql` is a reserved tablespace name. -ALTER TABLESPACE mysql ENGINE=myisam; -ERROR HY000: Engine 'myisam' does not match stored engine 'InnoDB' for tablespace 'mysql' -ALTER TABLESPACE mysql ENGINE=memory; -ERROR HY000: Engine 'memory' does not match stored engine 'InnoDB' for tablespace 'mysql' -######################################################################### -# Restart with same keyring option -# - tables in mysql ts should be accessible -######################################################################### -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT help_keyword_id FROM mysql.help_keyword ORDER BY help_keyword_id LIMIT 2; -help_keyword_id -0 -1 -ALTER TABLESPACE mysql ENCRYPTION='N'; -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql Y -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ALTER TABLESPACE mysql ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='mysql'; -NAME ENCRYPTION -mysql N -# Set Encryption process to wait after page 5 so that we can monitor -# progress in performance_schema table -SET DEBUG_SYNC = 'alter_encrypt_tablespace_wait_after_page5 SIGNAL s1 WAIT_FOR s2'; -ALTER TABLESPACE mysql ENCRYPTION='Y'; -# Monitoring connection -SET DEBUG_SYNC = 'now WAIT_FOR s1'; -# Wait for Encryption progress monitoring to appear in PFS table -# Wait for some progress to appear in PFS table -select WORK_COMPLETED -FROM performance_schema.events_stages_current -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)'; -WORK_COMPLETED -5 -SET DEBUG_SYNC = 'now SIGNAL s2'; -# Default connection -# Once done, select count from PFS tables -SELECT COUNT(*) -FROM performance_schema.events_stages_current -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -COUNT(*) -0 -SELECT COUNT(*) -FROM performance_schema.events_stages_history -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -COUNT(*) -0 -SELECT COUNT(*) -FROM performance_schema.events_stages_history_long -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -COUNT(*) -3 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_global_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_by_user_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_by_host_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_by_account_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -# Check that Encryption done successfully. -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='mysql'; -NAME ENCRYPTION -mysql Y -SELECT help_keyword_id FROM mysql.help_keyword ORDER BY help_keyword_id LIMIT 2; -help_keyword_id -0 -1 -########### -# Cleanup # -########### -ALTER TABLESPACE mysql ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='mysql'; -NAME ENCRYPTION -mysql N -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/mysqldump.result b/mysql-test/suite/component_keyring_kms/r/mysqldump.result deleted file mode 100644 index 54b249e1fbcf..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/mysqldump.result +++ /dev/null @@ -1,353 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Pre-define user u1, which is used in different tests below. -CREATE USER u1@localhost; -GRANT ALL ON db1.* TO u1@localhost; -GRANT CREATE TABLESPACE, PROCESS, SYSTEM_VARIABLES_ADMIN ON *.* TO u1@localhost; -# This test run output (.sql) of mysqldump from 5.7, 8.0.12 and 8.0.13 -# in 8.0.15. -# -# The .sql files contain notes with tag wl12261 describing the -# modifications done to .sql to make it run on MySQL 8.0.15. -# It basically does two things a) removes ENCRYPTION=y for CVS and -# MEMORY engines. b) Adds a explicit ENCRYPTION='y' for tables -# using encryped general tablespace. -# -# The behavior of executing .sql with following variables would be -# same as the test behavior seen by encryption.* test results. -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting default_table_encryption to true/false. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -CREATE TABLESPACE ts2 ADD DATAFILE 'ts2.ibd'; -CREATE TABLESPACE ts3 ADD DATAFILE 'ts3.ibd'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ /*!80016 DEFAULT ENCRYPTION='N' */ -SHOW CREATE TABLE db1.i1; -Table Create Table -i1 CREATE TABLE `i1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.i2; -Table Create Table -i2 CREATE TABLE `i2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ENCRYPTION='y' -SHOW CREATE TABLE db1.i3; -Table Create Table -i3 CREATE TABLE `i3` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.i4; -Table Create Table -i4 CREATE TABLE `i4` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.i_ts1; -Table Create Table -i_ts1 CREATE TABLE `i_ts1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.i_ts2; -Table Create Table -i_ts2 CREATE TABLE `i_ts2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.i_ts3; -Table Create Table -i_ts3 CREATE TABLE `i_ts3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.i_part1; -Table Create Table -i_part1 CREATE TABLE `i_part1` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.i_part2; -Table Create Table -i_part2 CREATE TABLE `i_part2` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 ENCRYPTION='y' -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.i_part3; -Table Create Table -i_part3 CREATE TABLE `i_part3` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.c1; -Table Create Table -c1 CREATE TABLE `c1` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.c2; -Table Create Table -c2 CREATE TABLE `c2` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.c3; -Table Create Table -c3 CREATE TABLE `c3` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.h1; -Table Create Table -h1 CREATE TABLE `h1` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.h2; -Table Create Table -h2 CREATE TABLE `h2` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 -SHOW CREATE TABLE db1.h3; -Table Create Table -h3 CREATE TABLE `h3` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 -DROP DATABASE db1; -DROP TABLESPACE ts1; -DROP TABLESPACE ts2; -DROP TABLESPACE ts3; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -CREATE TABLESPACE ts2 ADD DATAFILE 'ts2.ibd'; -CREATE TABLESPACE ts3 ADD DATAFILE 'ts3.ibd'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SHOW CREATE TABLE db1.i1; -Table Create Table -i1 CREATE TABLE `i1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i2; -Table Create Table -i2 CREATE TABLE `i2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.i3; -Table Create Table -i3 CREATE TABLE `i3` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i4; -Table Create Table -i4 CREATE TABLE `i4` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_ts1; -Table Create Table -i_ts1 CREATE TABLE `i_ts1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_ts2; -Table Create Table -i_ts2 CREATE TABLE `i_ts2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_ts3; -Table Create Table -i_ts3 CREATE TABLE `i_ts3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_part1; -Table Create Table -i_part1 CREATE TABLE `i_part1` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.i_part2; -Table Create Table -i_part2 CREATE TABLE `i_part2` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.i_part3; -Table Create Table -i_part3 CREATE TABLE `i_part3` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.c1; -Table Create Table -c1 CREATE TABLE `c1` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.c2; -Table Create Table -c2 CREATE TABLE `c2` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.c3; -Table Create Table -c3 CREATE TABLE `c3` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.h1; -Table Create Table -h1 CREATE TABLE `h1` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.h2; -Table Create Table -h2 CREATE TABLE `h2` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.h3; -Table Create Table -h3 CREATE TABLE `h3` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP DATABASE db1; -DROP TABLESPACE ts1; -DROP TABLESPACE ts2; -DROP TABLESPACE ts3; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -CREATE TABLESPACE ts2 ADD DATAFILE 'ts2.ibd' ENCRYPTION='n'; -CREATE TABLESPACE ts3 ADD DATAFILE 'ts3.ibd' ENCRYPTION='y'; -CREATE TABLESPACE ts4 ADD DATAFILE 'ts4.ibd'; -SHOW CREATE DATABASE db1; -Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ -SHOW CREATE TABLE db1.i1; -Table Create Table -i1 CREATE TABLE `i1` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i2; -Table Create Table -i2 CREATE TABLE `i2` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -SHOW CREATE TABLE db1.i3; -Table Create Table -i3 CREATE TABLE `i3` ( - `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_ts1; -Table Create Table -i_ts1 CREATE TABLE `i_ts1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_ts2; -Table Create Table -i_ts2 CREATE TABLE `i_ts2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts2` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_ts3; -Table Create Table -i_ts3 CREATE TABLE `i_ts3` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts3` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.i_ts4; -Table Create Table -i_ts4 CREATE TABLE `i_ts4` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts4` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.i_part1; -Table Create Table -i_part1 CREATE TABLE `i_part1` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.i_part2; -Table Create Table -i_part2 CREATE TABLE `i_part2` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.i_part3; -Table Create Table -i_part3 CREATE TABLE `i_part3` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (30) ENGINE = InnoDB) */ -SHOW CREATE TABLE db1.c1; -Table Create Table -c1 CREATE TABLE `c1` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.c2; -Table Create Table -c2 CREATE TABLE `c2` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.c3; -Table Create Table -c3 CREATE TABLE `c3` ( - `f1` int NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.h1; -Table Create Table -h1 CREATE TABLE `h1` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.h2; -Table Create Table -h2 CREATE TABLE `h2` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.h3; -Table Create Table -h3 CREATE TABLE `h3` ( - `f1` int DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP DATABASE db1; -DROP TABLESPACE ts1; -DROP TABLESPACE ts2; -DROP TABLESPACE ts3; -DROP TABLESPACE ts4; -# Cleanup -DROP USER u1@localhost; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/rename_table.result b/mysql-test/suite/component_keyring_kms/r/rename_table.result deleted file mode 100644 index e79e07645b55..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/rename_table.result +++ /dev/null @@ -1,911 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# 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'; -# The test cases run RENAME TABLE to move tables from one database -# to another, with tables using file-per-table or general -# tablespace. And these operations are run in below configuration, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting per database default encryption to 'y' and 'n' -# - Setting table's encryption mode to 'y' and 'n'. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - -# - Check for warnings generated. -# -````````````````````````````````````````````````````````` -# Test using innodb_file_per_table tablespace. -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=false -# [ALTER TABLE ... RENAME ...] Case 1 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# 1.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 1.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -RENAME TABLE db2.ts1 TO db1.ts1_rename; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 1.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -# [ALTER TABLE ... RENAME ...] Case 2 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# 2.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -# 2.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -RENAME TABLE db2.ts1 TO db1.ts1_rename; -# 2.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 3 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# 3.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 3.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -RENAME TABLE db2.ts1 TO db1.ts1_rename; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 3.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt2 -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -# [ALTER TABLE ... RENAME ...] Case 4 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 4.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 4.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 4.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 5 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# 5.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -# 5.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -RENAME TABLE db2.ts1 TO db1.ts1_rename; -# 5.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt2 -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -# [ALTER TABLE ... RENAME ...] Case 6 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 6.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 6.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 6.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -````````````````````````````````````````````````````````` -# Test using general tablespace. -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=false -# [ALTER TABLE ... RENAME ...] Case 7 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=false; -# 7.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 7.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -RENAME TABLE db2.ts1 TO db1.ts1_rename; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -# 7.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 8 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=false; -# 8.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -# 8.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -RENAME TABLE db2.ts1 TO db1.ts1_rename; -# 8.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 9 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# 9.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 9.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -RENAME TABLE db2.ts1 TO db1.ts1_rename; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -# 9.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt2 -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 10 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 10.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 10.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 10.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -````````````````````````````````````````````````````````` -# We expect failure when the table encryption does not match -# with default database encryption. -# [ALTER TABLE ... RENAME ...] Case 11 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# 11.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -RENAME TABLE db2.fpt1 TO db1.fpt1_renamed; -# 11.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -RENAME TABLE db1.ts1 TO db2.ts1_rename; -ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. -RENAME TABLE db2.ts1 TO db1.ts1_rename; -# 11.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -RENAME TABLE sch1.fpt TO sch1.fpt_renamed; -RENAME TABLE sch1.ts TO sch1.ts_renamed; -RENAME TABLE sch2.fpt TO sch2.fpt_renamed; -RENAME TABLE sch2.ts TO sch2.ts_renamed; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1 -fpt1_renamed -fpt2 -ts1 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt2 -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# [ALTER TABLE ... RENAME ...] Case 12 ) -````````````````````````````````````````````````````````` -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE db2 DEFAULT ENCRYPTION='n'; -CREATE DATABASE sch1 DEFAULT ENCRYPTION='y'; -CREATE DATABASE sch2 DEFAULT ENCRYPTION='n'; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y'; -CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y'; -CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SET GLOBAL table_encryption_privilege_check=true; -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# 12.1. -# Rename table using file-per-table tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ; -ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ; -# 12.2. -# Rename table using general tablespace from db encryption='y' -# to db with encryption='n' and viceversa -ALTER TABLE db1.ts1 RENAME db2.ts1_rename ; -ALTER TABLE db2.ts1 RENAME db1.ts1_rename ; -# 12.3. -# Rename table (using file-per-table/general tablespace) -# within the database never fails. -ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ; -ALTER TABLE sch1.ts RENAME sch1.ts_renamed ; -ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ; -ALTER TABLE sch2.ts RENAME sch2.ts_renamed ; -SET GLOBAL table_encryption_privilege_check=false; -SHOW TABLES IN db1; -Tables_in_db1 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN db2; -Tables_in_db2 -fpt1_renamed -fpt2 -ts1_rename -ts2 -SHOW TABLES IN sch1; -Tables_in_sch1 -fpt_renamed -ts_renamed -SHOW TABLES IN sch2; -Tables_in_sch2 -fpt_renamed -ts_renamed -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP DATABASE db2; -DROP DATABASE sch1; -DROP DATABASE sch2; -DROP TABLESPACE ts1; -# Cleanup -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/table_encrypt_1.result b/mysql-test/suite/component_keyring_kms/r/table_encrypt_1.result deleted file mode 100644 index 2349043a93a3..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/table_encrypt_1.result +++ /dev/null @@ -1,224 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -SET GLOBAL innodb_file_per_table = 0; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -0 -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE t1(c int) ENCRYPTION="Y" tablespace innodb_system; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -CREATE TABLE t1(c int) ENCRYPTION="N" tablespace innodb_system; -DROP TABLE t1; -CREATE TEMPORARY TABLE t1(c int) ENCRYPTION="Y"; -ERROR HY000: InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -Error 1031 Table storage engine for 't1' doesn't have this option -CREATE TEMPORARY TABLE t1(c int) ENCRYPTION="N"; -ERROR HY000: InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -Error 1031 Table storage engine for 't1' doesn't have this option -CREATE TABLE t1(c int) ENCRYPTION="R" ENGINE = InnoDB; -ERROR HY000: Invalid encryption option. -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -# Kill the server -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER TABLE t1 ENCRYPTION="N", algorithm=inplace; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -ALTER TABLE t1 TABLESPACE=`innodb_system`; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE t1 ENCRYPTION="N", algorithm=copy; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -DROP TABLE t1; -CREATE TABLE t1 (c1 int) ENCRYPTION='N'; -ALTER TABLE t1 ENCRYPTION='P',algorithm=copy; -ERROR HY000: Invalid encryption option. -ALTER TABLE t1 ADD KEY k1 (c1) ,algorithm=inplace; -ALTER TABLE t1 ENCRYPTION='Y',algorithm=inplace; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -drop table t1; -CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION = "ZLIB" ENCRYPTION = "Y" ENGINE = InnoDB; -INSERT INTO t1 VALUES(0), (1), (2), (3), (4), (5), (6), (7), (8), (9); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int NOT NULL, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='ZLIB' ENCRYPTION='Y' -FLUSH TABLES t1 WITH READ LOCK; -UNLOCK TABLES; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -SELECT * FROM t1 ORDER BY c1; -c1 -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -DROP TABLE t1; -CREATE TABLE t1(c1 int null) ENCRYPTION='Y' ROW_FORMAT=compressed; -INSERT INTO t1 VALUES(0), (1), (2), (3), (4), (5), (6), (7), (8), (9); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -FLUSH TABLES t1 WITH READ LOCK; -UNLOCK TABLES; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -SELECT * FROM t1 ORDER BY c1; -c1 -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -DROP TABLE t1; -CREATE TABLE t1(c1 INT PRIMARY KEY, g geometry not null, spatial index(g)) ENCRYPTION = "Y" ENGINE = InnoDB; -INSERT INTO t1 VALUES(0, POINT(0, 0)); -INSERT INTO t1 VALUES(1, POINT(1, 1)); -INSERT INTO t1 VALUES(2, POINT(2, 2)); -INSERT INTO t1 VALUES(3, POINT(3, 3)); -INSERT INTO t1 VALUES(4, POINT(4, 4)); -INSERT INTO t1 VALUES(5, POINT(5, 5)); -INSERT INTO t1 VALUES(6, POINT(6, 6)); -INSERT INTO t1 VALUES(7, POINT(7, 7)); -INSERT INTO t1 VALUES(8, POINT(8, 8)); -INSERT INTO t1 VALUES(9, POINT(9, 9)); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int NOT NULL, - `g` geometry NOT NULL, - PRIMARY KEY (`c1`), - SPATIAL KEY `g` (`g`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -FLUSH TABLES t1 WITH READ LOCK; -UNLOCK TABLES; -SELECT c1, ST_AsText(g) FROM t1 ORDER BY c1 LIMIT 10; -c1 ST_AsText(g) -0 POINT(0 0) -1 POINT(1 1) -2 POINT(2 2) -3 POINT(3 3) -4 POINT(4 4) -5 POINT(5 5) -6 POINT(6 6) -7 POINT(7 7) -8 POINT(8 8) -9 POINT(9 9) -SELECT c1, ST_AsText(g) FROM t1 ORDER BY c1 LIMIT 10; -c1 ST_AsText(g) -0 POINT(0 0) -1 POINT(1 1) -2 POINT(2 2) -3 POINT(3 3) -4 POINT(4 4) -5 POINT(5 5) -6 POINT(6 6) -7 POINT(7 7) -8 POINT(8 8) -9 POINT(9 9) -DROP TABLE t1; -SET GLOBAL innodb_file_per_table=OFF; -CREATE TABLE t1 (c1 int); -ALTER TABLE t1 COMPRESSION='zlib'; -ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'COMPRESSION' -SHOW WARNINGS; -Level Code Message -Warning 138 InnoDB: Page Compression is not supported for the system tablespace -Error 1478 Table storage engine 'InnoDB' does not support the create option 'COMPRESSION' -ALTER TABLE t1 ENCRYPTION='Y',ALGORITHM=COPY; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL innodb_file_per_table=1; -DROP TABLE t1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/table_encrypt_2.result b/mysql-test/suite/component_keyring_kms/r/table_encrypt_2.result deleted file mode 100644 index 3677d7cd76c6..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/table_encrypt_2.result +++ /dev/null @@ -1,170 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -DROP TABLE IF EXISTS t1; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER INSTANCE ROTATE INNODB MASTER KEY; -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -DROP TABLE t1; -SET block_encryption_mode = 'aes-256-cbc'; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -CREATE TABLE tde_db.t1(c1 INT PRIMARY KEY, c2 char(50)) ENCRYPTION = 'Y' ENGINE = InnoDB; -INSERT INTO tde_db.t1 VALUES(0, 'abc'); -INSERT INTO tde_db.t1 VALUES(1, 'xyz'); -INSERT INTO tde_db.t1 VALUES(2, null); -INSERT INTO tde_db.t1 VALUES(3, null); -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -# Mysqldump output - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `tde_db` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; - -USE `tde_db`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `t1` ( - `c1` int NOT NULL, - `c2` char(50) DEFAULT NULL, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y'; -/*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO `t1` VALUES (0,'abc'),(1,'xyz'),(2,NULL),(3,NULL); -# Redirecting mysqlpump output to MYSQL_TMP_DIR/mysqlpump_encrypt.sql -DROP DATABASE tde_db; -Pattern "ALTER INSTANCE ROTATE INNODB MASTER KEY" found -# Loading tables from mysqlpump_encrypt.sql -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -INSERT INTO tde_db.t1 VALUES(4, null); -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -4 NULL -DROP DATABASE tde_db; -# -# Bug #26634507 CREATE_OPTIONS FLD IN INFORMATION_SCHEMA.TABLES NOT -# FILLING PROPERLY. -# The CREATE_OPTIONS field from I_S.TABLES should show the option -# 'ENCRYPTION='. -# -CREATE TABLE not_encrypted1 (col1 INT) ENCRYPTION='n'; -CREATE TABLE not_encrypted2 (col1 INT) ENCRYPTION='N'; -CREATE TABLE encrypted1 (col1 INT) ENCRYPTION='y'; -CREATE TABLE encrypted2 (col1 INT) ENCRYPTION='Y'; -SELECT TABLE_SCHEMA, TABLE_NAME, CREATE_OPTIONS -FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME like '%encrypted%' - ORDER BY TABLE_NAME; -TABLE_SCHEMA TABLE_NAME CREATE_OPTIONS -test encrypted1 ENCRYPTION='y' -test encrypted2 ENCRYPTION='Y' -test not_encrypted1 -test not_encrypted2 -DROP TABLE encrypted1; -DROP TABLE not_encrypted1; -DROP TABLE encrypted2; -DROP TABLE not_encrypted2; -SET GLOBAL innodb_file_per_table=1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/table_encrypt_3.result b/mysql-test/suite/component_keyring_kms/r/table_encrypt_3.result deleted file mode 100644 index ece0e31f74c2..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/table_encrypt_3.result +++ /dev/null @@ -1,1422 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Taking backup of local manifest file for MySQL server instance -# Create encrypt table before loading keyring -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -DROP TABLE IF EXISTS t_encrypt; -CREATE TABLE t_encrypt(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -# Starting server with keyring -# Restore local manifest file for MySQL server instance from backup -DROP DATABASE IF EXISTS tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -CREATE DATABASE tde_db; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt(c4 JSON , -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO tde_db.t_encrypt(c4,c7) VALUES('{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -INSERT INTO tde_db.t_encrypt(c4,c7) select c4,c7 from tde_db.t_encrypt; -SELECT c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -SELECT c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 c6 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -# In connection 1 -LOCK TABLES tde_db.t_encrypt WRITE; -# In connection default -SHOW OPEN TABLES LIKE 't_encrypt'; -Database Table In_use Name_locked -tde_db t_encrypt 1 0 -"ALTER INSTANCE.." do not conflict with "LOCK TABLE .." COMMAND -ALTER INSTANCE ROTATE INNODB MASTER KEY; -# In connection 1 -INSERT INTO tde_db.t_encrypt(c4,c7) VALUES('{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 c6 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -UNLOCK TABLES; -# In connection default -SELECT c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 c6 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 c6 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -DROP DATABASE tde_db; -SET GLOBAL innodb_file_per_table=1; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -DROP TABLE IF EXISTS tde_db.t_encrypt_1; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt(c1 INT, c2 char(20), c3 BLOB) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE TABLE tde_db.t_encrypt_1(c1 INT, c2 char(20)) ENCRYPTION="Yes" ENGINE = InnoDB; -ERROR HY000: Invalid encryption option. -CREATE TABLE tde_db.t_encrypt_1(c1 INT, c2 char(20)) ENCRYPTION="y" ENGINE = InnoDB; -DROP TABLE tde_db.t_encrypt_1; -CREATE TABLE tde_db.t_encrypt_1(c1 INT, c2 char(20),c3 BLOB) ENGINE = InnoDB; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL, - `c3` blob -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO tde_db.t_encrypt VALUES(0, "aaaaa",repeat('A', 20000)); -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -#Insert into non encrypted table -INSERT INTO tde_db.t_encrypt_1 SELECT * FROM tde_db.t_encrypt; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt_1 LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -SELECT COUNT(*) FROM tde_db.t_encrypt_1; -COUNT(*) -64 -# Starting server with keyring restart with keying -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -64 -#check non encrypted table -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt_1 LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -SELECT COUNT(*) FROM tde_db.t_encrypt_1; -COUNT(*) -64 -DROP TABLE tde_db.t_encrypt; -DROP TABLE tde_db.t_encrypt_1; -SET GLOBAL innodb_file_per_table=1; -DROP DATABASE IF EXISTS tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -CREATE DATABASE tde_db; -USE tde_db; -# File per table is set 0. Encryption not possible. -SET GLOBAL innodb_file_per_table = 0; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -0 -CREATE TABLE tde_db.t_encrypt(c4 JSON , -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLESPACE s_alt1 ADD DATAFILE 's_alt1.ibd'; -CREATE TABLE tde_db.t_encrypt (a int, b text) ENCRYPTION="Y" TABLESPACE=`s_alt1` ENGINE=InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP TABLESPACE s_alt1; -CREATE TEMPORARY TABLE tde_db.t_encrypt (a int, b text) ENCRYPTION="Y" ENGINE=InnoDB; -ERROR HY000: InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -Error 1031 Table storage engine for 't_encrypt' doesn't have this option -CREATE TABLE tde_db.t_encrypt_myisam (a int, b text) ENCRYPTION="Y" ENGINE=MyISAM; -ERROR 42000: The storage engine for the table doesn't support ENCRYPTION -CREATE PROCEDURE tde_db.row_format_t_encrypt(row_form VARCHAR(1000)) -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -DROP TABLE IF EXISTS tde_db.t_encrypt; -SET @sql_text = CONCAT('CREATE TABLE tde_db.t_encrypt ('," c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,c3 VARCHAR(255), c4 JSON ,c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED,c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL,c7 POINT NOT NULL SRID 0,spatial INDEX idx2 (c7) ) ", ' ENCRYPTION="Y" ', row_form ,' ENGINE=InnoDB'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -SHOW CREATE TABLE tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) VALUES (REPEAT('a',200),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -SELECT COUNT(*) FROM tde_db.t_encrypt; -SELECT c2,c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -DELETE FROM tde_db.t_encrypt WHERE c2 > 10; -UPDATE tde_db.t_encrypt SET c2 = 100 WHERE c2=1; -SELECT c2,c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -SHOW CREATE TABLE tde_db.t_encrypt; -end| -call tde_db.row_format_t_encrypt(" ROW_FORMAT=DYNAMIC "); -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC ENCRYPTION='Y' -COUNT(*) -32 -c2 c4 c5 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -c2 c4 c5 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC ENCRYPTION='Y' -# restart with keying -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -8 -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -16 -call tde_db.row_format_t_encrypt(" ROW_FORMAT=COMPACT "); -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT ENCRYPTION='Y' -COUNT(*) -32 -c2 c4 c5 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -c2 c4 c5 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT ENCRYPTION='Y' -# restart with keying -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -8 -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -16 -call tde_db.row_format_t_encrypt(" ROW_FORMAT=REDUNDANT "); -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=REDUNDANT ENCRYPTION='Y' -COUNT(*) -32 -c2 c4 c5 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -c2 c4 c5 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=REDUNDANT ENCRYPTION='Y' -# restart with keying -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -8 -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -16 -call tde_db.row_format_t_encrypt(" ROW_FORMAT=COMPRESSED " ); -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -COUNT(*) -32 -c2 c4 c5 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -c2 c4 c5 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED ENCRYPTION='Y' -# restart with keying -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -8 -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -16 -call tde_db.row_format_t_encrypt(" ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 "); -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 ENCRYPTION='Y' -COUNT(*) -32 -c2 c4 c5 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -13 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -14 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -c2 c4 c5 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 ENCRYPTION='Y' -# restart with keying -SELECT c2,c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 c4 c5 c6 ST_AsText(c7) -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -8 -INSERT INTO tde_db.t_encrypt(c3,c4,c7) SELECT c3,c4,c7 FROM tde_db.t_encrypt; -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -16 -# Create partition table -DROP TABLE tde_db.t_encrypt; -CREATE TABLE tde_db.t_encrypt (c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,c3 VARCHAR(255), c4 JSON ,c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED,c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL ) ENCRYPTION="Y" ENGINE=InnoDB PARTITION BY RANGE (c2) (PARTITION p1 VALUES LESS THAN (4),PARTITION p2 VALUES LESS THAN (8),PARTITION p3 VALUES LESS THAN (1000)) ; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - PRIMARY KEY (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -/*!50100 PARTITION BY RANGE (`c2`) -(PARTITION p1 VALUES LESS THAN (4) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (8) ENGINE = InnoDB, - PARTITION p3 VALUES LESS THAN (1000) ENGINE = InnoDB) */ -INSERT INTO tde_db.t_encrypt(c3,c4) VALUES (REPEAT('a',200),'{ "key_a": 1, "key_b": 2, "key_c": 3 }'); -INSERT INTO tde_db.t_encrypt(c3,c4) SELECT c3,c4 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4) SELECT c3,c4 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4) SELECT c3,c4 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4) SELECT c3,c4 FROM tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt(c3,c4) SELECT c3,c4 FROM tde_db.t_encrypt; -SELECT c2,c4,c5 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -5 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -SELECT c2,c4,c5,c6 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 c6 -1 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -5 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -DELETE FROM tde_db.t_encrypt WHERE c2 > 10; -UPDATE tde_db.t_encrypt SET c2 = 100 WHERE c2=1; -SELECT c2,c4,c5 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -5 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -SELECT c2,c4,c5,c6 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 c6 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -4 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -5 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -6 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -7 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -ALTER TABLE tde_db.t_encrypt TRUNCATE PARTITION p2; -SELECT c2,c4,c5 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 -SELECT c2,c4,c5,c6 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 c6 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` varchar(255) DEFAULT NULL, - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - PRIMARY KEY (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -/*!50100 PARTITION BY RANGE (`c2`) -(PARTITION p1 VALUES LESS THAN (4) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (8) ENGINE = InnoDB, - PARTITION p3 VALUES LESS THAN (1000) ENGINE = InnoDB) */ -# restart with keying -SELECT c2,c4,c5,c6 FROM tde_db.t_encrypt ORDER BY c2 LIMIT 10; -c2 c4 c5 c6 -2 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -3 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -8 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -9 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -10 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -100 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 -DROP TABLE tde_db.t_encrypt; -DROP DATABASE tde_db; -SET GLOBAL innodb_file_per_table=1; -DROP DATABASE IF EXISTS tde_db; -DROP TABLE IF EXISTS tde_db. t_encrypt; -CREATE DATABASE tde_db; -USE tde_db; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt(c2 INT NOT NULL PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON , -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE PROCEDURE tde_db.populate_t_encrypt() -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 2000) DO -insert into tde_db.t_encrypt(c2,c3,c4,c7) VALUES(i,CONCAT(REPEAT('a',200),LPAD(CAST(i AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.populate_t_encrypt_small() -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 500) DO -insert into tde_db.t_encrypt(c2,c3,c4,c7) VALUES(i,CONCAT(REPEAT('a',200),LPAD(CAST(i AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.read_t_encrypt() -begin -declare i int default 1; -while (i <= 30) DO -SELECT * FROM (SELECT * FROM tde_db.t_encrypt ORDER BY RAND() LIMIT 1) AS A WHERE A.c2 < 0 ; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.rotate_master_key() -begin -declare i int default 1; -declare has_error int default 0; -while (i <= 500) DO -ALTER INSTANCE ROTATE INNODB MASTER KEY; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.create_encrypt_table(encrypt VARCHAR(5)) -begin -declare i int default 1; -declare has_error int default 0; -while (i <= 50) DO -SET @sql_text = CONCAT('CREATE TABLE ',CONCAT('tde_db.t_encrypt_',encrypt,'_',i),' (c1 INT) ENCRYPTION="',encrypt,'"' ,' ENGINE=InnoDB'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -set i = i + 1; -end while; -end| -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL, - `c3` char(255) DEFAULT 'No text', - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -# In connection con1 - Running insert -call tde_db.populate_t_encrypt(); -# In connection con2 - Running insert -call tde_db.populate_t_encrypt_small(); -# In connection con3 : Running select -call tde_db.read_t_encrypt(); -# In connection con4 : Running select -call tde_db.read_t_encrypt(); -# In connection con5 - Running "alter instance" -call tde_db.rotate_master_key(); -# In connection con6 - Running "create table" -call tde_db.create_encrypt_table("Y"); -# In connection con7 - Running "create table" -call tde_db.create_encrypt_table("N"); -# In connection con1 -# In connection con2 -# In connection con3 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -# In connection con4 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -c2 c3 c4 c5 c6 c7 -# In connection con5 -# In connection con6 -# In connection con7 -USE tde_db; -SELECT c2,right(c3,20),c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 right(c3,20) c4 c5 ST_AsText(c7) -1 aaaaaaaaaaaaaaaa0001 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 aaaaaaaaaaaaaaaa0002 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 aaaaaaaaaaaaaaaa0003 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 aaaaaaaaaaaaaaaa0004 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -5 aaaaaaaaaaaaaaaa0005 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 aaaaaaaaaaaaaaaa0006 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 aaaaaaaaaaaaaaaa0007 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 aaaaaaaaaaaaaaaa0008 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 aaaaaaaaaaaaaaaa0009 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -10 aaaaaaaaaaaaaaaa0010 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 right(c3,20) c4 c5 c6 ST_AsText(c7) -1 aaaaaaaaaaaaaaaa0001 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 aaaaaaaaaaaaaaaa0002 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 aaaaaaaaaaaaaaaa0003 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 aaaaaaaaaaaaaaaa0004 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -5 aaaaaaaaaaaaaaaa0005 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 aaaaaaaaaaaaaaaa0006 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 aaaaaaaaaaaaaaaa0007 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 aaaaaaaaaaaaaaaa0008 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 aaaaaaaaaaaaaaaa0009 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -10 aaaaaaaaaaaaaaaa0010 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -2000 -SELECT c2,right(c3,20),c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt WHERE c2%200 = 0; -c2 right(c3,20) c4 c5 ST_AsText(c7) -200 aaaaaaaaaaaaaaaa0200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -400 aaaaaaaaaaaaaaaa0400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -600 aaaaaaaaaaaaaaaa0600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -800 aaaaaaaaaaaaaaaa0800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1000 aaaaaaaaaaaaaaaa1000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1200 aaaaaaaaaaaaaaaa1200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1400 aaaaaaaaaaaaaaaa1400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1600 aaaaaaaaaaaaaaaa1600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1800 aaaaaaaaaaaaaaaa1800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2000 aaaaaaaaaaaaaaaa2000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt WHERE c2%200 = 0; -c2 right(c3,20) c4 c5 c6 ST_AsText(c7) -200 aaaaaaaaaaaaaaaa0200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -400 aaaaaaaaaaaaaaaa0400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -600 aaaaaaaaaaaaaaaa0600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -800 aaaaaaaaaaaaaaaa0800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1000 aaaaaaaaaaaaaaaa1000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1200 aaaaaaaaaaaaaaaa1200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1400 aaaaaaaaaaaaaaaa1400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1600 aaaaaaaaaaaaaaaa1600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1800 aaaaaaaaaaaaaaaa1800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2000 aaaaaaaaaaaaaaaa2000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -# restart with keying -SELECT c2,right(c3,20),c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 right(c3,20) c4 c5 ST_AsText(c7) -1 aaaaaaaaaaaaaaaa0001 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2 aaaaaaaaaaaaaaaa0002 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -3 aaaaaaaaaaaaaaaa0003 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -4 aaaaaaaaaaaaaaaa0004 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -5 aaaaaaaaaaaaaaaa0005 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -6 aaaaaaaaaaaaaaaa0006 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -7 aaaaaaaaaaaaaaaa0007 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -8 aaaaaaaaaaaaaaaa0008 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -9 aaaaaaaaaaaaaaaa0009 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -10 aaaaaaaaaaaaaaaa0010 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c2 right(c3,20) c4 c5 c6 ST_AsText(c7) -1 aaaaaaaaaaaaaaaa0001 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2 aaaaaaaaaaaaaaaa0002 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -3 aaaaaaaaaaaaaaaa0003 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -4 aaaaaaaaaaaaaaaa0004 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -5 aaaaaaaaaaaaaaaa0005 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -6 aaaaaaaaaaaaaaaa0006 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -7 aaaaaaaaaaaaaaaa0007 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -8 aaaaaaaaaaaaaaaa0008 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -9 aaaaaaaaaaaaaaaa0009 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -10 aaaaaaaaaaaaaaaa0010 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -2000 -SELECT c2,right(c3,20),c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt WHERE c2%200 = 0; -c2 right(c3,20) c4 c5 ST_AsText(c7) -200 aaaaaaaaaaaaaaaa0200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -400 aaaaaaaaaaaaaaaa0400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -600 aaaaaaaaaaaaaaaa0600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -800 aaaaaaaaaaaaaaaa0800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1000 aaaaaaaaaaaaaaaa1000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1200 aaaaaaaaaaaaaaaa1200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1400 aaaaaaaaaaaaaaaa1400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1600 aaaaaaaaaaaaaaaa1600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -1800 aaaaaaaaaaaaaaaa1800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -2000 aaaaaaaaaaaaaaaa2000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt WHERE c2%200 = 0; -c2 right(c3,20) c4 c5 c6 ST_AsText(c7) -200 aaaaaaaaaaaaaaaa0200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -400 aaaaaaaaaaaaaaaa0400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -600 aaaaaaaaaaaaaaaa0600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -800 aaaaaaaaaaaaaaaa0800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1000 aaaaaaaaaaaaaaaa1000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1200 aaaaaaaaaaaaaaaa1200 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1400 aaaaaaaaaaaaaaaa1400 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1600 aaaaaaaaaaaaaaaa1600 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -1800 aaaaaaaaaaaaaaaa1800 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -2000 aaaaaaaaaaaaaaaa2000 {"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -DROP DATABASE tde_db; -SET GLOBAL innodb_file_per_table=1; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt(c1 INT, c2 char(20), c3 BLOB) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL, - `c3` blob -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO tde_db.t_encrypt VALUES(0, "aaaaa",repeat('A', 20000)); -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -INSERT INTO tde_db.t_encrypt select * from tde_db.t_encrypt; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -CREATE USER encryptprivuser@localhost IDENTIFIED BY 'auth'; -GRANT ALL PRIVILEGES ON *.* to encryptprivuser@localhost; -FLUSH PRIVILEGES; -CREATE USER encryptnonprivuser@localhost IDENTIFIED BY 'noauth'; -GRANT SELECT ON *.* to encryptnonprivuser@localhost; -FLUSH PRIVILEGES; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -# In connection 1 -SELECT CURRENT_USER(); -CURRENT_USER() -encryptprivuser@localhost -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -# In connection 2 -SELECT CURRENT_USER(); -CURRENT_USER() -encryptnonprivuser@localhost -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR 42000: Access denied; you need (at least one of) the SUPER or ENCRYPTION_KEY_ADMIN privilege(s) for this operation -CREATE TABLE tde_db.t_encrypt_np(c1 INT, c2 char(20), c3 BLOB) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR 42000: CREATE command denied to user 'encryptnonprivuser'@'localhost' for table 't_encrypt_np' -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -# In connection default -# Starting server with keyring -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -0 aaaaa AAAAAAAAAAAAAAAAAAAA -DROP USER encryptnonprivuser@localhost; -DROP USER encryptprivuser@localhost; -DROP TABLE tde_db.t_encrypt; -SET GLOBAL innodb_file_per_table=1; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt(c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 char(100), c3 BLOB , FULLTEXT INDEX `idx1` (c2)) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE TABLE tde_db.t_encrypt1(c11 INT , c22 char(100), c33 BLOB , FULLTEXT INDEX `idx1` (c22)) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c1` int NOT NULL AUTO_INCREMENT, - `c2` char(100) DEFAULT NULL, - `c3` blob, - PRIMARY KEY (`c1`), - FULLTEXT KEY `idx1` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -CREATE TABLE tde_db.t_encrypt2 (f1 INT PRIMARY KEY, f2 CHAR(100), -FOREIGN KEY (f1) REFERENCES tde_db.t_encrypt(c1) ON UPDATE CASCADE) ENCRYPTION="Y" ENGINE=InnoDB; -CREATE TRIGGER tde_db.trigger_encrypt_table AFTER INSERT ON tde_db.t_encrypt -FOR EACH ROW -begin -INSERT INTO tde_db.t_encrypt1 SET c11 = NEW.c1*-1, c22 = NEW.c2 , c33 = NEW.c3; -end| -INSERT INTO tde_db.t_encrypt(c2,c3) VALUES("transparanet tablespace encryption",repeat('A', 200)); -INSERT INTO tde_db.t_encrypt(c2,c3) VALUES("general tablespace option",repeat('A', 200)); -INSERT INTO tde_db.t_encrypt(c2,c3) VALUES("page level encryption",repeat('A', 200)); -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(1,"transparanet tablespace encryption"); -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(2,"general tablespace option"); -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -1 transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -3 page level encryption AAAAAAAAAAAAAAAAAAAA -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt WHERE MATCH c2 AGAINST ('tablespace'); -c1 c2 right(c3, 20) -1 transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt WHERE MATCH c2 AGAINST ('tablespace' IN BOOLEAN MODE); -c1 c2 right(c3, 20) -1 transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt WHERE MATCH c2 AGAINST ('+tablespace -encryption' IN BOOLEAN MODE); -c1 c2 right(c3, 20) -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -ALTER TABLE tde_db.t_encrypt DROP INDEX idx1; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -1 transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -3 page level encryption AAAAAAAAAAAAAAAAAAAA -ALTER TABLE tde_db.t_encrypt ADD COLUMN c4 CHAR(20) DEFAULT 'text'; -SELECT c1,c2,right(c3, 20),c4 FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) c4 -1 transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA text -2 general tablespace option AAAAAAAAAAAAAAAAAAAA text -3 page level encryption AAAAAAAAAAAAAAAAAAAA text -CREATE VIEW tde_db.t_encrypt_view AS SELECT c1,c2 FROM tde_db.t_encrypt; -SELECT c2 FROM tde_db.t_encrypt_view LIMIT 10; -c2 -transparanet tablespace encryption -general tablespace option -page level encryption -SELECT A.c2,B.c2,right(B.c3,20) FROM tde_db.t_encrypt_view A , tde_db.t_encrypt B WHERE A.c2 = B.c2; -c2 c2 right(B.c3,20) -transparanet tablespace encryption transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA -general tablespace option general tablespace option AAAAAAAAAAAAAAAAAAAA -page level encryption page level encryption AAAAAAAAAAAAAAAAAAAA -DROP VIEW tde_db.t_encrypt_view; -SELECT c11,c22,right(c33, 20) FROM tde_db.t_encrypt1 LIMIT 10; -c11 c22 right(c33, 20) --1 transparanet tablespace encryption AAAAAAAAAAAAAAAAAAAA --2 general tablespace option AAAAAAAAAAAAAAAAAAAA --3 page level encryption AAAAAAAAAAAAAAAAAAAA -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(2,"general tablespace option"); -ERROR 23000: Duplicate entry '2' for key 't_encrypt2.PRIMARY' -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(8,"general tablespace option"); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`tde_db`.`t_encrypt2`, CONSTRAINT `t_encrypt2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t_encrypt` (`c1`) ON UPDATE CASCADE) -SELECT f1,f2 FROM tde_db.t_encrypt2; -f1 f2 -1 transparanet tablespace encryption -2 general tablespace option -UPDATE tde_db.t_encrypt SET c1=10 WHERE c1=1; -SELECT f1,f2 FROM tde_db.t_encrypt2; -f1 f2 -2 general tablespace option -10 transparanet tablespace encryption -DROP DATABASE tde_db; -SET GLOBAL innodb_file_per_table=1; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt (c2 INT NOT NULL AUTO_INCREMENT ,c3 VARCHAR(255), c4 JSON ,c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED,c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL,c7 POINT NOT NULL SRID 0,spatial INDEX idx2 (c7) , PRIMARY KEY (c2,c3(100))) ENCRYPTION="Y" ENGINE=InnoDB; -CREATE PROCEDURE tde_db.txn_t_encrypt() -BEGIN -declare i int default 0; -declare rowcnt int default 0; -START TRANSACTION; -WHILE (i <= 2000) DO -SET i = i + 1; -SET rowcnt = rowcnt + 1; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) VALUES (CONCAT(REPEAT('a',10),REPEAT(i,10)),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -IF (rowcnt = 3) THEN -UPDATE tde_db.t_encrypt SET c4 = '{ "key_a": 21, "key_b": 22, "key_c": 23 }' WHERE c2 = i-1 ; -DELETE FROM tde_db.t_encrypt WHERE c2 = i; -SAVEPOINT A; -END IF; -IF (rowcnt = 5) THEN -UPDATE tde_db.t_encrypt SET c4 = '{ "key_a": 41, "key_b": 42, "key_c": 43 }' WHERE c2 = i-1 ; -DELETE FROM tde_db.t_encrypt WHERE c2 = i; -SAVEPOINT B; -END IF; -IF (rowcnt = 10) THEN -ROLLBACK TO SAVEPOINT A; -COMMIT; -SET rowcnt = 0; -START TRANSACTION; -END IF; -END WHILE; -COMMIT; -end| -call tde_db.txn_t_encrypt(); -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -401 -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt LIMIT 10; -c2 RIGHT(c3,20) c4 -1 aaaaaaaaaa1111111111 {"key_a": 1, "key_b": 2, "key_c": 3} -2 aaaaaaaaaa2222222222 {"key_a": 21, "key_b": 22, "key_c": 23} -11 11111111111111111111 {"key_a": 1, "key_b": 2, "key_c": 3} -12 12121212121212121212 {"key_a": 21, "key_b": 22, "key_c": 23} -21 21212121212121212121 {"key_a": 1, "key_b": 2, "key_c": 3} -22 22222222222222222222 {"key_a": 21, "key_b": 22, "key_c": 23} -31 31313131313131313131 {"key_a": 1, "key_b": 2, "key_c": 3} -32 32323232323232323232 {"key_a": 21, "key_b": 22, "key_c": 23} -41 41414141414141414141 {"key_a": 1, "key_b": 2, "key_c": 3} -42 42424242424242424242 {"key_a": 21, "key_b": 22, "key_c": 23} -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt WHERE c2 > 500 AND c2 < 600; -c2 RIGHT(c3,20) c4 -501 01501501501501501501 {"key_a": 1, "key_b": 2, "key_c": 3} -502 02502502502502502502 {"key_a": 21, "key_b": 22, "key_c": 23} -511 11511511511511511511 {"key_a": 1, "key_b": 2, "key_c": 3} -512 12512512512512512512 {"key_a": 21, "key_b": 22, "key_c": 23} -521 21521521521521521521 {"key_a": 1, "key_b": 2, "key_c": 3} -522 22522522522522522522 {"key_a": 21, "key_b": 22, "key_c": 23} -531 31531531531531531531 {"key_a": 1, "key_b": 2, "key_c": 3} -532 32532532532532532532 {"key_a": 21, "key_b": 22, "key_c": 23} -541 41541541541541541541 {"key_a": 1, "key_b": 2, "key_c": 3} -542 42542542542542542542 {"key_a": 21, "key_b": 22, "key_c": 23} -551 51551551551551551551 {"key_a": 1, "key_b": 2, "key_c": 3} -552 52552552552552552552 {"key_a": 21, "key_b": 22, "key_c": 23} -561 61561561561561561561 {"key_a": 1, "key_b": 2, "key_c": 3} -562 62562562562562562562 {"key_a": 21, "key_b": 22, "key_c": 23} -571 71571571571571571571 {"key_a": 1, "key_b": 2, "key_c": 3} -572 72572572572572572572 {"key_a": 21, "key_b": 22, "key_c": 23} -581 81581581581581581581 {"key_a": 1, "key_b": 2, "key_c": 3} -582 82582582582582582582 {"key_a": 21, "key_b": 22, "key_c": 23} -591 91591591591591591591 {"key_a": 1, "key_b": 2, "key_c": 3} -592 92592592592592592592 {"key_a": 21, "key_b": 22, "key_c": 23} -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt ORDER BY c2 DESC LIMIT 10; -c2 RIGHT(c3,20) c4 -2001 20012001200120012001 {"key_a": 1, "key_b": 2, "key_c": 3} -1992 19921992199219921992 {"key_a": 21, "key_b": 22, "key_c": 23} -1991 19911991199119911991 {"key_a": 1, "key_b": 2, "key_c": 3} -1982 19821982198219821982 {"key_a": 21, "key_b": 22, "key_c": 23} -1981 19811981198119811981 {"key_a": 1, "key_b": 2, "key_c": 3} -1972 19721972197219721972 {"key_a": 21, "key_b": 22, "key_c": 23} -1971 19711971197119711971 {"key_a": 1, "key_b": 2, "key_c": 3} -1962 19621962196219621962 {"key_a": 21, "key_b": 22, "key_c": 23} -1961 19611961196119611961 {"key_a": 1, "key_b": 2, "key_c": 3} -1952 19521952195219521952 {"key_a": 21, "key_b": 22, "key_c": 23} -# Starting server with keyring -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -401 -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt LIMIT 10; -c2 RIGHT(c3,20) c4 -1 aaaaaaaaaa1111111111 {"key_a": 1, "key_b": 2, "key_c": 3} -2 aaaaaaaaaa2222222222 {"key_a": 21, "key_b": 22, "key_c": 23} -11 11111111111111111111 {"key_a": 1, "key_b": 2, "key_c": 3} -12 12121212121212121212 {"key_a": 21, "key_b": 22, "key_c": 23} -21 21212121212121212121 {"key_a": 1, "key_b": 2, "key_c": 3} -22 22222222222222222222 {"key_a": 21, "key_b": 22, "key_c": 23} -31 31313131313131313131 {"key_a": 1, "key_b": 2, "key_c": 3} -32 32323232323232323232 {"key_a": 21, "key_b": 22, "key_c": 23} -41 41414141414141414141 {"key_a": 1, "key_b": 2, "key_c": 3} -42 42424242424242424242 {"key_a": 21, "key_b": 22, "key_c": 23} -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt WHERE c2 > 500 AND c2 < 600; -c2 RIGHT(c3,20) c4 -501 01501501501501501501 {"key_a": 1, "key_b": 2, "key_c": 3} -502 02502502502502502502 {"key_a": 21, "key_b": 22, "key_c": 23} -511 11511511511511511511 {"key_a": 1, "key_b": 2, "key_c": 3} -512 12512512512512512512 {"key_a": 21, "key_b": 22, "key_c": 23} -521 21521521521521521521 {"key_a": 1, "key_b": 2, "key_c": 3} -522 22522522522522522522 {"key_a": 21, "key_b": 22, "key_c": 23} -531 31531531531531531531 {"key_a": 1, "key_b": 2, "key_c": 3} -532 32532532532532532532 {"key_a": 21, "key_b": 22, "key_c": 23} -541 41541541541541541541 {"key_a": 1, "key_b": 2, "key_c": 3} -542 42542542542542542542 {"key_a": 21, "key_b": 22, "key_c": 23} -551 51551551551551551551 {"key_a": 1, "key_b": 2, "key_c": 3} -552 52552552552552552552 {"key_a": 21, "key_b": 22, "key_c": 23} -561 61561561561561561561 {"key_a": 1, "key_b": 2, "key_c": 3} -562 62562562562562562562 {"key_a": 21, "key_b": 22, "key_c": 23} -571 71571571571571571571 {"key_a": 1, "key_b": 2, "key_c": 3} -572 72572572572572572572 {"key_a": 21, "key_b": 22, "key_c": 23} -581 81581581581581581581 {"key_a": 1, "key_b": 2, "key_c": 3} -582 82582582582582582582 {"key_a": 21, "key_b": 22, "key_c": 23} -591 91591591591591591591 {"key_a": 1, "key_b": 2, "key_c": 3} -592 92592592592592592592 {"key_a": 21, "key_b": 22, "key_c": 23} -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt ORDER BY c2 DESC LIMIT 10; -c2 RIGHT(c3,20) c4 -2001 20012001200120012001 {"key_a": 1, "key_b": 2, "key_c": 3} -1992 19921992199219921992 {"key_a": 21, "key_b": 22, "key_c": 23} -1991 19911991199119911991 {"key_a": 1, "key_b": 2, "key_c": 3} -1982 19821982198219821982 {"key_a": 21, "key_b": 22, "key_c": 23} -1981 19811981198119811981 {"key_a": 1, "key_b": 2, "key_c": 3} -1972 19721972197219721972 {"key_a": 21, "key_b": 22, "key_c": 23} -1971 19711971197119711971 {"key_a": 1, "key_b": 2, "key_c": 3} -1962 19621962196219621962 {"key_a": 21, "key_b": 22, "key_c": 23} -1961 19611961196119611961 {"key_a": 1, "key_b": 2, "key_c": 3} -1952 19521952195219521952 {"key_a": 21, "key_b": 22, "key_c": 23} -DROP DATABASE tde_db; -# Global privilege ENCRYPTION_KEY_ADMIN can replace super. -USE test; -CREATE USER encryption_admin@localhost IDENTIFIED BY 'foo'; -GRANT ENCRYPTION_KEY_ADMIN, CREATE ON *.* TO encryption_admin@localhost; -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -REVOKE ENCRYPTION_KEY_ADMIN ON *.* FROM encryption_admin@localhost; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR 42000: Access denied; you need (at least one of) the SUPER or ENCRYPTION_KEY_ADMIN privilege(s) for this operation -DROP USER encryption_admin@localhost; -DROP TABLE t1; -SET GLOBAL innodb_file_per_table=1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/table_encrypt_4.result b/mysql-test/suite/component_keyring_kms/r/table_encrypt_4.result deleted file mode 100644 index 2502ab0fa9e5..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/table_encrypt_4.result +++ /dev/null @@ -1,165 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -DROP TABLE IF EXISTS t1; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -# Create a table with encryption -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -SELECT * FROM t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -# Test export/import encrypted tablespace. -FLUSH TABLES test.t1 FOR EXPORT; -UNLOCK TABLES; -ALTER TABLE test.t1 DISCARD TABLESPACE; -ALTER TABLE test.t1 IMPORT TABLESPACE; -CHECK TABLE test.t1; -Table Op Msg_type Msg_text -test.t1 check status OK -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -SELECT * FROM test.t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -SELECT * FROM test.t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER TABLE test.t1 DISCARD TABLESPACE; -# Try import in another session. -ALTER TABLE test.t1 IMPORT TABLESPACE; -SELECT * FROM test.t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER TABLE test.t1 DISCARD TABLESPACE; -# Import without .cfg file is posible -# copying .cfp and .ibd file -ALTER TABLE test.t1 IMPORT TABLESPACE; -Warnings: -Warning 1810 InnoDB: IO Read error: (2, No such file or directory) Error opening './test/t1.cfg', will attempt to import without schema verification -SELECT * FROM test.t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT * FROM test.t1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -ALTER TABLE test.t1 DISCARD TABLESPACE; -# Import without .cfp file -# copying .cfg and .ibd file -ALTER TABLE test.t1 IMPORT TABLESPACE; -ERROR HY000: Schema mismatch (Table is in an encrypted tablespace, but the encryption meta-data file cannot be found while importing.) -ALTER INSTANCE ROTATE INNODB MASTER KEY; -# Import without .idb file -# copying .cfp and .cfg file -ALTER TABLE test.t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Tablespace not found -ALTER INSTANCE ROTATE INNODB MASTER KEY; -# Schema mismatch dest table without encryption - fix result -DROP TABLE t1; -CREATE TABLE test.t1(c1 INT, c2 char(20)) ENGINE = InnoDB; -ALTER TABLE test.t1 DISCARD TABLESPACE; -ALTER TABLE test.t1 IMPORT TABLESPACE; -ERROR HY000: Schema mismatch (Encryption attribute in the file does not match the dictionary.) -# Import got expected error. -DROP TABLE t1; -CREATE TABLE test.t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ALTER TABLE test.t1 DISCARD TABLESPACE; -SET SESSION DEBUG="+d, fsp_header_rotate_encryption_failure"; -ALTER TABLE test.t1 IMPORT TABLESPACE; -ERROR HY000: Got error 168 - 'Unknown (generic) error from engine' from storage engine -Warnings: -Note 1051 Unknown table 'test.t1' -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/table_encrypt_6.result b/mysql-test/suite/component_keyring_kms/r/table_encrypt_6.result deleted file mode 100644 index bb7607caf8c6..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/table_encrypt_6.result +++ /dev/null @@ -1,74 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# Taking backup of local manifest file for MySQL server instance -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB; -ALTER TABLE t1 ENCRYPTION="Y", algorithm=copy; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -DROP TABLE t1; -# Restore local manifest file for MySQL server instance from backup -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -# Restore local manifest file for MySQL server instance from backup -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -DROP TABLE t1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/table_encrypt_debug.result b/mysql-test/suite/component_keyring_kms/r/table_encrypt_debug.result deleted file mode 100644 index e91ec8b81493..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/table_encrypt_debug.result +++ /dev/null @@ -1,220 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -# -# Set encryption ON for table `mysql` -# -ALTER TABLESPACE mysql ENCRYPTION='Y'; -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -SET debug='-d,skip_dd_table_access_check'; -# -# Test crash point `ib_crash_during_rotation_for_encryption` -# -SET SESSION DEBUG="+d,ib_encryption_rotate_crash"; -CREATE TABLE tde_db.t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -tde_db/t1 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -SHOW CREATE TABLE tde_db.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -INSERT INTO tde_db.t1 VALUES(0, "aaaaa"); -INSERT INTO tde_db.t1 VALUES(1, "bbbbb"); -INSERT INTO tde_db.t1 VALUES(2, "ccccc"); -INSERT INTO tde_db.t1 VALUES(3, "ddddd"); -# Execute the statement that causes the crash -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR HY000: Lost connection to MySQL server during query -SET SESSION DEBUG="-d,ib_encryption_rotate_crash"; -Pattern "ib_encryption_rotate_crash" found -# Show that encryption is OK -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -tde_db/t1 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -INSERT INTO tde_db.t1 VALUES(4, "eeeee"); -SELECT * FROM tde_db.t1 ORDER BY c1; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -# Create a second table with encryption -CREATE TABLE tde_db.t2(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SHOW CREATE TABLE tde_db.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -tde_db/t1 autoextend_size=0;encryption=Y; -tde_db/t2 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -INSERT INTO tde_db.t2 VALUES(0, "aaaaa"); -INSERT INTO tde_db.t2 VALUES(1, "bbbbb"); -# Remove the current auto.cnf file to make sure a new server uuid is -# generated at restart. -# Execute the statement that causes the crash -SET SESSION DEBUG="+d,ib_encryption_rotate_crash"; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR HY000: Lost connection to MySQL server during query -SET SESSION DEBUG="-d,ib_encryption_rotate_crash"; -Pattern "ib_encryption_rotate_crash" found -# Show that encryption is OK -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -tde_db/t1 autoextend_size=0;encryption=Y; -tde_db/t2 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -INSERT INTO tde_db.t1 VALUES(5, "fffff"); -SELECT * FROM tde_db.t1 ORDER BY c1; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -SELECT * FROM tde_db.t2 ORDER BY c1; -c1 c2 -0 aaaaa -1 bbbbb -# Rotate Encryption again without the Crash -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT * FROM tde_db.t1 ORDER BY c1 ; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -# Show that encryption is OK -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -mysql encryption=Y;explicit_encryption=1; -tde_db/t1 autoextend_size=0;encryption=Y; -tde_db/t2 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -SELECT * FROM tde_db.t1 ORDER BY c1 ; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -SELECT * FROM tde_db.t2 ORDER BY c1 ; -c1 c2 -0 aaaaa -1 bbbbb -DROP TABLE tde_db.t2; -ALTER TABLESPACE mysql ENCRYPTION='N'; -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -tde_db/t1 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -# -# Test crash point `ib_crash_during_create_for_encryption` during a CREATE TABLE -# -SET SESSION DEBUG="+d,ib_crash_during_create_for_encryption"; -# Execute the statement that causes the crash -CREATE TABLE tde_db.t2(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Lost connection to MySQL server during query -SET SESSION DEBUG="-d,ib_crash_during_create_for_encryption"; -# Show encrypted tables. -SET debug='+d,skip_dd_table_access_check'; -SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%'; -NAME OPTIONS -tde_db/t1 autoextend_size=0;encryption=Y; -SET debug='-d,skip_dd_table_access_check'; -SELECT * FROM tde_db.t1 ORDER BY c1 LIMIT 5; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -INSERT INTO tde_db.t1 VALUES(6, "ggggg"); -SELECT * FROM tde_db.t1 ORDER BY c1 ; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -SELECT * FROM tde_db.t2; -ERROR 42S02: Table 'tde_db.t2' doesn't exist -# -# Test crash point `ib_crash_during_decrypt_page` during an IMPORT TABLESPACE -# -FLUSH TABLE tde_db.t1 FOR EXPORT; -UNLOCK TABLES; -ALTER TABLE tde_db.t1 DISCARD TABLESPACE; -SET SESSION DEBUG="+d,ib_crash_during_decrypt_page"; -# Execute the statement that causes the crash -ALTER TABLE tde_db.t1 IMPORT TABLESPACE; -ERROR HY000: Lost connection to MySQL server during query -SET SESSION DEBUG="-d,ib_crash_during_decrypt_page"; -INSERT INTO tde_db.t1 VALUES(7, "hhhhh"); -ERROR HY000: Tablespace has been discarded for table 't1' -SELECT * FROM tde_db.t1 ORDER BY c1 ; -ERROR HY000: Tablespace has been discarded for table 't1' -DROP TABLE tde_db.t1; -DROP DATABASE tde_db; -# -# Bug #27307740 [ERROR] [MY-011066] INNODB: CORRUPT LOG RECORD FOUND -# DURING CRASH RECOVERY -# -CREATE DATABASE tde_db; -CREATE TABLE tde_db.test_tbl(c1 int) ENCRYPTION="Y" ENGINE=InnoDB; -SET SESSION DEBUG="+d, keyring_generate_fail"; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -ERROR HY000: Lost connection to MySQL server during query -SET SESSION debug="-d, keyring_generate_fail"; -SELECT COUNT(*) FROM tde_db.test_tbl; -COUNT(*) -0 -DROP TABLE tde_db.test_tbl; -DROP DATABASE tde_db; -SET GLOBAL innodb_file_per_table=1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/table_encrypt_fts.result b/mysql-test/suite/component_keyring_kms/r/table_encrypt_fts.result deleted file mode 100644 index 91550cecc2d5..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/table_encrypt_fts.result +++ /dev/null @@ -1,57 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# Bug#30787535 : FULLTEXT INDEX TABLES CREATED IN ENCRYPTED SCHEMA ARE NOT ENCRYPTED -# -######### -# SETUP # -######### - -######################################################################### -# 1 : WITH KEYRING -######################################################################### -# Create a new 'unencrypted' table -CREATE TABLE t1 (id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -C1 TEXT(500), -C2 VARCHAR(200), -C3 VARCHAR(200)) ENCRYPTION='N' ENGINE=InnoDB; -set global innodb_buf_flush_list_now = 1; -# --------------------------------------------------------------- -# Test 1 : t1 un-encrypted, FTS tables should also be unencrypted -# --------------------------------------------------------------- -# Check that tablespace file is not encrypted -# Print result -table space is Unencrypted. -CREATE FULLTEXT INDEX idx ON t1(C1); -Warnings: -Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID -set global innodb_buf_flush_list_now = 1; -# Check that FTS tablespaces file is not encrypted -# Print result -table space is Unencrypted. -# --------------------------------------------------------------- -# Test 1 : t1 encrypted, FTS tables should also be unencrypted -# --------------------------------------------------------------- -ALTER TABLE t1 ENCRYPTION='Y'; -# Check that tablespace file is encrypted now -# Print result -table space is Encrypted. -# Check that FTS tablespace file is encrypted now -# Print result -table space is Encrypted. -########### -# CLEANUP # -########### -DROP TABLE test.t1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/table_encrypt_kill.result b/mysql-test/suite/component_keyring_kms/r/table_encrypt_kill.result deleted file mode 100644 index 07f3394e366e..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/table_encrypt_kill.result +++ /dev/null @@ -1,210 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -DROP DATABASE IF EXISTS tde_db; -DROP TABLE IF EXISTS tde_db. t_encrypt; -CREATE DATABASE tde_db; -USE tde_db; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE tde_db.t_encrypt(c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON, -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE TABLE tde_db.t_non_encrypt(c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON, -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENGINE = InnoDB; -CREATE PROCEDURE tde_db.populate_t_encrypt() -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 5000) DO -insert into tde_db.t_encrypt(c2,c3,c4,c7) VALUES(i,CONCAT(REPEAT('a',200),LPAD(CAST(i AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.populate_t_non_encrypt() -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 5000) DO -insert into tde_db.t_non_encrypt(c2,c3,c4,c7) VALUES(i,CONCAT(REPEAT('a',200),LPAD(CAST(i AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.update_t_encrypt() -begin -declare i int default 1; -declare ustr varchar(1000); -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 5000) DO -SET @sql_text = CONCAT (' UPDATE tde_db.t_encrypt SET c3 =', 'CONCAT(REPEAT(a,200),LPAD(CAST(',i, 'AS CHAR),4,0) ORDER BY RAND() LIMIT 1'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.delete_t_encrypt() -begin -declare i int default 1; -declare ustr varchar(1000); -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1062 SET has_error = 1; -while (i <= 5000) DO -SET @sql_text = CONCAT (' DELETE FROM tde_db.t_encrypt LIMIT 1'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.read_t_encrypt() -begin -declare i int default 1; -while (i <= 5000) DO -SELECT * FROM (SELECT * FROM tde_db.t_encrypt ORDER BY RAND() LIMIT 1) AS A WHERE A.c2 < 0 ; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.alter_t_encrypt() -begin -declare i int default 1; -declare has_error int default 0; -while (i <= 5000) DO -ALTER INSTANCE ROTATE INNODB MASTER KEY; -set i = i + 1; -end while; -end| -CREATE PROCEDURE tde_db.create_t_encrypt(encrypt VARCHAR(5), tcnt INT) -begin -declare i int default 1; -declare has_error int default 0; -DECLARE CONTINUE HANDLER FOR 1050 SET has_error = 1; -SET i = tcnt ; -while (i <= 5000) DO -SET @sql_text = CONCAT('CREATE TABLE ',CONCAT('tde_db.t_encrypt_',encrypt,'_',i),' (c1 INT) ENCRYPTION="',encrypt,'"',' ENGINE=InnoDB'); -PREPARE stmt FROM @sql_text; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -set i = i + 1; -end while; -end| -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c2` int NOT NULL AUTO_INCREMENT, - `c3` char(255) DEFAULT 'No text', - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - PRIMARY KEY (`c2`), - SPATIAL KEY `idx2` (`c7`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -# Case1: insert on encrypt and non encrypt table in parallel during kill -# In connection con1 - Running insert on encrypt table -call tde_db.populate_t_encrypt(); -# In connection con2 - Running insert on encrypt table -call tde_db.populate_t_encrypt(); -# In connection con3 - Running insert into non encrypt table -call tde_db.populate_t_non_encrypt(); -# kill and restart the server -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -INSERT INTO tde_db.t_encrypt(c2,c3,c4,c7) VALUES(10000,CONCAT(REPEAT('a',200),LPAD(CAST(1 AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_non_encrypt LIMIT 10; -INSERT INTO tde_db.t_non_encrypt(c2,c3,c4,c7) VALUES(10000,CONCAT(REPEAT('a',200),LPAD(CAST(1 AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT 1; -1 -1 -# Case2: insert/update/delete on encrypt in parallel during kill -DROP TABLE tde_db.t_encrypt; -DROP TABLE tde_db.t_non_encrypt; -CREATE TABLE tde_db.t_encrypt(c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON, -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE TABLE tde_db.t_non_encrypt(c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON, -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENGINE = InnoDB; -# In connection con1 - Running insert on encrypt table -call tde_db.populate_t_encrypt(); -# In connection con2 - Running update on encrypt table -call tde_db.update_t_encrypt(); -# In connection con3 - Running delete on encrypt table -call tde_db.delete_t_encrypt(); -# kill and restart the server -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -INSERT INTO tde_db.t_encrypt(c2,c3,c4,c7) VALUES(10000,CONCAT(REPEAT('a',200),LPAD(CAST(1 AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_non_encrypt LIMIT 10; -INSERT INTO tde_db.t_non_encrypt(c2,c3,c4,c7) VALUES(10000,CONCAT(REPEAT('a',200),LPAD(CAST(1 AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT 1; -1 -1 -# Case3: select,create and insert on encrypt in parallel during kill -DROP TABLE tde_db.t_encrypt; -DROP TABLE tde_db.t_non_encrypt; -CREATE TABLE tde_db.t_encrypt(c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON, -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENCRYPTION="Y" ENGINE = InnoDB; -CREATE TABLE tde_db.t_non_encrypt(c2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -c3 CHAR(255) Default 'No text', -c4 JSON, -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENGINE = InnoDB; -# In connection con1 - Running insert on encrypt table -call tde_db.populate_t_encrypt(); -# In connection con2 - Running select on encrypt table -call tde_db.read_t_encrypt(); -# kill and restart the server -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -INSERT INTO tde_db.t_encrypt(c2,c3,c4,c7) VALUES(10000,CONCAT(REPEAT('a',200),LPAD(CAST(1 AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT c2,right(c3,20),c4,c5,c6,ST_AsText(c7) FROM tde_db.t_non_encrypt LIMIT 10; -INSERT INTO tde_db.t_non_encrypt(c2,c3,c4,c7) VALUES(10000,CONCAT(REPEAT('a',200),LPAD(CAST(1 AS CHAR),4,'0')),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -SELECT 1; -1 -1 -DROP DATABASE tde_db; -SET GLOBAL innodb_file_per_table=1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/tablespace.result b/mysql-test/suite/component_keyring_kms/r/tablespace.result deleted file mode 100644 index 839e03ffdfef..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/tablespace.result +++ /dev/null @@ -1,693 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# Pre-define user u1, which is used in different tests below. -CREATE USER u1@localhost; -GRANT ALL ON db1.* 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'; -# This test run CREATE/ALTER TABLESPACE in different configurations, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting default_table_encryption to true/false. -# - With and without ENCRYPTION clause. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - Test INFORMATION_SCHEMA.INNODB_TABLESPACES -# - Check for warnings generated. -# -````````````````````````````````````````````````````````` -# CREATE TABLESPACE with explicit ENCRYPTION clause -# table_encryption_privilege_check=false -# [CREATE TABLESPACE] Case 1 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 2 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -# [CREATE TABLESPACE] Case 3 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 4 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# CREATE TABLESPACE with explicit ENCRYPTION clause -# table_encryption_privilege_check=false -# [CREATE TABLESPACE] Case 5 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 6 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 7 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 8 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=true; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# table_encryption_privilege_check=true -# [CREATE TABLESPACE] Case 9 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SHOW WARNINGS; -ERROR HY000: Tablespace encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 10 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 11 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [CREATE TABLESPACE] Case 12 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=true; -SET SESSION default_table_encryption=true; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SHOW WARNINGS; -ERROR HY000: Tablespace encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Check for invalid ENCRYPTION clause value. -# [CREATE TABLESPACE] Case 13 ) -````````````````````````````````````````````````````````` -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='k'; -SHOW WARNINGS; -ERROR HY000: Invalid encryption option. -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# The test cases run ALTER TABLESPACE (with no tables) -# See test tablespace_with_tables.test. -````````````````````````````````````````````````````````` -# Unencrypted TABLESPACE to Unencrypted TABLESPACE (Nop) -# -# [ALTER TABLESPACE] Case 1 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER TABLESPACE] Case 2 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Encrypted TABLESPACE to Encrypted TABLESPACE (Nop) -# -# [ALTER TABLESPACE] Case 3 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=true; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER TABLESPACE] Case 4 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=true; -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Unencrypted TABLESPACE to encrypted TABLESPACE -# with database encryption default 'n' -# -# [ALTER TABLESPACE] Case 5 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER TABLESPACE] Case 6 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -ERROR HY000: Tablespace encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3828 Tablespace encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Unencrypted TABLESPACE to encrypted TABLESPACE -# with database encryption default 'y' -# -# [ALTER TABLESPACE] Case 7 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET SESSION default_table_encryption=true; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER TABLESPACE] Case 8 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET SESSION default_table_encryption=true; -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Encrypted TABLESPACE to unencrypted TABLESPACE -# with database encryption default 'n' -# -# [ALTER TABLESPACE] Case 9 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER TABLESPACE] Case 10 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Encrypted TABLESPACE to unencrypted TABLESPACE -# with database encryption default 'y' -# -# [ALTER TABLESPACE] Case 11 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=true; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# [ALTER TABLESPACE] Case 12 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=true; -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -ERROR HY000: Tablespace encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3828 Tablespace encryption differ from 'default_table_encryption' setting, and user doesn't have enough privilege. -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -# Check that we never fail with TABLE_ENCRYPTION_ADMIN -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 N -DROP TABLESPACE ts1; -# Revoke TABLE_ENCRYPTION_ADMIN from user. -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -````````````````````````````````````````````````````````` -# Check for Invalid encryption option. -# [ALTER TABLESPACE] Case 13 ) -````````````````````````````````````````````````````````` -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -SET SESSION default_table_encryption=false; -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='k'; -ERROR HY000: Invalid encryption option. -SHOW WARNINGS; -Level Code Message -Error 3184 Invalid encryption option. -Error 1533 Failed to alter: TABLESPACE ts1 -Error 1030 Got error 168 - 'Unknown (generic) error from engine' from storage engine -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE 'ts1'; -NAME ENCRYPTION -ts1 Y -DROP TABLESPACE ts1; -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# Cleanup -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_1.result b/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_1.result deleted file mode 100644 index 799478386e92..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_1.result +++ /dev/null @@ -1,1046 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# START : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB; -ALTER TABLESPACE encrypt_ts ENCRYPTION="Y"; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -DROP TABLESPACE encrypt_ts; -######################################################################### -# RESTART 1 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -DROP TABLE IF EXISTS t1; ---------------------------- -SYSTEM TABLESPACE ---------------------------- -CREATE TABLE t1(c int) ENCRYPTION="Y" tablespace innodb_system ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SET GLOBAL innodb_file_per_table = 0; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -0 -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="N" ENGINE = InnoDB; -SHOW WARNINGS; -Level Code Message -DROP TABLE t1; -CREATE TABLE t1(c int) ENCRYPTION="Y" tablespace innodb_system ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -CREATE TABLE t1(c int) ENCRYPTION="N" tablespace innodb_system ENGINE = InnoDB; -SHOW WARNINGS; -Level Code Message -DROP TABLE t1; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -ALTER TABLESPACE innodb_system ENCRYPTION='Y'; -ERROR 42000: InnoDB: `innodb_system` is a reserved tablespace name. ---------------------------- -TEMPORARY TABLESPACE ---------------------------- -CREATE TEMPORARY TABLE t1(c int) ENCRYPTION="Y"; -ERROR HY000: InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -Error 1031 Table storage engine for 't1' doesn't have this option -CREATE TEMPORARY TABLE t1(c int) ENCRYPTION="N"; -ERROR HY000: InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: ENCRYPTION is not accepted for temporary tablespace. For temporary tablespace encryption please use innodb_temp_tablespace_encrypt variable. -Error 1031 Table storage engine for 't1' doesn't have this option ------------------------------------------------- -CREATE TABLESPACE WITH INVALID ENCRYPTION OPTION ------------------------------------------------- -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='R'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=y; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'y' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=Y; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Y' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=n; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'n' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=N; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'N' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=0; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=null; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='TRUE'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=TRUE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRUE' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=True; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'True' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='True'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='true'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=true; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'true' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=FALSE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FALSE' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='FALSE'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=False; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'False' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='False'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=false; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'false' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='false'; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=-1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=''; -ERROR HY000: Invalid encryption option. -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption=""; -ERROR HY000: Invalid encryption option. ----------------------------------------------------- -CREATE ENCRYPTED TABLESPACE IN MyISAM STORAGE ENGINE ----------------------------------------------------- -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=MyISAM encryption='Y'; -ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=MyISAM encryption='y'; -ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=MyISAM encryption='N'; -ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=MyISAM encryption='n'; -ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MyISAM' does not support the create option 'CREATE TABLESPACE' ----------------------------------------------------- -CREATE ENCRYPTED TABLESPACE IN MEMORY STORAGE ENGINE ----------------------------------------------------- -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=Memory encryption='Y'; -ERROR HY000: Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=Memory encryption='y'; -ERROR HY000: Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=Memory encryption='N'; -ERROR HY000: Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=Memory encryption='n'; -ERROR HY000: Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' -SHOW WARNINGS; -Level Code Message -Error 1478 Table storage engine 'MEMORY' does not support the create option 'CREATE TABLESPACE' ----------------------------------------------- -CREATE TABLESPACE WITH VALID ENCRYPTION OPTION ----------------------------------------------- -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption="y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption="n"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB encryption="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' engine=INNODB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N ------------------------------------------------ -ALTER TABLESPACE WITH INVALID ENCRYPTION OPTION ------------------------------------------------ -ALTER TABLESPACE encrypt_ts ENCRYPTION='R'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=0; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=TRUE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRUE' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION='TRUE'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=True; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'True' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION='True'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=true; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'true' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION='true'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=FALSE; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FALSE' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION='FALSE'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=False; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'False' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION='False'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=false; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'false' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION='false'; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=null; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=n; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'n' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=N; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'N' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=y; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'y' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=N; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'N' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=-1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION=''; -ERROR HY000: Invalid encryption option. -ALTER TABLESPACE encrypt_ts ENCRYPTION=""; -ERROR HY000: Invalid encryption option. ---------------------------------------------- -ALTER TABLESPACE WITH VALID ENCRYPTION OPTION ---------------------------------------------- -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="n"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="n"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="n"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='n'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="n"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -ALTER TABLESPACE encrypt_ts ENCRYPTION="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N ------------------------------------------ -CREATE/ALTER TABLE in FILE-PER-TABLE TABLESPACE ------------------------------------------ -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 Y -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -ALTER TABLE t1 encryption="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 N -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="N" ENGINE = InnoDB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 N -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 encryption="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 Y -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE=innodb_file_per_table ENCRYPTION="Y" ENGINE = InnoDB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 Y -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -ALTER TABLE t1 encryption="N"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 N -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE=innodb_file_per_table ENCRYPTION="N" ENGINE = InnoDB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 N -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 encryption="Y"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -test/t1 Y -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y' -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE=encrypt_ts ENGINE = InnoDB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE=encrypt_ts ENCRYPTION='Y' ENGINE = InnoDB; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; --------------------------- -CREATE/ALTER TABLE IN GENERAL TABLESPACE --------------------------- -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION="Y" ENGINE = InnoDB; -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION="N" ENGINE = InnoDB; -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'unencrypted' table while using an 'encrypted' tablespace. -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION="R" ENGINE = InnoDB; -ERROR HY000: Invalid encryption option. -SHOW WARNINGS; -Level Code Message -Error 3184 Invalid encryption option. -Error 1031 Table storage engine for 't1' doesn't have this option -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION='Y' ENGINE = InnoDB; -ALTER TABLE t1 encryption='Y'; -ALTER TABLE t1 encryption='N'; -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -ALTER TABLE t1 encryption='R'; -ERROR HY000: Invalid encryption option. -DROP TABLE t1; -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION="N" ENGINE = InnoDB; -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENCRYPTION="R" ENGINE = InnoDB; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -CREATE TABLE t1(c1 INT, c2 char(20)) TABLESPACE encrypt_ts ENGINE = InnoDB; -ALTER TABLE t1 encryption='Y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -ALTER TABLE t1 encryption='N'; -ALTER TABLE t1 encryption='R'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -DROP TABLE t1; -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -######################################################################### -# RESTART 2 : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 3 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -SET GLOBAL innodb_file_per_table=1; -DROP TABLE t1; -CREATE TABLE t1(c2 char(100) , FULLTEXT INDEX `idx1` (c2)) ENGINE=InnoDB -tablespace=encrypt_ts ENCRYPTION='Y'; -ALTER TABLE t1 DROP INDEX idx1; -ALTER TABLE t1 ADD COLUMN c4 CHAR(20); -DROP TABLE t1; ----------------------- -ALGORITHM=COPY/INPLACE ----------------------- -ALTER TABLESPACE encrypt_ts ENCRYPTION="N", algorithm=copy; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'algorithm=copy' at line 1 -ALTER TABLESPACE encrypt_ts ENCRYPTION="N", algorithm=inplace; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'algorithm=inplace' at line 1 -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENCRYPTION="N", algorithm=copy; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'algorithm=copy' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENCRYPTION="N", algorithm=inplace; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'algorithm=inplace' at line 1 ------------ -COMPRESSION ------------ -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' COMPRESSION = "ZLIB" ENCRYPTION = "Y" ENGINE = InnoDB; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COMPRESSION = "ZLIB" ENCRYPTION = "Y" ENGINE = InnoDB' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENCRYPTION = "Y" ENGINE = InnoDB; -ALTER TABLESPACE encrypt_ts COMPRESSION = "ZLIB"; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COMPRESSION = "ZLIB"' at line 1 -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encryt_ts_1k ADD DATAFILE 'encrypt_ts_1k.ibd' FILE_BLOCK_SIZE=1k ENCRYPTION='Y'; -CREATE TABLESPACE encryt_ts_2k ADD DATAFILE 'encrypt_ts_2k.ibd' FILE_BLOCK_SIZE=2k ENCRYPTION='Y'; -CREATE TABLESPACE encryt_ts_4k ADD DATAFILE 'encrypt_ts_4k.ibd' FILE_BLOCK_SIZE=4k ENCRYPTION='Y'; -CREATE TABLESPACE encryt_ts_8k ADD DATAFILE 'encrypt_ts_8k.ibd' FILE_BLOCK_SIZE=8k ENCRYPTION='Y'; -CREATE TABLESPACE encryt_ts_16k ADD DATAFILE 'encrypt_ts_16k.ibd' FILE_BLOCK_SIZE=16k ENCRYPTION='Y'; -CREATE TABLESPACE encryt_ts_32k ADD DATAFILE 'encrypt_ts_32k.ibd' FILE_BLOCK_SIZE=32k ENCRYPTION='Y'; -ERROR HY000: InnoDB: Cannot create a tablespace with FILE_BLOCK_SIZE=32768 because INNODB_PAGE_SIZE=16384. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: Cannot create a tablespace with FILE_BLOCK_SIZE=32768 because INNODB_PAGE_SIZE=16384. -Error 1528 Failed to create TABLESPACE encryt_ts_32k -Error 1031 Table storage engine for 'encryt_ts_32k' doesn't have this option -DROP tablespace encryt_ts_1k; -DROP tablespace encryt_ts_2k; -DROP tablespace encryt_ts_4k; -DROP tablespace encryt_ts_8k; -DROP tablespace encryt_ts_16k; -CREATE TABLESPACE encrypt_ts ENCRYPTION='Y' ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 10M -MAX_SIZE = 100M NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 10M -MAX_SIZE = 1' at line 1 -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENCRYPTION='Y' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M -MAX_SIZE = 100M NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB ENCRYPTION='Y' AUTOEXTEND_SIZE = 12M -MAX_SIZE = 100M NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M ENCRYPTION='Y' -MAX_SIZE = 100M NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M MAX_SIZE = 100M -ENCRYPTION='Y' NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M MAX_SIZE = 100M -NODEGROUP = 5 ENCRYPTION='Y' WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M MAX_SIZE = 100M -NODEGROUP = 5 WAIT ENCRYPTION='Y' COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M MAX_SIZE = 100M -NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' ENCRYPTION='Y' INITIAL_SIZE = 100M EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M MAX_SIZE = 100M -NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M ENCRYPTION='Y'EXTENT_SIZE = 100M; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB AUTOEXTEND_SIZE = 12M MAX_SIZE = 100M -NODEGROUP = 5 WAIT COMMENT = 'TABLESPACE ENCRYPTION' INITIAL_SIZE = 100M EXTENT_SIZE = 100M ENCRYPTION='Y'; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB ENCRYPTION='Y'; -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -ALTER TABLESPACE encrypt_ts RENAME TO encrypt_ts_renamed; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts_renamed'; -NAME ENCRYPTION -encrypt_ts_renamed Y -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='test/t1'; -NAME ENCRYPTION -SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME="t1"; -TABLE_SCHEMA TABLE_NAME ENGINE CREATE_OPTIONS -test t1 InnoDB ENCRYPTION='Y' -SHOW CREATE TABLE test.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts_renamed` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; -DROP TABLESPACE encrypt_ts_renamed; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB ENCRYPTION='Y'; -CREATE PROCEDURE populate_t1() -BEGIN -DECLARE i int DEFAULT 1; -START TRANSACTION; -WHILE (i <= 10) DO -INSERT INTO t1 VALUES (i,CONCAT('a', i)); -SET i = i + 1; -END WHILE; -COMMIT; -END| -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y' ROW_FORMAT=COMPRESSED; -ERROR HY000: InnoDB: Tablespace `encrypt_ts` cannot contain a COMPRESSED table -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: Tablespace `encrypt_ts` cannot contain a COMPRESSED table -Error 1031 Table storage engine for 't1' doesn't have this option -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y' ROW_FORMAT=FIXED; -ERROR HY000: Table storage engine for 't1' doesn't have this option -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y' ROW_FORMAT=DYNAMIC; -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y' ROW_FORMAT=REDUNDANT; -DROP TABLE t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y' ROW_FORMAT=COMPACT; -DROP TABLE t1; -DROP PROCEDURE populate_t1; -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y' KEY_BLOCK_SIZE=1; -ERROR HY000: InnoDB: Tablespace `encrypt_ts` cannot contain a COMPRESSED table -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB: Tablespace `encrypt_ts` cannot contain a COMPRESSED table -Error 1031 Table storage engine for 't1' doesn't have this option -DROP TABLESPACE encrypt_ts; -SET block_encryption_mode = 'aes-256-cbc'; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE = InnoDB ENCRYPTION='Y'; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -CREATE TABLE tde_db.t1(c1 INT PRIMARY KEY, c2 char(50)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y'; -INSERT INTO tde_db.t1 VALUES(0, 'abc'); -INSERT INTO tde_db.t1 VALUES(1, 'xyz'); -INSERT INTO tde_db.t1 VALUES(2, null); -INSERT INTO tde_db.t1 VALUES(3, null); -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT * FROM tde_db.t1 LIMIT 10; -c1 c2 -0 abc -1 xyz -2 NULL -3 NULL -DROP DATABASE tde_db; -DROP TABLESPACE encrypt_ts; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENCRYPTION ='Y' ENGINE=InnoDB; -CREATE TABLE tde_db.t_encrypt(c4 JSON , -c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED, -c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL, -c7 POINT NOT NULL SRID 0, -spatial INDEX idx2 (c7) -) ENGINE=InnoDB TABLESPACE=encrypt_ts ENCRYPTION='Y'; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - SPATIAL KEY `idx2` (`c7`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -INSERT INTO tde_db.t_encrypt(c4,c7) VALUES('{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -INSERT INTO tde_db.t_encrypt(c4,c7) select c4,c7 from tde_db.t_encrypt; -SELECT c4,c5,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 POINT(383293632 1754448) -SELECT c4,c5,c6,ST_AsText(c7) FROM tde_db.t_encrypt LIMIT 10; -c4 c5 c6 ST_AsText(c7) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -{"key_a": 1, "key_b": 2, "key_c": 3} 1 2 POINT(383293632 1754448) -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c4` json DEFAULT NULL, - `c5` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_a')) STORED, - `c6` int GENERATED ALWAYS AS (json_extract(`c4`,_utf8mb4'$.key_b')) VIRTUAL, - `c7` point NOT NULL /*!80003 SRID 0 */, - SPATIAL KEY `idx2` (`c7`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE IF EXISTS tde_db.t_encrypt; -CREATE TABLE tde_db.t_encrypt(c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 char(100), c3 BLOB , FULLTEXT INDEX `idx1` (c2)) ENGINE=InnoDB TABLESPACE=encrypt_ts ENCRYPTION='Y'; -CREATE TABLE tde_db.t_encrypt1(c11 INT , c22 char(100), c33 BLOB , FULLTEXT INDEX `idx1` (c22)) ENGINE=InnoDB TABLESPACE=encrypt_ts ENCRYPTION='Y'; -SHOW CREATE TABLE tde_db.t_encrypt; -Table Create Table -t_encrypt CREATE TABLE `t_encrypt` ( - `c1` int NOT NULL AUTO_INCREMENT, - `c2` char(100) DEFAULT NULL, - `c3` blob, - PRIMARY KEY (`c1`), - FULLTEXT KEY `idx1` (`c2`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE tde_db.t_encrypt1; -Table Create Table -t_encrypt1 CREATE TABLE `t_encrypt1` ( - `c11` int DEFAULT NULL, - `c22` char(100) DEFAULT NULL, - `c33` blob, - FULLTEXT KEY `idx1` (`c22`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -CREATE TABLE tde_db.t_encrypt2 (f1 INT PRIMARY KEY, f2 CHAR(100), -FOREIGN KEY (f1) REFERENCES tde_db.t_encrypt(c1) ON UPDATE CASCADE) ENGINE=InnoDB TABLESPACE=encrypt_ts ENCRYPTION='Y'; -CREATE TRIGGER tde_db.trigger_encrypt_table AFTER INSERT ON tde_db.t_encrypt -FOR EACH ROW -begin -INSERT INTO tde_db.t_encrypt1 SET c11 = NEW.c1*-1, c22 = NEW.c2 , c33 = NEW.c3; -end| -INSERT INTO tde_db.t_encrypt(c2,c3) VALUES("transparent tablespace encryption",repeat('A', 200)); -INSERT INTO tde_db.t_encrypt(c2,c3) VALUES("general tablespace option",repeat('A', 200)); -INSERT INTO tde_db.t_encrypt(c2,c3) VALUES("page level encryption",repeat('A', 200)); -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(1,"transparent tablespace encryption"); -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(2,"general tablespace option"); -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -1 transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -3 page level encryption AAAAAAAAAAAAAAAAAAAA -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt WHERE MATCH c2 AGAINST ('tablespace'); -c1 c2 right(c3, 20) -1 transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt WHERE MATCH c2 AGAINST ('tablespace' IN BOOLEAN MODE); -c1 c2 right(c3, 20) -1 transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt WHERE MATCH c2 AGAINST ('+tablespace -encryption' IN BOOLEAN MODE); -c1 c2 right(c3, 20) -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -ALTER TABLE tde_db.t_encrypt DROP INDEX idx1; -SELECT c1,c2,right(c3, 20) FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) -1 transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA -2 general tablespace option AAAAAAAAAAAAAAAAAAAA -3 page level encryption AAAAAAAAAAAAAAAAAAAA -ALTER TABLE tde_db.t_encrypt ADD COLUMN c4 CHAR(20) DEFAULT 'text'; -SELECT c1,c2,right(c3, 20),c4 FROM tde_db.t_encrypt LIMIT 10; -c1 c2 right(c3, 20) c4 -1 transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA text -2 general tablespace option AAAAAAAAAAAAAAAAAAAA text -3 page level encryption AAAAAAAAAAAAAAAAAAAA text -CREATE VIEW tde_db.t_encrypt_view AS SELECT c1,c2 FROM tde_db.t_encrypt; -SELECT c2 FROM tde_db.t_encrypt_view LIMIT 10; -c2 -transparent tablespace encryption -general tablespace option -page level encryption -SELECT A.c2,B.c2,right(B.c3,20) FROM tde_db.t_encrypt_view A , tde_db.t_encrypt B WHERE A.c2 = B.c2; -c2 c2 right(B.c3,20) -transparent tablespace encryption transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA -general tablespace option general tablespace option AAAAAAAAAAAAAAAAAAAA -page level encryption page level encryption AAAAAAAAAAAAAAAAAAAA -DROP VIEW tde_db.t_encrypt_view; -SELECT c11,c22,right(c33, 20) FROM tde_db.t_encrypt1 LIMIT 10; -c11 c22 right(c33, 20) --1 transparent tablespace encryption AAAAAAAAAAAAAAAAAAAA --2 general tablespace option AAAAAAAAAAAAAAAAAAAA --3 page level encryption AAAAAAAAAAAAAAAAAAAA -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(2,"general tablespace option"); -ERROR 23000: Duplicate entry '2' for key 't_encrypt2.PRIMARY' -INSERT INTO tde_db.t_encrypt2(f1,f2) VALUES(8,"general tablespace option"); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`tde_db`.`t_encrypt2`, CONSTRAINT `t_encrypt2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t_encrypt` (`c1`) ON UPDATE CASCADE) -SELECT f1,f2 FROM tde_db.t_encrypt2; -f1 f2 -1 transparent tablespace encryption -2 general tablespace option -UPDATE tde_db.t_encrypt SET c1=10 WHERE c1=1; -SELECT f1,f2 FROM tde_db.t_encrypt2; -f1 f2 -2 general tablespace option -10 transparent tablespace encryption -DROP DATABASE tde_db; -DROP DATABASE IF EXISTS tde_db; -CREATE DATABASE tde_db; -USE tde_db; -DROP TABLE IF EXISTS tde_db.t_encrypt; -CREATE TABLE tde_db.t_encrypt (c2 INT NOT NULL AUTO_INCREMENT ,c3 VARCHAR(255), c4 JSON ,c5 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_a')) STORED,c6 INT GENERATED ALWAYS AS (JSON_EXTRACT(c4,'$.key_b')) VIRTUAL,c7 POINT NOT NULL SRID 0,spatial INDEX idx2 (c7) , PRIMARY KEY (c2,c3(100))) ENGINE=InnoDB TABLESPACE=encrypt_ts ENCRYPTION='Y'; -CREATE PROCEDURE tde_db.txn_t_encrypt() -BEGIN -declare i int default 0; -declare rowcnt int default 0; -START TRANSACTION; -WHILE (i <= 2000) DO -SET i = i + 1; -SET rowcnt = rowcnt + 1; -INSERT INTO tde_db.t_encrypt(c3,c4,c7) VALUES (CONCAT(REPEAT('a',10),REPEAT(i,10)),'{ "key_a": 1, "key_b": 2, "key_c": 3 }',ST_GeomFromText('POINT(383293632 1754448)')); -IF (rowcnt = 3) THEN -UPDATE tde_db.t_encrypt SET c4 = '{ "key_a": 21, "key_b": 22, "key_c": 23 }' WHERE c2 = i-1 ; -DELETE FROM tde_db.t_encrypt WHERE c2 = i; -SAVEPOINT A; -END IF; -IF (rowcnt = 5) THEN -UPDATE tde_db.t_encrypt SET c4 = '{ "key_a": 41, "key_b": 42, "key_c": 43 }' WHERE c2 = i-1 ; -DELETE FROM tde_db.t_encrypt WHERE c2 = i; -SAVEPOINT B; -END IF; -IF (rowcnt = 10) THEN -ROLLBACK TO SAVEPOINT A; -COMMIT; -SET rowcnt = 0; -START TRANSACTION; -END IF; -END WHILE; -COMMIT; -end| -call tde_db.txn_t_encrypt(); -SELECT COUNT(*) FROM tde_db.t_encrypt; -COUNT(*) -401 -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt LIMIT 10; -c2 RIGHT(c3,20) c4 -1 aaaaaaaaaa1111111111 {"key_a": 1, "key_b": 2, "key_c": 3} -2 aaaaaaaaaa2222222222 {"key_a": 21, "key_b": 22, "key_c": 23} -11 11111111111111111111 {"key_a": 1, "key_b": 2, "key_c": 3} -12 12121212121212121212 {"key_a": 21, "key_b": 22, "key_c": 23} -21 21212121212121212121 {"key_a": 1, "key_b": 2, "key_c": 3} -22 22222222222222222222 {"key_a": 21, "key_b": 22, "key_c": 23} -31 31313131313131313131 {"key_a": 1, "key_b": 2, "key_c": 3} -32 32323232323232323232 {"key_a": 21, "key_b": 22, "key_c": 23} -41 41414141414141414141 {"key_a": 1, "key_b": 2, "key_c": 3} -42 42424242424242424242 {"key_a": 21, "key_b": 22, "key_c": 23} -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt WHERE c2 > 500 AND c2 < 600; -c2 RIGHT(c3,20) c4 -501 01501501501501501501 {"key_a": 1, "key_b": 2, "key_c": 3} -502 02502502502502502502 {"key_a": 21, "key_b": 22, "key_c": 23} -511 11511511511511511511 {"key_a": 1, "key_b": 2, "key_c": 3} -512 12512512512512512512 {"key_a": 21, "key_b": 22, "key_c": 23} -521 21521521521521521521 {"key_a": 1, "key_b": 2, "key_c": 3} -522 22522522522522522522 {"key_a": 21, "key_b": 22, "key_c": 23} -531 31531531531531531531 {"key_a": 1, "key_b": 2, "key_c": 3} -532 32532532532532532532 {"key_a": 21, "key_b": 22, "key_c": 23} -541 41541541541541541541 {"key_a": 1, "key_b": 2, "key_c": 3} -542 42542542542542542542 {"key_a": 21, "key_b": 22, "key_c": 23} -551 51551551551551551551 {"key_a": 1, "key_b": 2, "key_c": 3} -552 52552552552552552552 {"key_a": 21, "key_b": 22, "key_c": 23} -561 61561561561561561561 {"key_a": 1, "key_b": 2, "key_c": 3} -562 62562562562562562562 {"key_a": 21, "key_b": 22, "key_c": 23} -571 71571571571571571571 {"key_a": 1, "key_b": 2, "key_c": 3} -572 72572572572572572572 {"key_a": 21, "key_b": 22, "key_c": 23} -581 81581581581581581581 {"key_a": 1, "key_b": 2, "key_c": 3} -582 82582582582582582582 {"key_a": 21, "key_b": 22, "key_c": 23} -591 91591591591591591591 {"key_a": 1, "key_b": 2, "key_c": 3} -592 92592592592592592592 {"key_a": 21, "key_b": 22, "key_c": 23} -SELECT c2,RIGHT(c3,20),c4 FROM tde_db.t_encrypt ORDER BY c2 DESC LIMIT 10; -c2 RIGHT(c3,20) c4 -2001 20012001200120012001 {"key_a": 1, "key_b": 2, "key_c": 3} -1992 19921992199219921992 {"key_a": 21, "key_b": 22, "key_c": 23} -1991 19911991199119911991 {"key_a": 1, "key_b": 2, "key_c": 3} -1982 19821982198219821982 {"key_a": 21, "key_b": 22, "key_c": 23} -1981 19811981198119811981 {"key_a": 1, "key_b": 2, "key_c": 3} -1972 19721972197219721972 {"key_a": 21, "key_b": 22, "key_c": 23} -1971 19711971197119711971 {"key_a": 1, "key_b": 2, "key_c": 3} -1962 19621962196219621962 {"key_a": 21, "key_b": 22, "key_c": 23} -1961 19611961196119611961 {"key_a": 1, "key_b": 2, "key_c": 3} -1952 19521952195219521952 {"key_a": 21, "key_b": 22, "key_c": 23} -DROP DATABASE tde_db; -DROP TABLESPACE encrypt_ts; -######################################################################### -# RESTART 4 : WITH KEYRING AND --INNODB_DIRECTORIES -######################################################################### -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'MYSQL_TMP_DIR/encrypt_ts.ibd' ENCRYPTION='Y'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -CREATE DATABASE tde_db; -CREATE TABLE tde_db.t1(c1 INT PRIMARY KEY, c2 char(50)) ENGINE = InnoDB TABLESPACE encrypt_ts ENCRYPTION='Y'; -INSERT INTO tde_db.t1 VALUES(0, 'abc'); -INSERT INTO tde_db.t1 VALUES(1, 'xyz'); -SELECT * FROM tde_db.t1; -c1 c2 -0 abc -1 xyz -# Remote tablespace listing -encrypt_ts.ibd -DROP TABLE tde_db.t1; -DROP DATABASE tde_db; -######################################################################### -# Cleanup -######################################################################### -DROP TABLESPACE encrypt_ts; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_10.result b/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_10.result deleted file mode 100644 index 14988947ca07..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_10.result +++ /dev/null @@ -1,515 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# START : WITHOUT KEYRING - -######### -# SETUP # -######### -# Taking backup of local manifest file for MySQL server instance -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -#-------------------------- TEST 1 -------------------------------------# -# RESTART 1 : WITH KEYRING -# Restore local manifest file for MySQL server instance from backup -######################################################################## -# ALTER TABLESPACE : Unencrypted => Encrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# RESTART 2 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before flushing page 0 at the end -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" not found -# RESTART 3 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" found -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 4 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before flushing page 0 at the end -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 5 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 6 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 2 -------------------------------------# -# RESTART 7 : WITH KEYRING -######################################################################## -# ALTER TABLESPACE : Unencrypted => Encrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# RESTART 8 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just after flushing page 0 at the end -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" not found -# RESTART 9 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" found -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 10 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just after flushing page 0 at the end -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 11 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 12 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 3 -------------------------------------# -# RESTART 13 : WITH KEYRING -######################################################################## -# ALTER TABLESPACE : Unencrypted => Encrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# RESTART 14 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before resetting_progress on page 0 -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" not found -# RESTART 15 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" found -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 16 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before resetting_progress on page 0 -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 17 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 18 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 4 -------------------------------------# -# RESTART 19 : WITH KEYRING -# Encrypt the tablespace. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 20 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before updating flags -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 21 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 22 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 5 -------------------------------------# -# RESTART 23 : WITH KEYRING -######################################################################## -# ALTER TABLESPACE : Unencrypted => Encrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# RESTART 24 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before encryption processing is started -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" not found -# RESTART 25 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" found -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 26 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just before encryption processing is started -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 27 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 28 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 6 -------------------------------------# -# RESTART 29 : WITH KEYRING -######################################################################## -# ALTER TABLESPACE : Unencrypted => Encrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# RESTART 30 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just after encryption processing is finished -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" not found -# RESTART 31 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" found -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 32 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just after encryption processing is finished -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 33 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 34 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 7 -------------------------------------# -# RESTART 35 : WITH KEYRING -######################################################################## -# ALTER TABLESPACE : Unencrypted => Encrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# RESTART 36 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just after inserting DDL Log Entry -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" not found -# RESTART 37 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming ENCRYPTION for tablespace encrypt_ts" found -Pattern "Finished ENCRYPTION for tablespace encrypt_ts" found -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE : Encrypted => Unencrypted # -######################################################################## -# Set process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# RESTART 38 : WITH KEYRING PLUGIN after crash and cause resume operation -# to crash just after inserting DDL Log Entry -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -Got one of the listed errors -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" not found -# RESTART 39 : Normal. In this restart resume operation should finish successfully -# Wait for Encryption processing to finish in background thread -# Search the pattern in error log -Pattern "Resuming DECRYPTION for tablespace encrypt_ts" found -Pattern "Finished DECRYPTION for tablespace encrypt_ts" found -# RESTART 40 : WITHOUT KEYRING PLUGIN -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -########### -# Cleanup # -########### -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -# RESTART 41 : final -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_11.result b/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_11.result deleted file mode 100644 index 73871b59e12a..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_11.result +++ /dev/null @@ -1,96 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######### -# SETUP # -######### -######################################################################### -# RESTART 1 : WITH KEYRING PLUGIN -######################################################################### -#-------------------------- TEST 1 -------------------------------------# -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -# Set Encryption process to crash just after making DDL Entry -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################### -# RESTART 2 : WITH KEYRING PLUGIN after crash -######################################################################### -# INJECT error TOO_MANY_CONCURRENT_TXNS in startup location DDL_Log_remove_inject_startup_error_1. -# It will cause FATAL error and server abort. -# Search the failure pattern in error log -Pattern "ENCRYPTION for tablespace encrypt_ts:[0-9]+ could not be done successfully" not found -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -######################################################################### -# RESTART 3 : normally -######################################################################### -#-------------------------- TEST 2 -------------------------------------# -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -# Set Encryption process to crash just after making DDL Entry -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################### -# RESTART 4 : WITH KEYRING PLUGIN after crash -######################################################################### -# INJECT error TOO_MANY_CONCURRENT_TXNS in startup location DDL_Log_remove_inject_startup_error_2. -# It will cause FATAL error and server abort. -# Search the failure pattern in error log -Pattern "\[FATAL\] Error in DDL Log recovery during Post-Recovery processing." found -######################################################################### -# RESTART 4 : normally -######################################################################### -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -########### -# Cleanup # -########### -######################################################################### -# RESTART 5 : final -######################################################################### -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_2.result b/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_2.result deleted file mode 100644 index ba7261a33ba0..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_2.result +++ /dev/null @@ -1,441 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# START : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -######### -# SETUP # -######### -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -############################################################# -# TEST 1 : CRASH DURING ALTER ENCRYPT A TABLESPACE. -############################################################# - -######################################################################### -# RESTART 1 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -############################################################ -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -# (crash at page 10) # -############################################################ -# Set Encryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# Restart after crash -# Wait for Encryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Encryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 2 : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 3 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -############################################################ -# ALTER TABLESPACE 2 : Encrypted => Unencrypted # -# (crash at page 10) # -############################################################ -# Set Unencryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# Restart after crash -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 4 : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#################################################################### -# TEST 2 : CRASH DURING ALTER ENCRYPT A TABLESPACE (Compressed). -#################################################################### - -CREATE TABLESPACE compress_ts ADD DATAFILE 'compress_ts.ibd' ENGINE=InnoDB -ENCRYPTION="N" FILE_BLOCK_SIZE=8192; -CREATE TABLE t2(c1 char(100)) ENGINE=InnoDB TABLESPACE compress_ts -ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='compress_ts'; -NAME ENCRYPTION -compress_ts N -SELECT * FROM t2 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 5 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -############################################################ -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -# (crash at page 10) # -############################################################ -# Set Encryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE compress_ts ENCRYPTION='Y'; -# Restart after crash -# Wait for Encryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Encryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='compress_ts'; -NAME ENCRYPTION -compress_ts Y -SELECT * FROM t2 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 6 : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t2 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 7 WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='compress_ts'; -NAME ENCRYPTION -compress_ts Y -SELECT * FROM t2 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -############################################################ -# ALTER TABLESPACE 2 : Encrypted => Unencrypted # -# (crash at page 10) # -############################################################ -# Set Unencryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE compress_ts ENCRYPTION='N'; -# Restart after crash -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='compress_ts'; -NAME ENCRYPTION -compress_ts N -SELECT * FROM t2 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 8 : WITHOUT KEYRING -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t2 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -DROP TABLE t2; -DROP TABLESPACE compress_ts; -############################################################# -# TEST 3 : CRASH BEFORE/AFTER ENCRYPTION PROCESSING. -############################################################# - -######################################################################### -# RESTART 9 : WITH KEYRING -######################################################################### -# Restore local manifest file for MySQL server instance from backup -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -# Set server to crash just before encryption processing starts -SET SESSION debug="+d,alter_encrypt_tablespace_crash_before_processing"; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# Restart after crash -# Wait for Unencryption processing to finish in background thread -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -# Set server to crash just after encryption processing finishes -SET SESSION debug="-d,alter_encrypt_tablespace_crash_before_processing"; -SET SESSION debug="+d,alter_encrypt_tablespace_crash_after_processing"; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# Restart after crash -# Wait for Unencryption processing to finish in background thread -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -############################################################# -# TEST 4 : CRASH DURING KEY ROTATION. -############################################################# - -######################################################################### -# RESTART 10 : WITH KEYRING -######################################################################### -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -# Set server to crash while rotating encryption -SET SESSION debug="+d,ib_crash_during_rotation_for_encryption"; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -# Restart after crash -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SET SESSION debug="-d,ib_crash_during_rotation_for_encryption"; -ALTER INSTANCE ROTATE INNODB MASTER KEY; -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -############################################################### -# TEST 5 : CRASH DURING CREATING AN ENCRYPTED TABLESPACE -############################################################### - -# Set server to crash while creating an encrypted tablespace -SET SESSION debug="+d,ib_crash_during_create_tablespace_for_encryption"; -# Try to create an encrypted tablespace. It will cause server to crash. -CREATE TABLESPACE encrypt_ts_2 ADD DATAFILE 'encrypt_ts_2.ibd' ENGINE=InnoDB ENCRYPTION="Y"; -# Restart after crash -SET SESSION debug="-d,ib_crash_during_create_tablespace_for_encryption"; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE "%encrypt_ts%"; -NAME ENCRYPTION -encrypt_ts Y -############################################################### -# TEST 6 : DMLs ALLOWED AND DDLs BLOCKED TEST -############################################################### -SELECT ENABLED FROM performance_schema.setup_instruments -WHERE NAME='wait/lock/metadata/sql/mdl'; -ENABLED -YES -SET DEBUG_SYNC = 'innodb_alter_encrypt_tablespace SIGNAL s1 WAIT_FOR s2'; -ALTER TABLESPACE encrypt_ts ENCRYPTION='N';; -# Session 2 -SET DEBUG_SYNC = 'now WAIT_FOR s1'; -OBJECT_TYPE OBJECT_NAME LOCK_TYPE LOCK_DURATION LOCK_STATUS -TABLESPACE encrypt_ts EXCLUSIVE TRANSACTION GRANTED -DESCRIBE t1; -Field Type Null Key Default Extra -c1 char(100) YES NULL -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` char(100) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SELECT COUNT(*) FROM t1; -COUNT(*) -4096 -INSERT INTO t1 VALUES ("SOME VALUES"); -SELECT COUNT(*) from t1; -COUNT(*) -4097 -ALTER TABLE t1 ADD COLUMN (c2 int);; -# Monitoring session -OBJECT_TYPE OBJECT_NAME LOCK_TYPE LOCK_DURATION LOCK_STATUS -TABLESPACE encrypt_ts EXCLUSIVE TRANSACTION GRANTED -# Wait for MDL request by con2 to appear in metadata_locks table. -OBJECT_TYPE OBJECT_NAME LOCK_TYPE LOCK_DURATION LOCK_STATUS -TABLE t1 SHARED_UPGRADABLE TRANSACTION PENDING -SET DEBUG_SYNC = 'now SIGNAL s2'; -# Connection default -# Connection con2 -# Connection default -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME LIKE "%encrypt_ts%"; -NAME ENCRYPTION -encrypt_ts N -DESCRIBE t1; -Field Type Null Key Default Extra -c1 char(100) YES NULL -c2 int YES NULL -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` char(100) DEFAULT NULL, - `c2` int DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -########### -# Cleanup # -########### -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_3.result b/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_3.result deleted file mode 100644 index afd8dc195329..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_3.result +++ /dev/null @@ -1,168 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# START : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -######### -# SETUP # -######### -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' - ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 1 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -# Monitoring connection -UPDATE performance_schema.setup_consumers SET ENABLED='YES'; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM performance_schema.setup_consumers -WHERE NAME LIKE "%stages%"; -NAME ENABLED -events_stages_current YES -events_stages_history YES -events_stages_history_long YES -SELECT * FROM performance_schema.setup_instruments -WHERE NAME LIKE "%encryption%"; -NAME ENABLED TIMED PROPERTIES VOLATILITY DOCUMENTATION -wait/synch/mutex/innodb/resume_encryption_cond_mutex YES YES 0 NULL -wait/synch/cond/innodb/resume_encryption_cond YES YES 0 NULL -stage/innodb/alter tablespace (encryption) YES YES progress 0 NULL -select count(*) from performance_schema.events_stages_current -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -count(*) -0 -# Default connection -############################################################ -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -############################################################ - -# Set Encryption process to wait after page 5 so that we can monitor -# progress in performance_schema table -SET DEBUG_SYNC = 'alter_encrypt_tablespace_wait_after_page5 SIGNAL s1 WAIT_FOR s2'; -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# Monitoring connection -SET DEBUG_SYNC = 'now WAIT_FOR s1'; -# Wait for Encryption progress monitoring to appear in PFS table -# Wait for some progress to appear in PFS table -select WORK_ESTIMATED, WORK_COMPLETED -FROM performance_schema.events_stages_current -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)'; -WORK_ESTIMATED WORK_COMPLETED -6 5 -SET DEBUG_SYNC = 'now SIGNAL s2'; -# Default connection -# Once done, select count from PFS tables -SELECT COUNT(*) -FROM performance_schema.events_stages_current -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -COUNT(*) -0 -SELECT COUNT(*) -FROM performance_schema.events_stages_history -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_history_long -WHERE EVENT_NAME='stage/innodb/alter tablespace (encryption)'; -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_global_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_by_user_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_by_host_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -SELECT COUNT(*) -FROM performance_schema.events_stages_summary_by_account_by_event_name -WHERE EVENT_NAME = 'stage/innodb/alter tablespace (encryption)' AND -COUNT_STAR>0; -COUNT(*) -1 -# Check that Encryption done successfully. -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES -WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 2 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 3 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -UPDATE performance_schema.setup_consumers SET ENABLED='NO'; -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -########### -# Cleanup # -########### -SELECT COUNT(*) FROM t1; -COUNT(*) -32 -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_4.result b/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_4.result deleted file mode 100644 index 531afe404910..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_4.result +++ /dev/null @@ -1,623 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# START : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -######### -# SETUP # -######### -######################################################################### -# RESTART 1 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -######################################################################### -# Non Partitioned Table # -######################################################################### - -DROP TABLE IF EXISTS t1; -# Create an Encrypted and an Unencrypted tablespace -CREATE TABLESPACE encrypt_ts add datafile 'encrypt_ts.ibd' ENCRYPTION='Y'; -CREATE TABLESPACE unencrypt_ts add datafile 'unencrypt_ts.ibd' ENCRYPTION='N'; -# Create table with "encryption" option in general tablespace -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='n'; -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'unencrypted' table while using an 'encrypted' tablespace. -CREATE TABLE t1 (c int) TABLESPACE=innodb_system ENCRYPTION='y'; -ERROR HY000: Request to create 'encrypted' table while using an 'unencrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'encrypted' table while using an 'unencrypted' tablespace. -CREATE TABLE t1 (c int) TABLESPACE=innodb_system ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -DROP TABLE t1; -#------------------------------------------------------- -# general [encrypted] => general [unencrypted] -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='Y'; -ALTER TABLE t1 TABLESPACE=unencrypt_ts ENCRYPTION='N', ALGORITHM=INPLACE; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 TABLESPACE=unencrypt_ts ENCRYPTION='N', ALGORITHM=COPY; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -# general [unencrypted] => general [encrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -ALTER TABLE t1 TABLESPACE=encrypt_ts ENCRYPTION='Y', ALGORITHM=INPLACE; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -# Changing encryption type without explicit ENCRYPTION clause fails. -ALTER TABLE t1 TABLESPACE=encrypt_ts, ALGORITHM=COPY; -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -ALTER TABLE t1 TABLESPACE=encrypt_ts, ALGORITHM=INPLACE; -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -ALTER TABLE t1 TABLESPACE=encrypt_ts ENCRYPTION='Y', ALGORITHM=COPY; -#------------------------------------------------------- -# general [encrypted] => file-per-table [unencrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='Y'; -ALTER TABLE t1 TABLESPACE=innodb_file_per_table, ALGORITHM=INPLACE; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 TABLESPACE=innodb_file_per_table, ALGORITHM=COPY; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n', ALGORITHM=INPLACE; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n', ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -# general [encrypted] => file-per-table [encrypted] -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION= 'Y'; -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y', ALGORITHM=INPLACE; -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y', ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -#------------------------------------------------------- -# general [unencrypted] => file-per-table [unencrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=innodb_file_per_table, ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=innodb_file_per_table, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -# general [unencrypted] => file-per-table [encrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y', ALGORITHM=INPLACE; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='y', ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -# general [unencrypted] => file-per-table [unencrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n', ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=innodb_file_per_table ENCRYPTION='n', ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -#------------------------------------------------------- -# file-per-table [unencrypted] => general [encrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=encrypt_ts ENCRYPTION='Y', ALGORITHM=INPLACE; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=encrypt_ts ENCRYPTION='Y', ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -# file-per-table [encrypted] => general [encrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -ALTER TABLE t1 TABLESPACE=encrypt_ts, ALGORITHM=INPLACE; -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -ALTER TABLE t1 TABLESPACE=encrypt_ts, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -# file-per-table [encrypted] => general [unencrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' -ALTER TABLE t1 TABLESPACE=unencrypt_ts ENCRYPTION='N', ALGORITHM=INPLACE; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 TABLESPACE=unencrypt_ts ENCRYPTION='N', ALGORITHM=COPY; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -# file-per-table [unencrypted] => general [unencrypted] -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=unencrypt_ts, ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -CREATE TABLE t1 (c int) ENCRYPTION='n'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 TABLESPACE=unencrypt_ts, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -#------------------------------------------------------- -# ALTER TABLE ADD COLUMN/INDEX WITH MOVING TO DIFFERENT TABLESPACE -CREATE TABLESPACE encrypt_ts1 add datafile 'encrypt_ts1.ibd' ENCRYPTION='Y'; -CREATE TABLESPACE unencrypt_ts1 add datafile 'unencrypt_ts1.ibd' ENCRYPTION='N'; -# ALGORITHM=DEFAULT -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='Y'; -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=unencrypt_ts ENCRYPTION='N'; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=encrypt_ts1; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -ALTER TABLE t1 ADD INDEX (c), TABLESPACE=encrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=unencrypt_ts1; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 ADD INDEX (c), TABLESPACE=unencrypt_ts; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 ADD INDEX (c2), TABLESPACE=encrypt_ts ENCRYPTION='Y'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`), - KEY `c2` (`c2`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; -# ALGORITHM=INPLACE -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='Y'; -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=unencrypt_ts ENCRYPTION='N', ALGORITHM=INPLACE; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=encrypt_ts1 ENCRYPTION='Y', ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -ALTER TABLE t1 ADD INDEX (c), TABLESPACE=encrypt_ts, ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=unencrypt_ts1, ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 ADD INDEX (c), TABLESPACE=unencrypt_ts, ALGORITHM=INPLACE; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 ADD INDEX (c2), TABLESPACE=encrypt_ts ENCRYPTION='Y', ALGORITHM=INPLACE; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot alter encryption attribute by inplace algorithm.. Try ALGORITHM=COPY. -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; -# ALGORITHM=COPY -CREATE TABLE t1 (c int) TABLESPACE=encrypt_ts ENCRYPTION='Y'; -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=unencrypt_ts ENCRYPTION='N', ALGORITHM=COPY; -ERROR HY000: Source tablespace is encrypted but target tablespace is not. -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=encrypt_ts1, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL -) /*!50100 TABLESPACE `encrypt_ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -ALTER TABLE t1 ADD INDEX (c), TABLESPACE=encrypt_ts, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; -CREATE TABLE t1 (c int) TABLESPACE=unencrypt_ts; -ALTER TABLE t1 ADD c2 char(10), TABLESPACE=unencrypt_ts1, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL -) /*!50100 TABLESPACE `unencrypt_ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 ADD INDEX (c), TABLESPACE=unencrypt_ts, ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`) -) /*!50100 TABLESPACE `unencrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -ALTER TABLE t1 ADD INDEX (c2), TABLESPACE=encrypt_ts ENCRYPTION='Y', ALGORITHM=COPY; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` int DEFAULT NULL, - `c2` char(10) DEFAULT NULL, - KEY `c` (`c`), - KEY `c2` (`c2`) -) /*!50100 TABLESPACE `encrypt_ts` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -DROP TABLE t1; -######################################################################### -# Partitioned Table # -######################################################################### - -DROP TABLE IF EXISTS t1; -# Create table without explicit tablespace name -CREATE TABLE t1 (id INT, name VARCHAR(50)) -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -# Try to ALTER TABLE to have general tablespace at table level -ALTER TABLE t1 TABLESPACE=unencrypt_ts; -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -# Alter encryption option -ALTER TABLE t1 ENCRYPTION='Y'; -DROP TABLE t1; -# Create table with general tablespace at table level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -TABLESPACE=encrypt_ts ENCRYPTION='Y' - PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Create table with system tablespace at table level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -TABLESPACE=innodb_system -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Create table with innodb_file_per_table tablespace at table level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -TABLESPACE=innodb_file_per_table -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -DROP TABLE t1; -# Create table with general tablespace at partition level -CREATE TABLE t1 (id INT, name VARCHAR(50)) ENCRYPTION='Y' - PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30) TABLESPACE=encrypt_ts); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Create table with system tablespace at partition level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30) TABLESPACE=innodb_system); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Create table with innodb_file_per_table tablespace at partition level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30) TABLESPACE=innodb_file_per_table); -DROP TABLE t1; -# Create table with ENCRYPTION='y' option -CREATE TABLE t1 (id INT, name VARCHAR(50)) -ENCRYPTION='Y' - PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -INSERT INTO t1 VALUES (5,'test'); -INSERT INTO t1 VALUES (12,'test1'); -INSERT INTO t1 VALUES (22,'test2'); -# Truncate specific partition of encrypted table -ALTER TABLE t1 TRUNCATE PARTITION p0; -# Alter encryption option -ALTER TABLE t1 ENCRYPTION='N'; -DROP TABLE t1; -# Create table with ENCRYPTION='y' option and innodb_file_per_table -# tablespace at table level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -ENCRYPTION='Y' TABLESPACE=innodb_file_per_table -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -# Alter encryption option -ALTER TABLE t1 ENCRYPTION='N'; -# Alter table to move a partition to general tablespace. -ALTER TABLE t1 REORGANIZE PARTITION P2 INTO ( -PARTITION P2 VALUES LESS THAN (30) TABLESPACE=encrypt_ts); -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'unencrypted' table while using an 'encrypted' tablespace. -ALTER TABLE t1 REORGANIZE PARTITION P2 INTO ( -PARTITION P2 VALUES LESS THAN (30) TABLESPACE=unencrypt_ts); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Alter table to move a partition to system tablespace. -ALTER TABLE t1 REORGANIZE PARTITION P2 INTO ( -PARTITION P2 VALUES LESS THAN (30) TABLESPACE=innodb_system); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Alter table to move a partition to file_per_table tablespace. -ALTER TABLE t1 REORGANIZE PARTITION P2 INTO ( -PARTITION P2 VALUES LESS THAN (30) TABLESPACE=innodb_file_per_table); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB, - PARTITION P2 VALUES LESS THAN (30) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB) */ -# Alter table to add a new partition in general tablespace -ALTER TABLE t1 ADD PARTITION ( -PARTITION p3 VALUES LESS THAN (40) tablespace=encrypt_ts); -ERROR HY000: Request to create 'unencrypted' table while using an 'encrypted' tablespace. -SHOW WARNINGS; -Level Code Message -Error 3825 Request to create 'unencrypted' table while using an 'encrypted' tablespace. -ALTER TABLE t1 ADD PARTITION ( -PARTITION p3 VALUES LESS THAN (40) tablespace=unencrypt_ts); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Alter table to add a new partition in innodb_system tablespace -ALTER TABLE t1 ADD PARTITION ( -PARTITION p3 VALUES LESS THAN (40) tablespace=innodb_system); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Alter table to add a new partition in innodb_file_per_table tablespace -ALTER TABLE t1 ADD PARTITION ( -PARTITION p3 VALUES LESS THAN (40) tablespace=innodb_file_per_table); -# Alter table to add a new partition without giving tablespace -ALTER TABLE t1 ADD PARTITION ( -PARTITION p4 VALUES LESS THAN (50)); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int DEFAULT NULL, - `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -/*!50100 PARTITION BY RANGE (`id`) -(PARTITION p0 VALUES LESS THAN (10) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN (20) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB, - PARTITION P2 VALUES LESS THAN (30) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB, - PARTITION p3 VALUES LESS THAN (40) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB, - PARTITION p4 VALUES LESS THAN (50) TABLESPACE = `innodb_file_per_table` ENGINE = InnoDB) */ -# Alter table to add a new partition with encryption option at partition -# level. -ALTER TABLE t1 ADD PARTITION ( -PARTITION p5 VALUES LESS THAN (60) encryption='Y'); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'encryption='Y')' at line 2 -DROP TABLE t1; -# Create table with ENCRYPTION='y' option and general tablespace -# at table level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -ENCRYPTION='Y' TABLESPACE=encrypt_ts -PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30)); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -# Create table with ENCRYPTION='y' option and general tablespace -# at partition level -CREATE TABLE t1 (id INT, name VARCHAR(50)) -ENCRYPTION='Y' - PARTITION BY RANGE(id) ( -PARTITION p0 VALUES LESS THAN (10), -PARTITION p1 VALUES LESS THAN (20), -PARTITION p2 VALUES LESS THAN (30) TABLESPACE=encrypt_ts); -ERROR HY000: InnoDB : A partitioned table is not allowed in a shared tablespace. -SHOW WARNINGS; -Level Code Message -Error 1478 InnoDB : A partitioned table is not allowed in a shared tablespace. -Error 1030 Got error 122 - 'Internal (unspecified) error in handler' from storage engine -########### -# Cleanup # -########### -DROP TABLE IF EXISTS t1; -DROP TABLESPACE encrypt_ts; -DROP TABLESPACE encrypt_ts1; -DROP TABLESPACE unencrypt_ts; -DROP TABLESPACE unencrypt_ts1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_5.result b/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_5.result deleted file mode 100644 index 8459a0b2e06a..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_5.result +++ /dev/null @@ -1,103 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######### -# SETUP # -######### - -######################################################################### -# WITH KEYRING -######################################################################### -# Create a new 'unencrypted' tablespace 'encrypt_ts' -SELECT NAME, FLAG, SPACE_TYPE FROM information_schema.INNODB_TABLESPACES -where NAME="encrypt_ts"; -NAME FLAG SPACE_TYPE -create tablespace encrypt_ts add datafile 'encrypt_ts.ibd' - engine=INNODB encryption='N'; -SELECT NAME, FLAG, SPACE_TYPE FROM information_schema.INNODB_TABLESPACES -where NAME="encrypt_ts"; -NAME FLAG SPACE_TYPE -encrypt_ts 18432 General -# Create a table test.t1 in 'encrypt_ts' tablespace and insert some records. -create table test.t1 (c char(20)) tablespace encrypt_ts; -insert into test.t1 values ("samplerecord"); -set global innodb_buf_flush_list_now = 1; -############################################################# -# INITIAL SETUP : Tablespace is created as unencrypted # -# A table is created and rows are inserted # -############################################################# -# Check that tablespace file is not encrypted yet -# Print result -table space is Unencrypted. -############################################################ -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -############################################################ -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -set global innodb_buf_flush_list_now = 1; -# Check that tablespace file is encrypted now -# Print result -table space is Encrypted. -############################################################ -# ALTER TABLESPACE 2 : Encrypted => Unencrypted # -############################################################ -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -set global innodb_buf_flush_list_now = 1; -# Check that tablespace file is not encrypted now -# Print result -table space is Unencrypted. - -################# CRASH/RECOVERY TESTING ################### - -############################################################ -# ALTER TABLESPACE 3 : Unencrypted => Encrypted # -# (crash at page 10) # -############################################################ -SELECT COUNT(*) FROM test.t1; -COUNT(*) -4096 -set global innodb_buf_flush_list_now = 1; -# Check that tablespace file is still unencrypted -# Print result -table space is Unencrypted. -# Set Encryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# Wait for Encryption processing to finish in background thread -# After restart/recovery, check that Encryption was roll-forward and -# tablespace file is encrypted now -# Print result -table space is Encrypted. -############################################################ -# ALTER TABLESPACE 4 : Encrypted => Unencrypted # -# (crash at page 10) # -############################################################ -SELECT COUNT(*) FROM test.t1; -COUNT(*) -4096 -# Check that tablespace file is Encrypted -# Print result -table space is Encrypted. -# Set Encryption process to crash after page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -# Wait for Unencryption processing to finish in background thread -# After restart/recovery, check that Unencryption was roll-forward and -# tablespace file is Unencrypted now -# Print result -table space is Unencrypted. -########### -# CLEANUP # -########### -DROP TABLE test.t1; -DROP TABLESPACE encrypt_ts; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_7.result b/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_7.result deleted file mode 100644 index 7614b9ffd08f..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_7.result +++ /dev/null @@ -1,539 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# START : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -######### -# SETUP # -######### -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -#-------------------------- TEST 0 -------------------------------------# -######################################################################### -# RESTART 1 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -######################################################################## -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -# crash just before flushing page 0 at the end # -######################################################################## -# Set process to crash just before flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################### -# RESTART 2 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Encryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Encryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 3 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 4 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE 2 : Encrypted => Unencrypted # -# crash just before flushing page 0 at the end # -######################################################################## -# Set process to crash just before flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -######################################################################### -# RESTART 5 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 6 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 1 -------------------------------------# -######################################################################### -# RESTART 7 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -######################################################################## -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -# crash just before flushing page 0 at the end # -######################################################################## -# Set process to crash just before flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_before_flushing_page_0'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################### -# RESTART 8 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Encryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Encryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 9 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 10 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE 2 : Encrypted => Unencrypted # -# crash just before flushing page 0 at the end # -######################################################################## -# Set process to crash just before flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_before_flushing_page_0'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -######################################################################### -# RESTART 11 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 12 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 13 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -######################################################################## -# ALTER TABLESPACE 3 : Unencrypted => Encrypted # -# crash just after flushing page 0 at the end # -######################################################################## -# Set process to crash just after flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_flushing_page_0'; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################### -# RESTART 14 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Encryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Encryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 15 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT * FROM t1 LIMIT 10; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -######################################################################### -# RESTART 16 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts Y -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE 4 : Encrypted => Unencrypted # -# crash just after flushing page 0 at the end # -######################################################################## -# Set process to crash just after flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_flushing_page_0'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -######################################################################### -# RESTART 17 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 18 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 2 -------------------------------------# -######################################################################### -# RESTART 19 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE 5 : Encrypted => unencrypted # -# crash just before updating ts flags on page0 # -######################################################################## -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# Set process to crash just after flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_before_updating_flags'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -######################################################################### -# RESTART 20 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 21 : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 22 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################## -# ALTER TABLESPACE 6 : Encrypted => unencrypted # -# crash just before resetting progress onpage 0 # -######################################################################## -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# Set process to crash just after flushing page 0 at the end -SET SESSION debug= '+d,alter_encrypt_tablespace_crash_before_resetting_progress'; -# Unencrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -######################################################################### -# RESTART 23 : WITH KEYRING PLUGIN after crash -######################################################################### -# Wait for Unencryption processing to finish in background thread -set global innodb_buf_flush_list_now = 1; -# After restart/recovery, check that Unencryption was roll-forward -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -######################################################################### -# RESTART 24: WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -#-------------------------- TEST 3 -------------------------------------# -######################################################################### -# RESTART 25 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd'; -CREATE TABLE t1 (C CHAR(10)) TABLESPACE=encrypt_ts; -SET GLOBAL innodb_limit_optimistic_insert_debug=2; -INSERT INTO t1 VALUES("SOMEVALUE"); -INSERT INTO t1 VALUES("SOMEVALUE"); -INSERT INTO t1 VALUES("SOMEVALUE"); -INSERT INTO t1 VALUES("SOMEVALUE"); -INSERT INTO t1 VALUES("SOMEVALUE"); -INSERT INTO t1 VALUES("SOMEVALUE"); -INSERT INTO t1 VALUES("SOMEVALUE"); -# Make sure checkpoint is not moved -SET GLOBAL innodb_log_checkpoint_now = ON; -SET GLOBAL innodb_page_cleaner_disabled_debug = 1; -SET GLOBAL innodb_dict_stats_disabled_debug = 1; -SET GLOBAL innodb_master_thread_disabled_debug = 1; -# Following encryption will create a new tablespace key (KEY1) -# KEY1 will be written on REDO log -ALTER TABLESPACE encrypt_ts encryption='Y'; -# Following unencryption will remove tablespace key -ALTER TABLESPACE encrypt_ts encryption='N'; -SET SESSION debug= '+d,alter_encrypt_tablespace_page_6'; -SET SESSION debug= '+d,flush_each_dirtied_page'; -# Following encryption will create a new tablespace key (KEY2) -# KEY2 will be written on REDO log -# Flush dirtied pages encrypted with KEY2 before crash -ALTER TABLESPACE encrypt_ts encryption='Y'; -######################################################################### -# RESTART 26: WITH KEYRING PLUGIN after crash -######################################################################### -########### -# Cleanup # -########### -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_8.result b/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_8.result deleted file mode 100644 index 7cc4084800b6..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_8.result +++ /dev/null @@ -1,47 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# RESTART 1 : WITH KEYRING -######################################################################### -SET SESSION debug= '+d,ddl_btree_build_insert_return_interrupt'; - -######### -# SETUP # -######### -CREATE PROCEDURE populate_t1() -BEGIN -DECLARE i int DEFAULT 1; -START TRANSACTION; -WHILE (i <= 10000) DO -INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); -SET i = i + 1; -END WHILE; -COMMIT; -END| -CREATE TABLE t1(class INT, id INT, title VARCHAR(100)) encryption='N'; -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' encryption='N'; -ALTER TABLE t1 TABLESPACE=encrypt_ts, ALGORITHM=INPLACE; -ERROR 70100: Query execution was interrupted -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -######################################################################### -# RESTART 2 : WITH KEYRING PLUGIN -######################################################################### -ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; -########### -# Cleanup # -########### -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -DROP PROCEDURE populate_t1; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_9.result b/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_9.result deleted file mode 100644 index ef58d7d534f5..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/tablespace_encrypt_9.result +++ /dev/null @@ -1,89 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -######################################################################### -# START : WITHOUT KEYRING PLUGIN -######################################################################### -# Taking backup of local manifest file for MySQL server instance -######### -# SETUP # -######### -CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; -CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; -set global innodb_buf_flush_list_now = 1; -SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; -NAME ENCRYPTION -encrypt_ts N -SELECT * FROM t1 LIMIT 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -############################################################# -# TEST 1 : CRASH DURING ALTER ENCRYPT A TABLESPACE. -############################################################# - -######################################################################### -# RESTART 1 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -############################################################ -# ALTER TABLESPACE 1 : Unencrypted => Encrypted # -# (crash at page 10) # -############################################################ -# Set Encryption process to crash at page 10 -SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; -SET GLOBAL innodb_log_checkpoint_now = ON; -SET GLOBAL innodb_page_cleaner_disabled_debug = 1; -SET GLOBAL innodb_dict_stats_disabled_debug = 1; -SET GLOBAL innodb_master_thread_disabled_debug = 1; -# Encrypt the tablespace. It will cause crash. -ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; -# Restart after crash without Keyring plugin loaded -# Taking backup of local manifest file for MySQL server instance -Pattern "CORRUPT LOG RECORD FOUND" found -# Server shouldn't have restarted, so query should fail. -SELECT * from test.t1 limit 10; -Got one of the listed errors -######################################################################### -# RESTART 2 : WITH KEYRING PLUGIN -######################################################################### -# Restore local manifest file for MySQL server instance from backup -# Server should have restarted properly. -SELECT * from test.t1 limit 10; -c1 -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -SOME VALUES -########### -# Cleanup # -########### -DROP TABLE t1; -DROP TABLESPACE encrypt_ts; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/tablespace_with_tables.result b/mysql-test/suite/component_keyring_kms/r/tablespace_with_tables.result deleted file mode 100644 index bc302bc8aa39..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/tablespace_with_tables.result +++ /dev/null @@ -1,1020 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# WL#12261 Control (enforce and disable) table encryption -# -# Pre-define user u1, which is used in different tests below. -CREATE USER u1@localhost; -GRANT ALL ON db1.* 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'; -# The test cases run ALTER TABLESPACE to check its encryption mode. -# The importance of this test is to check the way ALTER TABLESPACE -# updates the ENCRYPTION clause of tables in it. -# We run this command in various configuration as, -# -# - Setting table_encryption_privilege_check to true/false. -# - Setting per database default encryption to true/false. -# - With and without user holding TABLE_ENCRYPTION_ADMIN privilege. -# - Check for warnings generated. -# -````````````````````````````````````````````````````````` -# Unencrypted TABLESPACE to Unencrypted TABLESPACE (Nop) -# [ALTER TABLESPACE] Case 1 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 2 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Encrypted TABLESPACE to Encrypted TABLESPACE (Nop) -# [ALTER TABLESPACE] Case 3 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 4 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 5 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Unencrypted TABLESPACE to encrypted TABLESPACE -# with database encryption default 'n' -# [ALTER TABLESPACE] Case 6 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Reject creating encrypted table in database with default encryption='n' -# [ALTER TABLESPACE] Case 7 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -ERROR HY000: This tablespace can't be encrypted, because one of table's schema has default encryption OFF and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3829 This tablespace can't be encrypted, because one of table's schema has default encryption OFF and user doesn't have enough privilege. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 8 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# With some tables without ENCRYPTION clause; -# [ALTER TABLESPACE] Case 9 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Reject creating encrypted table in database with default encryption='n' -# [ALTER TABLESPACE] Case 10 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -ERROR HY000: This tablespace can't be encrypted, because one of table's schema has default encryption OFF and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3829 This tablespace can't be encrypted, because one of table's schema has default encryption OFF and user doesn't have enough privilege. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 11 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# With all tables without ENCRYPTION clause; -# [ALTER TABLESPACE] Case 12 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Request to create encrypted tablespace with default_table_encryption='n' -# [ALTER TABLESPACE] Case 13 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -ERROR HY000: This tablespace can't be encrypted, because one of table's schema has default encryption OFF and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3829 This tablespace can't be encrypted, because one of table's schema has default encryption OFF and user doesn't have enough privilege. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 14 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Unencrypted TABLESPACE to encrypted TABLESPACE -# with database encryption 'y' -# [ALTER TABLESPACE] Case 15 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 16 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 17 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='n'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='n' */ -SET SESSION default_table_encryption=true; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='y'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='Y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# Case 17.1 With some tables without ENCRYPTION clause; -# CREATE table using unencrypted tablespace without -# ENCRYPTION clause would inherit ENCRYPTION from database. -# This makes CREATE TABLE fail because the ENCRYPTION clause -# and the tablespace encryption type mismatches. The test -# encryption.create_table does test this. -# Case 17.2 With all tables without ENCRYPTION clause; -# Behavior would be same as described in Case 17.1 -````````````````````````````````````````````````````````` -# Encrypted TABLESPACE to unencrypted TABLESPACE -# with database encryption 'n' -# [ALTER TABLESPACE] Case 18 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 19 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 20 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='n'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -SHOW WARNINGS; -Level Code Message -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Encrypted TABLESPACE to unencrypted TABLESPACE -# with database encryption 'y' -# [ALTER TABLESPACE] Case 21 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=false; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW WARNINGS; -Level Code Message -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='N' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='N' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -````````````````````````````````````````````````````````` -# Request to create unencrypted tablespace with default_table_encryption='y' -# [ALTER TABLESPACE] Case 22 ) -````````````````````````````````````````````````````````` -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -ERROR HY000: This tablespace can't be decrypted, because one of table's schema has default encryption ON and user doesn't have enough privilege. -SHOW WARNINGS; -Level Code Message -Error 3830 This tablespace can't be decrypted, because one of table's schema has default encryption ON and user doesn't have enough privilege. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# [ALTER TABLESPACE] Case 23 ) -````````````````````````````````````````````````````````` -# Grant user with TABLE_ENCRYPTION_ADMIN -GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; -# Create required schema to run ALTER TABLESPACE. -CREATE TABLESPACE ts1 ADD DATAFILE 'df_u.ibd' ENCRYPTION='y'; -CREATE DATABASE db1 DEFAULT ENCRYPTION='y'; -CREATE TABLE db1.t1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -CREATE TABLE db1.t2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y'; -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ -SET SESSION default_table_encryption=false; -# Run ALTER TABLESPACE -SET GLOBAL table_encryption_privilege_check=true; -ALTER TABLESPACE ts1 ENCRYPTION='n'; -Warnings: -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW WARNINGS; -Level Code Message -Warning 3824 Creating an unencrypted table in a database with default encryption enabled. -SHOW CREATE TABLE db1.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='N' */ -SHOW CREATE TABLE db1.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='N' */ -SET GLOBAL table_encryption_privilege_check=false; -SET SESSION default_table_encryption=false; -# clean up -# Revoke TABLE_ENCRYPTION_ADMIN from user -REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; -DROP DATABASE db1; -DROP TABLESPACE ts1; -# -# Clean up. -DROP USER u1@localhost; -SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/udf_test.result b/mysql-test/suite/component_keyring_kms/r/udf_test.result deleted file mode 100644 index a6b4fd57b845..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/udf_test.result +++ /dev/null @@ -1,177 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating global configuration file for keyring component: component_keyring_kms -# Creating local configuration file for keyring component: component_keyring_kms -# Creating manifest file for current MySQL server instance -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# ---------------------------------------------------------------------- -# Setting up Keyring UDFs -INSTALL PLUGIN keyring_udf SONAME 'keyring_udf.so'; -CREATE FUNCTION keyring_key_store RETURNS INTEGER SONAME 'keyring_udf.so'; -CREATE FUNCTION keyring_key_generate RETURNS INTEGER SONAME 'keyring_udf.so'; -CREATE FUNCTION keyring_key_fetch RETURNS sTRING SONAME 'keyring_udf.so'; -CREATE FUNCTION keyring_key_type_fetch RETURNS STRING SONAME 'keyring_udf.so'; -CREATE FUNCTION keyring_key_length_fetch RETURNS INTEGER SONAME 'keyring_udf.so'; -CREATE FUNCTION keyring_key_remove RETURNS INTEGER SONAME 'keyring_udf.so'; -# ---------------------------------------------------------------------- -# Tests for AES key type -# keyring_key_generate tests -SELECT keyring_key_generate('AES_g1', 'AES', 16); -keyring_key_generate('AES_g1', 'AES', 16) -1 -SELECT keyring_key_generate('AES_g2', 'AES', 32); -keyring_key_generate('AES_g2', 'AES', 32) -1 -SELECT keyring_key_generate('AES_g3', 'AES', 64); -keyring_key_generate('AES_g3', 'AES', 64) -1 -# keyring_key_store tests -SELECT keyring_key_store('AES_s1', 'AES', 'Quick brown fox jumped over the lazy dog'); -keyring_key_store('AES_s1', 'AES', 'Quick brown fox jumped over the lazy dog') -1 -SELECT keyring_key_store('AES_s2', 'AES', 'Old MacDonald had a farm'); -keyring_key_store('AES_s2', 'AES', 'Old MacDonald had a farm') -1 -SELECT keyring_key_store('AES_s3', 'AES', 'Quis custodiet ipsos custodes'); -keyring_key_store('AES_s3', 'AES', 'Quis custodiet ipsos custodes') -1 -# keyring_key_fetch tests -SELECT keyring_key_fetch('AES_g1') INTO @aes_g1_fetched; -SELECT keyring_key_fetch('AES_g2') INTO @aes_g2_fetched; -SELECT keyring_key_fetch('AES_g3') INTO @aes_g3_fetched; -SELECT LENGTH(@aes_g1_fetched); -LENGTH(@aes_g1_fetched) -16 -SELECT LENGTH(@aes_g2_fetched); -LENGTH(@aes_g2_fetched) -32 -SELECT LENGTH(@aes_g3_fetched); -LENGTH(@aes_g3_fetched) -64 -SELECT keyring_key_fetch('AES_s1'); -keyring_key_fetch('AES_s1') -Quick brown fox jumped over the lazy dog -SELECT keyring_key_fetch('AES_s2'); -keyring_key_fetch('AES_s2') -Old MacDonald had a farm -SELECT keyring_key_fetch('AES_s3'); -keyring_key_fetch('AES_s3') -Quis custodiet ipsos custodes -# keyring key_type_fetch tests -SELECT keyring_key_type_fetch('AES_g1'); -keyring_key_type_fetch('AES_g1') -AES -SELECT keyring_key_type_fetch('AES_g2'); -keyring_key_type_fetch('AES_g2') -AES -SELECT keyring_key_type_fetch('AES_g3'); -keyring_key_type_fetch('AES_g3') -AES -SELECT keyring_key_type_fetch('AES_s1'); -keyring_key_type_fetch('AES_s1') -AES -SELECT keyring_key_type_fetch('AES_s2'); -keyring_key_type_fetch('AES_s2') -AES -SELECT keyring_key_type_fetch('AES_s3'); -keyring_key_type_fetch('AES_s3') -AES -# keyring key_length_fetch tests -SELECT keyring_key_length_fetch('AES_g1'); -keyring_key_length_fetch('AES_g1') -16 -SELECT keyring_key_length_fetch('AES_g2'); -keyring_key_length_fetch('AES_g2') -32 -SELECT keyring_key_length_fetch('AES_g3'); -keyring_key_length_fetch('AES_g3') -64 -SELECT keyring_key_length_fetch('AES_s1'); -keyring_key_length_fetch('AES_s1') -40 -SELECT keyring_key_length_fetch('AES_s2'); -keyring_key_length_fetch('AES_s2') -24 -SELECT keyring_key_length_fetch('AES_s3'); -keyring_key_length_fetch('AES_s3') -29 -# Restarting the server -# keyring_key_fetch tests after restart -SELECT keyring_key_fetch('AES_g1') INTO @aes_g1_fetched_after_restart; -SELECT keyring_key_fetch('AES_g2') INTO @aes_g2_fetched_after_restart; -SELECT keyring_key_fetch('AES_g3') INTO @aes_g3_fetched_after_restart; -SELECT LENGTH(@aes_g1_fetched_after_restart); -LENGTH(@aes_g1_fetched_after_restart) -16 -SELECT LENGTH(@aes_g2_fetched_after_restart); -LENGTH(@aes_g2_fetched_after_restart) -32 -SELECT LENGTH(@aes_g3_fetched_after_restart); -LENGTH(@aes_g3_fetched_after_restart) -64 -SELECT keyring_key_fetch('AES_s1'); -keyring_key_fetch('AES_s1') -Quick brown fox jumped over the lazy dog -SELECT keyring_key_fetch('AES_s2'); -keyring_key_fetch('AES_s2') -Old MacDonald had a farm -SELECT keyring_key_fetch('AES_s3'); -keyring_key_fetch('AES_s3') -Quis custodiet ipsos custodes -# keyring key_type_fetch tests after restart -SELECT keyring_key_type_fetch('AES_g1'); -keyring_key_type_fetch('AES_g1') -AES -SELECT keyring_key_type_fetch('AES_g2'); -keyring_key_type_fetch('AES_g2') -AES -SELECT keyring_key_type_fetch('AES_g3'); -keyring_key_type_fetch('AES_g3') -AES -# keyring key_length_fetch tests after restart -SELECT keyring_key_length_fetch('AES_g1'); -keyring_key_length_fetch('AES_g1') -16 -SELECT keyring_key_length_fetch('AES_g2'); -keyring_key_length_fetch('AES_g2') -32 -SELECT keyring_key_length_fetch('AES_g3'); -keyring_key_length_fetch('AES_g3') -64 -# keyring_key_remove tests -SELECT keyring_key_remove('AES_g1'); -keyring_key_remove('AES_g1') -1 -SELECT keyring_key_remove('AES_g2'); -keyring_key_remove('AES_g2') -1 -SELECT keyring_key_remove('AES_g3'); -keyring_key_remove('AES_g3') -1 -SELECT keyring_key_remove('AES_s1'); -keyring_key_remove('AES_s1') -1 -SELECT keyring_key_remove('AES_s2'); -keyring_key_remove('AES_s2') -1 -SELECT keyring_key_remove('AES_s3'); -keyring_key_remove('AES_s3') -1 -# ---------------------------------------------------------------------- -# Clean-up -DROP FUNCTION keyring_key_store; -DROP FUNCTION keyring_key_fetch; -DROP FUNCTION keyring_key_remove; -DROP FUNCTION keyring_key_generate; -DROP FUNCTION keyring_key_type_fetch; -DROP FUNCTION keyring_key_length_fetch; -UNINSTALL PLUGIN keyring_udf; -# ---------------------------------------------------------------------- -# ---------------------------------------------------------------------- -# Teardown -# Removing manifest file for current MySQL server instance -# Removing local configuration file for keyring component: component_keyring_kms -# Removing global configuration file for keyring component: component_keyring_kms -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/undo_encrypt_basic.result b/mysql-test/suite/component_keyring_kms/r/undo_encrypt_basic.result deleted file mode 100644 index 988b460b0f65..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/undo_encrypt_basic.result +++ /dev/null @@ -1,178 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kms -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# WL#9289 InnoDB transparent tablespace data encryption for undo log -# create bootstrap file -# Stop the MTR default DB server -# Test1: bootstrap with 2 undo tablespaces and with keyring. -# Run the bootstrap command with keyring -# Start the DB server with undo log encryption disabled, and no keyring. -# Taking backup of global manifest file for MySQL server -# Enable undo log encryption, should report error in server log, since keyring is not loaded. -SET GLOBAL innodb_undo_log_encrypt = ON; -Warnings: -Warning 7014 InnoDB: Undo log can't be encrypted if the keyring is not loaded. -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB; -ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. -# Start the DB server with undo log encryption disabled and keyring loaded. It should success. -# Restore global manifest file for MySQL server from backup -# Enable undo log encryption, shouldn't report error in server log. -SET GLOBAL innodb_undo_log_encrypt = ON; -CREATE TABLE t1(c1 INT, c2 char(20)) ENCRYPTION='Y' ENGINE = InnoDB; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int DEFAULT NULL, - `c2` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ENCRYPTION='Y' -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -INSERT INTO t1 select * from t1; -CREATE TABLE t2(c1 INT, c2 char(20)) ENGINE = InnoDB; -INSERT INTO t2 select * from t1; -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -SELECT * FROM t2 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -# Start the DB server with undo log encryption enabled and keyring loaded. It should success. -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -SELECT * FROM t2 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -0 aaaaa -DROP TABLE t1,t2; -# Search for particular string of encryption metadata, should success since it's encrypted. -Pattern "lCC" found -CREATE TABLE t1(c1 INT, c2 char(20)) ENGINE = InnoDB; -START TRANSACTION; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -SET GLOBAL innodb_undo_log_encrypt = OFF; -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -SET GLOBAL innodb_undo_log_encrypt = ON; -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -COMMIT; -START TRANSACTION; -INSERT INTO t1 VALUES(6, "ggggg"); -SET GLOBAL innodb_undo_log_encrypt = OFF; -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -SET GLOBAL innodb_undo_log_encrypt = ON; -INSERT INTO t1 VALUES(9, "jjjjj"); -# Kill and restart to confirm the encryption info can be retrieved properly. -# Kill the server -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -DELETE FROM t1; -START TRANSACTION; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -# Start the DB server with undo log encryption disabled and keyring loaded. It should succeed. -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -ALTER INSTANCE ROTATE INNODB MASTER KEY; -INSERT INTO t1 VALUES(0, "aaaaa"); -INSERT INTO t1 VALUES(1, "bbbbb"); -INSERT INTO t1 VALUES(2, "ccccc"); -INSERT INTO t1 VALUES(3, "ddddd"); -INSERT INTO t1 VALUES(4, "eeeee"); -INSERT INTO t1 VALUES(5, "fffff"); -INSERT INTO t1 VALUES(6, "ggggg"); -INSERT INTO t1 VALUES(7, "hhhhh"); -INSERT INTO t1 VALUES(8, "iiiii"); -INSERT INTO t1 VALUES(9, "jjjjj"); -FLUSH ENGINE LOGS; -# Start the DB server with undo log encryption and keyring loaded. It should success. -SELECT * FROM t1 ORDER BY c1 LIMIT 10; -c1 c2 -0 aaaaa -1 bbbbb -2 ccccc -3 ddddd -4 eeeee -5 fffff -6 ggggg -7 hhhhh -8 iiiii -9 jjjjj -# Cleanup -DROP TABLE t1; -# restart the server with MTR default -# Remove residue files -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kms -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/undo_encrypt_bootstrap.result b/mysql-test/suite/component_keyring_kms/r/undo_encrypt_bootstrap.result deleted file mode 100644 index 2bb584b497ba..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/undo_encrypt_bootstrap.result +++ /dev/null @@ -1,45 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kms -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# create bootstrap file -# Stop the MTR default DB server -# Taking backup of global manifest file for MySQL server -# Run the bootstrap command with no keyring -# Restore global manifest file for MySQL server from backup -# Run the bootstrap command with keyring -# Search for particular string of encryption metadata, should success since it's encrypted. -Pattern "lCC" found -# Taking backup of global manifest file for MySQL server -# Start the DB server with undo log encryption disabled and keyring loaded. It should success. -# Restore global manifest file for MySQL server from backup -SET GLOBAL innodb_undo_log_encrypt = ON; -CREATE TABLE tab1(c1 INT, c2 VARCHAR(30)); -START TRANSACTION; -INSERT INTO tab1 VALUES (100,REPEAT('a',5)),(200,REPEAT('b',5)); -SELECT * FROM tab1; -c1 c2 -100 aaaaa -200 bbbbb -COMMIT; -SET GLOBAL innodb_undo_log_encrypt = OFF; -START TRANSACTION; -INSERT INTO tab1 VALUES (300,REPEAT('a',5)),(400,REPEAT('b',5)); -COMMIT; -SELECT * FROM tab1; -c1 c2 -100 aaaaa -200 bbbbb -300 aaaaa -400 bbbbb -DROP TABLE tab1; -Pattern "lCC" found -Pattern "lCC" found -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kms -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/undo_encrypt_crash.result b/mysql-test/suite/component_keyring_kms/r/undo_encrypt_crash.result deleted file mode 100644 index cb3284461260..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/undo_encrypt_crash.result +++ /dev/null @@ -1,44 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kms -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# bug#30209760 : ASSERTION FAILURE: SRV0START.CC:969:SUCCESS THREAD -# -######### -# SETUP # -######### -# Create path for ibdata* & undo* files -# create bootstrap file -# Stop the MTR default DB server -######################################################################### -# INITIALIZE NEW SERVER -######################################################################### -# Taking backup of global manifest file for MySQL server -# Server should be initialized successfully. -######################################################################### -# RESTART 2 : WITH KEYRING. -innodb_undo_log_encrypt=ON. -Crash server before purge thread could start. -######################################################################### -# Restore global manifest file for MySQL server from backup -######################################################################### -# RESTART 3 : WITH KEYRING. -innodb_undo_log_encrypt=ON. -Skip rotating default master key in master thread -######################################################################### -######################################################################### -# RESTART 4 : WITH KEYRING. -innodb_undo_log_encrypt=OFF. -######################################################################### -########### -# CLEANUP # -########### -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kms -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/r/undo_tablespace_encrypt.result b/mysql-test/suite/component_keyring_kms/r/undo_tablespace_encrypt.result deleted file mode 100644 index 6d3e16d27f9a..000000000000 --- a/mysql-test/suite/component_keyring_kms/r/undo_tablespace_encrypt.result +++ /dev/null @@ -1,82 +0,0 @@ -# ---------------------------------------------------------------------- -# Setup -# Creating custom global manifest file for MySQL server -# Creating custom global configuration file for keyring component: component_keyring_kms -# Re-starting mysql server with manifest file -# ---------------------------------------------------------------------- -# -# Bug #29492911 : ENABLING UNDO-TABLESPACE ENCRYPTION DOESN'T MARK TABLESPACE ENCRYPTION FLAG -# -SHOW VARIABLES LIKE "%innodb_undo_log_encrypt%"; -Variable_name Value -innodb_undo_log_encrypt OFF -# Taking backup of global manifest file for MySQL server -############################################################################### -# With keyring and innodb_undo_log_encrypt=ON -############################################################################### -# Restore global manifest file for MySQL server from backup -SHOW VARIABLES LIKE "%innodb_undo_log_encrypt%"; -Variable_name Value -innodb_undo_log_encrypt ON -# Create a new UNDO tablespace. Should be created as ENCRYPTED. -CREATE UNDO TABLESPACE undo_3 ADD DATAFILE 'undo_3.ibu'; -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo Y active -innodb_undo_002 Undo Y active -undo_3 Undo Y active -SET GLOBAL innodb_undo_log_encrypt=OFF; -SHOW VARIABLES LIKE "%innodb_undo_log_encrypt%"; -Variable_name Value -innodb_undo_log_encrypt OFF -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo N active -innodb_undo_002 Undo N active -undo_3 Undo N active -# Create a new UNDO tablespace. Should be created as UNENCRYPTED. -CREATE UNDO TABLESPACE undo_4 ADD DATAFILE 'undo_4.ibu'; -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo N active -innodb_undo_002 Undo N active -undo_3 Undo N active -undo_4 Undo N active -SET GLOBAL innodb_undo_log_encrypt=ON; -SHOW VARIABLES LIKE "%innodb_undo_log_encrypt%"; -Variable_name Value -innodb_undo_log_encrypt ON -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo Y active -innodb_undo_002 Undo Y active -undo_3 Undo Y active -undo_4 Undo Y active -############################################################################### -# With keyring and innodb_undo_log_encrypt=OFF -############################################################################### -ALTER UNDO TABLESPACE undo_3 set INACTIVE; -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo N active -innodb_undo_002 Undo N active -undo_3 Undo N inactive -undo_4 Undo N active -DROP UNDO TABLESPACE undo_3; -ALTER UNDO TABLESPACE undo_4 set INACTIVE; -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo N active -innodb_undo_002 Undo N active -undo_4 Undo N inactive -DROP UNDO TABLESPACE undo_4; -SELECT NAME, SPACE_TYPE, ENCRYPTION, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE_TYPE='Undo'; -NAME SPACE_TYPE ENCRYPTION STATE -innodb_undo_001 Undo N active -innodb_undo_002 Undo N active -# ---------------------------------------------------------------------- -# Teardown -# Removing global configuration file for keyring component: component_keyring_kms -# Removing global manifest file for MySQL server -# Restarting server without the manifest file -# ---------------------------------------------------------------------- diff --git a/mysql-test/suite/component_keyring_kms/t/alter_rename_table.test b/mysql-test/suite/component_keyring_kms/t/alter_rename_table.test deleted file mode 100644 index 31bb426d2e41..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/alter_rename_table.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/encryption/alter_rename_table_tests.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/alter_table.test b/mysql-test/suite/component_keyring_kms/t/alter_table.test deleted file mode 100644 index f2ec1a632f50..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/alter_table.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/encryption/alter_table_tests.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/clone_local_encrypt-master.opt b/mysql-test/suite/component_keyring_kms/t/clone_local_encrypt-master.opt deleted file mode 100644 index 3d385b83ea9f..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/clone_local_encrypt-master.opt +++ /dev/null @@ -1,3 +0,0 @@ -$CLONE_PLUGIN_OPT -$EXAMPLE_PLUGIN_OPT ---log_error_verbosity=3 diff --git a/mysql-test/suite/component_keyring_kms/t/clone_local_encrypt.test b/mysql-test/suite/component_keyring_kms/t/clone_local_encrypt.test deleted file mode 100644 index 3f09824172f3..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/clone_local_encrypt.test +++ /dev/null @@ -1,13 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/big_test.inc ---source include/not_parallel.inc ---source include/have_innodb_max_16k.inc ---source include/have_debug_sync.inc ---source include/count_sessions.inc - -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/mats/clone_local_encrypt.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kms/t/clone_remote_encrypt-master.opt b/mysql-test/suite/component_keyring_kms/t/clone_remote_encrypt-master.opt deleted file mode 100644 index 3d385b83ea9f..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/clone_remote_encrypt-master.opt +++ /dev/null @@ -1,3 +0,0 @@ -$CLONE_PLUGIN_OPT -$EXAMPLE_PLUGIN_OPT ---log_error_verbosity=3 diff --git a/mysql-test/suite/component_keyring_kms/t/clone_remote_encrypt.test b/mysql-test/suite/component_keyring_kms/t/clone_remote_encrypt.test deleted file mode 100644 index e388ab894727..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/clone_remote_encrypt.test +++ /dev/null @@ -1,11 +0,0 @@ ---source include/have_component_keyring_kms.inc -# Test remote clone with different table types with debug sync - ---source include/have_innodb_max_16k.inc - ---let $HOST = 127.0.0.1 ---let $PORT =`select @@port` ---let $USER = root ---let remote_clone = 1 - ---source clone_local_encrypt.test diff --git a/mysql-test/suite/component_keyring_kms/t/create_table.test b/mysql-test/suite/component_keyring_kms/t/create_table.test deleted file mode 100644 index 6df1015e2109..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/create_table.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/create_table_tests.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/database.test b/mysql-test/suite/component_keyring_kms/t/database.test deleted file mode 100644 index 142fc035caa7..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/database.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/database.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/encrypt_explicit.test b/mysql-test/suite/component_keyring_kms/t/encrypt_explicit.test deleted file mode 100644 index 59e79b71a2c5..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/encrypt_explicit.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/big_test.inc ---source include/not_parallel.inc ---source include/have_innodb_16k.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/innodb/encrypt_explicit.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kms/t/engine.test b/mysql-test/suite/component_keyring_kms/t/engine.test deleted file mode 100644 index c95131257e0a..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/engine.test +++ /dev/null @@ -1,4 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source ../inc/setup_component.inc ---source include/keyring_tests/encryption/engine.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/import_compress_encrypt.test b/mysql-test/suite/component_keyring_kms/t/import_compress_encrypt.test deleted file mode 100644 index 0058714a518d..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/import_compress_encrypt.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_component_keyring_kms.inc -# InnoDB tablespace import with compression + encryption ---source include/have_lowercase0.inc ---source include/have_innodb_16k.inc ---source include/have_punch_hole.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/import_compress_encrypt.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/keyring_component_status.test b/mysql-test/suite/component_keyring_kms/t/keyring_component_status.test deleted file mode 100644 index 168aaba754af..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/keyring_component_status.test +++ /dev/null @@ -1,5 +0,0 @@ ---source include/have_component_keyring_kms.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/keyring_component_status.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/load.test b/mysql-test/suite/component_keyring_kms/t/load.test deleted file mode 100644 index e1772fcc9ba8..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/load.test +++ /dev/null @@ -1,5 +0,0 @@ ---source include/have_component_keyring_kms.inc -# Load-Unload test for component_keyring_kms - ---source ../inc/setup_component.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/log_encrypt_1.test b/mysql-test/suite/component_keyring_kms/t/log_encrypt_1.test deleted file mode 100644 index 6a249820e2b8..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/log_encrypt_1.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc -# WL#9290 InnoDB: Support transparent tablespace data encryption for redo log -# This test case will test basic redo log encryption support features. - ---source include/no_valgrind_without_big.inc ---source include/have_innodb_max_16k.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/log_encrypt_1.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/log_encrypt_2.test b/mysql-test/suite/component_keyring_kms/t/log_encrypt_2.test deleted file mode 100644 index fc9cf8e2ba4d..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/log_encrypt_2.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_component_keyring_kms.inc -# WL#9290 InnoDB: Support transparent tablespace data encryption for redo log -# This test case will test basic redo log encryption support features. - ---source include/no_valgrind_without_big.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/log_encrypt_2.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/log_encrypt_3.test b/mysql-test/suite/component_keyring_kms/t/log_encrypt_3.test deleted file mode 100644 index 7fac95dba998..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/log_encrypt_3.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc -# WL#9290 InnoDB: Support transparent tablespace data encryption for redo log -# This test case will test basic redo log encryption support features. - ---source include/no_valgrind_without_big.inc ---source include/have_innodb_max_16k.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/log_encrypt_3.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/log_encrypt_5.test b/mysql-test/suite/component_keyring_kms/t/log_encrypt_5.test deleted file mode 100644 index ed46f66f4d32..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/log_encrypt_5.test +++ /dev/null @@ -1,14 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/big_test.inc ---source include/not_parallel.inc -# InnoDB transparent encryption on redo log. -# This test case will test basic encryption support features. - ---source include/no_valgrind_without_big.inc ---source include/not_windows.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/innodb/log_encrypt_5.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kms/t/log_encrypt_6.test b/mysql-test/suite/component_keyring_kms/t/log_encrypt_6.test deleted file mode 100644 index f3490f7b3f9e..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/log_encrypt_6.test +++ /dev/null @@ -1,15 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/big_test.inc ---source include/not_parallel.inc -# Test tries restart after redo log encryption is enabled -# - Error :restart without keyring -# - Pass :restart without keyring and --innodb_force_recovery=6 -# - Pass :remove redo files,restart without keyring - ---source include/no_valgrind_without_big.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/innodb/log_encrypt_6.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kms/t/log_encrypt_kill.test b/mysql-test/suite/component_keyring_kms/t/log_encrypt_kill.test deleted file mode 100644 index 79ec40d07f12..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/log_encrypt_kill.test +++ /dev/null @@ -1,15 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/big_test.inc ---source include/not_parallel.inc -# InnoDB transparent encryption on redo log and undo log -# This test case will test basic encryption support with -# concuurent execution and - ---source include/no_valgrind_without_big.inc ---source include/have_innodb_max_16k.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/innodb/log_encrypt_kill.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kms/t/migration-master.opt b/mysql-test/suite/component_keyring_kms/t/migration-master.opt deleted file mode 100644 index 61ad7d05024b..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/migration-master.opt +++ /dev/null @@ -1 +0,0 @@ -$KEYRING_UDF_OPT diff --git a/mysql-test/suite/component_keyring_kms/t/mysql_ts_alter_encrypt_1.test b/mysql-test/suite/component_keyring_kms/t/mysql_ts_alter_encrypt_1.test deleted file mode 100644 index d6850fb2fd9a..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/mysql_ts_alter_encrypt_1.test +++ /dev/null @@ -1,25 +0,0 @@ ---source include/have_component_keyring_kms.inc -################################################################################ -# InnoDB transparent tablespace data encryption for mysql tablespace. -# For mysql tablespace, this test will test -# 1 - Normal alter encryption -# - encryption='y' to encryption='n' -# - encryption='n' to encryption='y' -# 2 - Crash during altering mysql tablespace encryption -# - encryption='y' to encryption='n' -# - encryption='n' to encryption='y' -# 3 - Crash -# - just before encryption processing starts -# - just after encryption processing finishes -# 4 - Crash during master key rotation -# 5 - Privilege check -################################################################################ - ---source include/big_test.inc ---source include/have_debug.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/mysql_ts_alter_encrypt_1.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/mysql_ts_alter_encrypt_2.test b/mysql-test/suite/component_keyring_kms/t/mysql_ts_alter_encrypt_2.test deleted file mode 100644 index a665b0d3ab26..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/mysql_ts_alter_encrypt_2.test +++ /dev/null @@ -1,29 +0,0 @@ ---source include/have_component_keyring_kms.inc -################################################################################ -# InnoDB transparent tablespace data encryption for mysql.tablespace. -# For mysql.tablespace, this test will test -# 1 - Alter mysql.tablespace with -# - and without loading keyring plugin -# - valid/invalid encryption option -# -ENCRYPTION='n' to ENCRYPTION='y' -# 2 - Actual encryption taking place or not -# 3 - Create/Alter table using mysql.tablespace -# 4 - Alter table part of innodb_file_per_table/general/innodb_system/mysql ts to mysql ts -# 5 - Create view using mysql.tablespace -# 6 - Delete/truncate/drop DD table part of mysql tablespace -# 7 - Changing encryption attribute of tables in mysql tablespace -# 8 - Restart with same keyring plugin option and access mysql tables -# 9 - Restart without keyring plugin option, Install plugin explicitly and alter encryption to Y -# 10 - Monitor progress of encryption in performance_schema table -# 11 - Rename/drop mysql tablespace -# 12 - Create tablespace with name as mysql -################################################################################ - ---source include/big_test.inc ---source include/have_debug.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/mysql_ts_alter_encrypt_2.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/mysqldump.test b/mysql-test/suite/component_keyring_kms/t/mysqldump.test deleted file mode 100644 index 5bdba749de30..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/mysqldump.test +++ /dev/null @@ -1,8 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc ---source include/no_valgrind_without_big.inc ---source include/have_case_sensitive_file_system.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/encryption/mysqldump.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/rename_table.test b/mysql-test/suite/component_keyring_kms/t/rename_table.test deleted file mode 100644 index fb840d666a88..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/rename_table.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/encryption/rename_table_tests.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/suite.opt b/mysql-test/suite/component_keyring_kms/t/suite.opt deleted file mode 100644 index 01c4de5872a6..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/suite.opt +++ /dev/null @@ -1 +0,0 @@ -$KEYRING_KMS_COMPONENT_OPT diff --git a/mysql-test/suite/component_keyring_kms/t/table_encrypt_1.test b/mysql-test/suite/component_keyring_kms/t/table_encrypt_1.test deleted file mode 100644 index cb95eee5d0ee..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/table_encrypt_1.test +++ /dev/null @@ -1,12 +0,0 @@ ---source include/have_component_keyring_kms.inc -# InnoDB transparent tablespace data encryption -# This test case will test basic encryption support features. - ---source include/no_valgrind_without_big.inc ---source include/have_innodb_max_16k.inc ---source include/have_debug.inc ---source include/have_punch_hole.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/table_encrypt_1.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/table_encrypt_2.test b/mysql-test/suite/component_keyring_kms/t/table_encrypt_2.test deleted file mode 100644 index f638067f9c02..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/table_encrypt_2.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_component_keyring_kms.inc -# InnoDB transparent tablespace data encryption -# This test case will test basic encryption support features. - ---source include/no_valgrind_without_big.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/table_encrypt_2.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/table_encrypt_3.test b/mysql-test/suite/component_keyring_kms/t/table_encrypt_3.test deleted file mode 100644 index 37a387949490..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/table_encrypt_3.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc -# InnoDB transparent tablespace data encryption -# This test case will test basic encryption support features. - ---source include/no_valgrind_without_big.inc ---source include/have_innodb_max_16k.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/table_encrypt_3.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/table_encrypt_4.test b/mysql-test/suite/component_keyring_kms/t/table_encrypt_4.test deleted file mode 100644 index 63a8647c771d..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/table_encrypt_4.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc -# InnoDB transparent tablespace data encryption -# This test case will test export/import encrypted tablespace. - ---source include/no_valgrind_without_big.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/table_encrypt_4.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/table_encrypt_6.test b/mysql-test/suite/component_keyring_kms/t/table_encrypt_6.test deleted file mode 100644 index 7f5b78482174..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/table_encrypt_6.test +++ /dev/null @@ -1,11 +0,0 @@ ---source include/have_component_keyring_kms.inc -# Test negative scenarios, lifted from other innodb/table_encrypt tests -# -# Create a table with encryption, should fail since keyring is not -# loaded - ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/table_encrypt_6.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/table_encrypt_debug.test b/mysql-test/suite/component_keyring_kms/t/table_encrypt_debug.test deleted file mode 100644 index b4a7d37e7374..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/table_encrypt_debug.test +++ /dev/null @@ -1,20 +0,0 @@ ---source include/have_component_keyring_kms.inc -#------------------------------------------------------------------------------ -# InnoDB transparent tablespace data encryption -# This test case will test basic recovery from known DBUG_SUICIDE point . -# - ib_crash_during_rotation_for_encryption (assert during key rotation) -# - ib_crash_during_create_for_encryption (assert during create) -# - ib_crash_during_decrypt_page (assert during page decryption) -#------------------------------------------------------------------------------ - - --source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc -# Avoid CrashReporter popup on Mac ---source include/not_crashrep.inc -# innodb-force-recovery-crash needs debug ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/table_encrypt_debug.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/table_encrypt_fts.test b/mysql-test/suite/component_keyring_kms/t/table_encrypt_fts.test deleted file mode 100644 index 9618d86e2c05..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/table_encrypt_fts.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc -# Waiting time when (re)starting the server ---let $explicit_default_wait_counter=10000; - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/table_encrypt_fts.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/table_encrypt_kill-master.opt b/mysql-test/suite/component_keyring_kms/t/table_encrypt_kill-master.opt deleted file mode 100644 index f4f26850b8a3..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/table_encrypt_kill-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_buffer_pool_size=256M diff --git a/mysql-test/suite/component_keyring_kms/t/table_encrypt_kill.test b/mysql-test/suite/component_keyring_kms/t/table_encrypt_kill.test deleted file mode 100644 index 003acb4e2a9c..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/table_encrypt_kill.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/no_valgrind_without_big.inc ---source include/big_test.inc -# Avoid CrashReporter popup on Mac ---source include/not_crashrep.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/table_encrypt_kill.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace.test b/mysql-test/suite/component_keyring_kms/t/tablespace.test deleted file mode 100644 index c62f08191cbd..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/tablespace.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_1-master.opt b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_1-master.opt deleted file mode 100644 index 5df3ea9cdec1..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_1-master.opt +++ /dev/null @@ -1 +0,0 @@ ---initialize --innodb_page_size=16k diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_1.test b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_1.test deleted file mode 100644 index 582320d53f74..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_1.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/no_valgrind_without_big.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/tablespace_encrypt_1.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_10.test b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_10.test deleted file mode 100644 index d9ade6663e23..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_10.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc ---source include/big_test.inc ---source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_10.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_11.test b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_11.test deleted file mode 100644 index d278e379a647..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_11.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc ---source include/big_test.inc ---source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_11.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_2-master.opt b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_2-master.opt deleted file mode 100644 index 5df3ea9cdec1..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_2-master.opt +++ /dev/null @@ -1 +0,0 @@ ---initialize --innodb_page_size=16k diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_2.test b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_2.test deleted file mode 100644 index 3a2bbef840ae..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_2.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/big_test.inc ---source include/have_debug.inc -# --source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/tablespace_encrypt_2.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_3.test b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_3.test deleted file mode 100644 index a2daab5c39fd..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_3.test +++ /dev/null @@ -1,7 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/no_valgrind_without_big.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_3.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_4.test b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_4.test deleted file mode 100644 index 75d1e4452b56..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_4.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/no_valgrind_without_big.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_4.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_5-master.opt b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_5-master.opt deleted file mode 100644 index 5df3ea9cdec1..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_5-master.opt +++ /dev/null @@ -1 +0,0 @@ ---initialize --innodb_page_size=16k diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_5.test b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_5.test deleted file mode 100644 index 7401ac9a8d20..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_5.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc ---source include/big_test.inc -# --source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_5.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_7.test b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_7.test deleted file mode 100644 index 4e8d5f99bffd..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_7.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/big_test.inc ---source include/have_debug.inc -# --source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_7.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_8.test b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_8.test deleted file mode 100644 index 4adea33f63a6..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_8.test +++ /dev/null @@ -1,7 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/no_valgrind_without_big.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_8.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_9.test b/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_9.test deleted file mode 100644 index fa5d9624896f..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_encrypt_9.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc ---source include/big_test.inc ---source include/no_valgrind_without_big.inc -# Disable in valgrind because of timeout, cf. Bug#22760145 ---source include/not_valgrind.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/innodb/tablespace_encrypt_9.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/tablespace_with_tables.test b/mysql-test/suite/component_keyring_kms/t/tablespace_with_tables.test deleted file mode 100644 index 8c66b3458a55..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/tablespace_with_tables.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/have_debug.inc - ---source ../inc/setup_component.inc ---source include/keyring_tests/encryption/tablespace_with_tables_tests.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/udf_test-master.opt b/mysql-test/suite/component_keyring_kms/t/udf_test-master.opt deleted file mode 100644 index 61ad7d05024b..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/udf_test-master.opt +++ /dev/null @@ -1 +0,0 @@ -$KEYRING_UDF_OPT diff --git a/mysql-test/suite/component_keyring_kms/t/udf_test.test b/mysql-test/suite/component_keyring_kms/t/udf_test.test deleted file mode 100644 index d2c30fab871a..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/udf_test.test +++ /dev/null @@ -1,8 +0,0 @@ ---source include/have_component_keyring_kms.inc -# Keyring UDF tests with component_keyring_kms -# ---let $skip_secret_tests = 1 - ---source ../inc/setup_component.inc ---source include/keyring_tests/mats/keyring_udf_test.inc ---source ../inc/teardown_component.inc diff --git a/mysql-test/suite/component_keyring_kms/t/undo_encrypt_basic.test b/mysql-test/suite/component_keyring_kms/t/undo_encrypt_basic.test deleted file mode 100644 index 0909e8862a2f..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/undo_encrypt_basic.test +++ /dev/null @@ -1,11 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/big_test.inc ---source include/not_parallel.inc ---source include/no_valgrind_without_big.inc ---source include/have_innodb_max_16k.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/mats/undo_encrypt_basic.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kms/t/undo_encrypt_bootstrap.test b/mysql-test/suite/component_keyring_kms/t/undo_encrypt_bootstrap.test deleted file mode 100644 index 15a732a84eab..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/undo_encrypt_bootstrap.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/big_test.inc ---source include/not_parallel.inc ---source include/big_test.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/mats/undo_encrypt_bootstrap.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kms/t/undo_encrypt_crash.test b/mysql-test/suite/component_keyring_kms/t/undo_encrypt_crash.test deleted file mode 100644 index cd11848205f7..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/undo_encrypt_crash.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/big_test.inc ---source include/not_parallel.inc ---source include/have_debug.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/innodb/undo_encrypt_crash.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/component_keyring_kms/t/undo_tablespace_encrypt.test b/mysql-test/suite/component_keyring_kms/t/undo_tablespace_encrypt.test deleted file mode 100644 index e7f24166005a..000000000000 --- a/mysql-test/suite/component_keyring_kms/t/undo_tablespace_encrypt.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_component_keyring_kms.inc ---source include/big_test.inc ---source include/not_parallel.inc ---source include/have_innodb_16k.inc -# This test must be not be run in parallel with other tests because -# it requires global manifest file to load keyring component directly - ---source ../inc/setup_component_customized.inc ---source include/keyring_tests/innodb/undo_tablespace_encrypt.inc ---source ../inc/teardown_component_customized.inc diff --git a/mysql-test/suite/rpl/r/rpl_mts_spco_deadlock_slave_trans_retries_hang.result b/mysql-test/suite/rpl/r/rpl_mts_spco_deadlock_slave_trans_retries_hang.result index 8ba74d837c67..696702838c04 100644 --- a/mysql-test/suite/rpl/r/rpl_mts_spco_deadlock_slave_trans_retries_hang.result +++ b/mysql-test/suite/rpl/r/rpl_mts_spco_deadlock_slave_trans_retries_hang.result @@ -53,7 +53,7 @@ include/start_slave_sql.inc [connection slave] ROLLBACK; # Add error supressions. -CALL mtr.add_suppression("Worker 2 failed executing transaction.*"); +CALL mtr.add_suppression("Worker .* failed executing transaction.*"); # # 3.2. Wait till the co-ordinator thread to error out with ER_LOCK_DEADLOCK. include/wait_for_slave_sql_error.inc [errno=1213] diff --git a/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_hang_on_non_temp_error-slave.opt b/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_hang_on_non_temp_error-slave.opt new file mode 100644 index 000000000000..655998409520 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_hang_on_non_temp_error-slave.opt @@ -0,0 +1 @@ +--no-console --log_error=$MYSQLTEST_VARDIR/tmp/rpl_mts_spco_deadlock_hang_on_non_temp_error.2.err diff --git a/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_hang_on_non_temp_error.test b/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_hang_on_non_temp_error.test index 1875b98233fd..fd2dbc8603bf 100644 --- a/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_hang_on_non_temp_error.test +++ b/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_hang_on_non_temp_error.test @@ -200,7 +200,7 @@ COMMIT; --echo # 3.13 Check that worker 2 did not *retry* transaction-2 --echo # before throwing ER_DUP_ENTRY error (non-temporary error). --echo # ---let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err +--let $assert_file= $MYSQLTEST_VARDIR/tmp/rpl_mts_spco_deadlock_hang_on_non_temp_error.2.err --let $assert_only_after = CURRENT_TEST: rpl.rpl_mts_spco_deadlock_hang_on_non_temp_error --let $assert_count = 1 --let $assert_select = Error 'Duplicate entry '1' for key 't2.PRIMARY'' on query diff --git a/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_slave_trans_retries_hang.test b/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_slave_trans_retries_hang.test index 220ea4665198..6a4333300bdc 100644 --- a/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_slave_trans_retries_hang.test +++ b/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_slave_trans_retries_hang.test @@ -148,7 +148,7 @@ ROLLBACK; # to wait for the workers to finish thus leading to server hang. --echo # Add error supressions. -CALL mtr.add_suppression("Worker 2 failed executing transaction.*"); +CALL mtr.add_suppression("Worker .* failed executing transaction.*"); --echo # --echo # 3.2. Wait till the co-ordinator thread to error out with ER_LOCK_DEADLOCK. diff --git a/plugin/keyring/CMakeLists.txt b/plugin/keyring/CMakeLists.txt index 6762c388deb4..0a1e65af44ad 100644 --- a/plugin/keyring/CMakeLists.txt +++ b/plugin/keyring/CMakeLists.txt @@ -37,8 +37,6 @@ MYSQL_ADD_PLUGIN(keyring_file common/keyring_key.cc common/keys_container.cc common/keys_iterator.cc - common/system_keys_container.cc - common/system_key_adapter.cc common/keyring_impl.cc converter.cc digest.cc diff --git a/plugin/keyring/common/i_system_keys_container.h b/plugin/keyring/common/i_system_keys_container.h deleted file mode 100644 index e3640cd8a3a5..000000000000 --- a/plugin/keyring/common/i_system_keys_container.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2018 Percona LLC and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 of - the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef MYSQL_I_SYSTEM_KEYS_CONTAINER_H -#define MYSQL_I_SYSTEM_KEYS_CONTAINER_H - -#include "i_keyring_key.h" - -namespace keyring { -class ISystem_keys_container : public Keyring_alloc { - public: - virtual IKey *get_latest_key_if_system_key_without_version(IKey *key) = 0; - virtual void store_or_update_if_system_key_with_version(IKey *key) = 0; - virtual bool rotate_key_id_if_system_key_without_version(IKey *key) = 0; - virtual bool is_system_key(IKey *key) = 0; - - virtual ~ISystem_keys_container() {} -}; -} // namespace keyring - -#endif // MYSQL_I_SYSTEM_KEYS_CONTAINER_H diff --git a/plugin/keyring/common/keyring_memory.h b/plugin/keyring/common/keyring_memory.h index 433df63c56c8..5eb473f5f835 100644 --- a/plugin/keyring/common/keyring_memory.h +++ b/plugin/keyring/common/keyring_memory.h @@ -59,9 +59,9 @@ class Secure_allocator : public std::allocator<T> { struct rebind { typedef Secure_allocator<U> other; }; + Secure_allocator() noexcept {} - Secure_allocator(const Secure_allocator &secure_allocator) noexcept - : std::allocator<T>(secure_allocator) {} + template <class U> Secure_allocator(const Secure_allocator<U> &) noexcept {} diff --git a/plugin/keyring/common/keys_container.cc b/plugin/keyring/common/keys_container.cc index efeb72f6e054..3e1fbc1ec7d5 100644 --- a/plugin/keyring/common/keys_container.cc +++ b/plugin/keyring/common/keys_container.cc @@ -27,7 +27,6 @@ #include <algorithm> #include <mysqld_error.h> -#include "plugin/keyring/common/system_keys_container.h" #include "sql/mysqld_cs.h" using std::string; @@ -52,7 +51,6 @@ bool Keys_container::init(IKeyring_io *keyring_io, this->keyring_io = keyring_io; this->keyring_storage_url = keyring_storage_url; keys_hash->clear(); - system_keys_container.reset(new System_keys_container(logger)); if (keyring_io->init(&this->keyring_storage_url) || load_keys_from_keyring_storage()) { keys_hash->clear(); @@ -89,22 +87,16 @@ bool Keys_container::store_key_in_hash(IKey *key) { } bool Keys_container::store_key(IKey *key) { - if (system_keys_container->rotate_key_id_if_system_key_without_version(key) || - flush_to_backup() || store_key_in_hash(key)) - return true; + if (flush_to_backup() || store_key_in_hash(key)) return true; if (flush_to_storage(key, STORE_KEY)) { remove_key_from_hash(key); return true; } - system_keys_container->store_or_update_if_system_key_with_version(key); return false; } IKey *Keys_container::get_key_from_hash(IKey *key) { - IKey *system_key = - system_keys_container->get_latest_key_if_system_key_without_version(key); - return system_key ? system_key - : find_or_nullptr(*keys_hash, *key->get_key_signature()); + return find_or_nullptr(*keys_hash, *key->get_key_signature()); } void Keys_container::allocate_and_set_data_for_key( @@ -157,10 +149,8 @@ bool Keys_container::remove_key_from_hash(IKey *key) { bool Keys_container::remove_key(IKey *key) { IKey *fetched_key_to_delete = get_key_from_hash(key); - // removing system keys is forbidden - if (fetched_key_to_delete == nullptr || - system_keys_container->is_system_key(fetched_key_to_delete) || - flush_to_backup() || remove_key_from_hash(fetched_key_to_delete)) + if (fetched_key_to_delete == nullptr || flush_to_backup() || + remove_key_from_hash(fetched_key_to_delete)) return true; if (flush_to_storage(fetched_key_to_delete, REMOVE_KEY)) { // reinsert the key @@ -188,8 +178,6 @@ bool Keys_container::load_keys_from_keyring_storage() { delete key_loaded; break; } - system_keys_container->store_or_update_if_system_key_with_version( - key_loaded); key_loaded = nullptr; } delete serialized_keys; diff --git a/plugin/keyring/common/keys_container.h b/plugin/keyring/common/keys_container.h index be6cd38c8e34..768ba73e8b5f 100644 --- a/plugin/keyring/common/keys_container.h +++ b/plugin/keyring/common/keys_container.h @@ -32,7 +32,6 @@ #include "mysql/strings/m_ctype.h" #include "plugin/keyring/common/i_keyring_io.h" #include "plugin/keyring/common/i_keys_container.h" -#include "plugin/keyring/common/i_system_keys_container.h" #include "plugin/keyring/common/keyring_key.h" #include "plugin/keyring/common/keyring_memory.h" #include "plugin/keyring/common/logger.h" @@ -83,7 +82,6 @@ class Keys_container : public IKeys_container { ILogger *logger; IKeyring_io *keyring_io; std::string keyring_storage_url; - std::unique_ptr<ISystem_keys_container> system_keys_container; }; } // namespace keyring diff --git a/plugin/keyring/common/system_key_adapter.cc b/plugin/keyring/common/system_key_adapter.cc deleted file mode 100644 index a644c5a23951..000000000000 --- a/plugin/keyring/common/system_key_adapter.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (c) 2018 Percona LLC and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 of - the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include "system_key_adapter.h" -#include "secure_string.h" - -namespace keyring { -// Adds key's version to keyring's key data. The resulting system key data looks -// like this: <key_version>:<keyring key data> -void System_key_adapter::construct_system_key_data() { - Secure_ostringstream system_key_data_version_prefix_ss; - system_key_data_version_prefix_ss << key_version << ':'; - Secure_string system_key_data_version_prefix = - system_key_data_version_prefix_ss.str(); - system_key_data.allocate(system_key_data_version_prefix.length() + - keyring_key->get_key_data_size()); - - // need to "de"-xor keying key data to be able to add to it key version prefix - keyring_key->xor_data(); - memcpy(system_key_data.get_key_data(), system_key_data_version_prefix.c_str(), - system_key_data_version_prefix.length()); - memcpy( - system_key_data.get_key_data() + system_key_data_version_prefix.length(), - keyring_key->get_key_data(), keyring_key->get_key_data_size()); - - size_t keyring_key_data_size = keyring_key->get_key_data_size(); - uchar *keyring_key_data = keyring_key->release_key_data(); - - // Using keyring_key's xor function to xor system key data, next - // restoring keyring key data - keyring_key->set_key_data(system_key_data.get_key_data(), - system_key_data.get_key_data_size()); - keyring_key->xor_data(); - - keyring_key->release_key_data(); - keyring_key->set_key_data(keyring_key_data, keyring_key_data_size); - - keyring_key->xor_data(); -} - -System_key_adapter::System_key_data::System_key_data() - : key_data(NULL), key_data_size(0) {} - -System_key_adapter::System_key_data::~System_key_data() { free(); } - -bool System_key_adapter::System_key_data::allocate(size_t key_data_size) { - free(); - key_data = new uchar[key_data_size]; - if (key_data) { - this->key_data_size = key_data_size; - return false; - } - return true; -} - -void System_key_adapter::System_key_data::free() { - if (key_data) { - assert(key_data_size <= 512); - memset_s(key_data, 512, 0, key_data_size); - delete[] key_data; - key_data = NULL; - key_data_size = 0; - } -} - -uchar *System_key_adapter::System_key_data::get_key_data() { return key_data; } - -size_t System_key_adapter::System_key_data::get_key_data_size() { - return key_data_size; -} -} // namespace keyring diff --git a/plugin/keyring/common/system_key_adapter.h b/plugin/keyring/common/system_key_adapter.h deleted file mode 100644 index 76940074fce3..000000000000 --- a/plugin/keyring/common/system_key_adapter.h +++ /dev/null @@ -1,147 +0,0 @@ -/* Copyright (c) 2018 Percona LLC and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 of - the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include <assert.h> -#include "i_keyring_key.h" - -namespace keyring { - -class System_key_adapter : public IKey { - public: - System_key_adapter(uint key_version, IKey *keyring_key) - : key_version(key_version), keyring_key(keyring_key) {} - - void set_keyring_key(IKey *key, uint key_version) { - system_key_data.free(); - this->keyring_key = key; - this->key_version = key_version; - } - - IKey *get_keyring_key() const noexcept { return keyring_key; } - - uint get_key_version() const noexcept { return key_version; } - - virtual std::string *get_key_signature() const noexcept override { - assert(keyring_key != nullptr); - return keyring_key->get_key_signature(); - } - - virtual Key_type get_key_type() const override { - assert(keyring_key != nullptr); - return keyring_key->get_key_type(); - } - - virtual std::string *get_key_type_as_string() override { - assert(keyring_key != nullptr); - return keyring_key->get_key_type_as_string(); - } - - virtual std::string *get_key_id() override { - assert(keyring_key != nullptr); - return keyring_key->get_key_id(); - } - virtual std::string *get_user_id() override { - assert(keyring_key != nullptr); - return keyring_key->get_user_id(); - } - virtual uchar *get_key_data() override { - assert(keyring_key != nullptr); - - if (system_key_data.get_key_data() == nullptr) construct_system_key_data(); - - return system_key_data.get_key_data(); - } - virtual size_t get_key_data_size() override { - assert(keyring_key != nullptr); - - if (system_key_data.get_key_data() == nullptr) construct_system_key_data(); - - return system_key_data.get_key_data_size(); - } - virtual size_t get_key_pod_size() const noexcept override { - assert(false); - return 0; - } - virtual uchar *release_key_data() noexcept override { - assert(false); - return nullptr; - } - virtual void xor_data() noexcept override { assert(false); } - virtual void set_key_data(uchar *key_data, size_t key_data_size) override { - keyring_key->set_key_data(key_data, key_data_size); - } - virtual void set_key_type(const std::string *key_type) override { - keyring_key->set_key_type(key_type); - } - virtual bool load_from_buffer(uchar *buffer MY_ATTRIBUTE((unused)), - size_t *buffer_position MY_ATTRIBUTE((unused)), - size_t input_buffer_size - MY_ATTRIBUTE((unused))) noexcept override { - assert(false); - return false; - } - virtual void store_in_buffer( - uchar *buffer MY_ATTRIBUTE((unused)), - size_t *buffer_position MY_ATTRIBUTE((unused))) const noexcept override { - assert(false); - } - virtual bool is_key_type_valid() override { - assert(false); - return false; - } - virtual bool is_key_id_valid() override { - assert(false); - return false; - } - virtual bool is_key_valid() override { - assert(false); - return false; - } - virtual bool is_key_length_valid() override { - assert(false); - return false; - } - - protected: - void set_key_type_enum(const std::string *key_type) override { - assert(keyring_key != nullptr); - keyring_key->set_key_type(key_type); - } - - private: - class System_key_data { - public: - System_key_data(); - ~System_key_data(); - - bool allocate(size_t key_data_size); - void free(); - uchar *get_key_data(); - size_t get_key_data_size(); - - private: - uchar *key_data; - size_t key_data_size; - }; - - void construct_system_key_data(); - - System_key_data system_key_data; - uint key_version; - IKey *keyring_key; -}; - -} // namespace keyring diff --git a/plugin/keyring/common/system_keys_container.cc b/plugin/keyring/common/system_keys_container.cc deleted file mode 100644 index 2a94c540d34d..000000000000 --- a/plugin/keyring/common/system_keys_container.cc +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright (c) 2018 Percona LLC and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 of - the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include "system_keys_container.h" -#include <climits> -#include <sstream> - -namespace keyring { - -// System keys cannot have ':' in their name. We use ':' as a separator between -// system key's name and system key's version -const std::string System_keys_container::system_key_prefix = "percona_"; - -System_keys_container::~System_keys_container() { - for (System_key_id_to_system_key::iterator iter = - system_key_id_to_system_key.begin(); - iter != system_key_id_to_system_key.end(); ++iter) - delete iter->second; -} - -bool System_keys_container::is_system_key(IKey *key) { - std::string system_key_id; - uint key_version; - - return is_system_key_with_version(key, system_key_id, key_version) || - is_system_key_without_version(key); -} - -IKey *System_keys_container::get_latest_key_if_system_key_without_version( - IKey *key) { - return (!key->get_user_id()->empty() || - system_key_id_to_system_key.count(*key->get_key_id()) == 0) - ? nullptr - : system_key_id_to_system_key[*key->get_key_id()]; -} - -bool System_keys_container::parse_system_key_id_with_version( - std::string &key_id, std::string &system_key_id, uint &key_version) { - const std::size_t colon_position = key_id.find_last_of(':'); - - if (colon_position == std::string::npos || - colon_position == key_id.length() - 1) - return true; - - system_key_id = key_id.substr(0, colon_position); - const std::string version = - key_id.substr(colon_position + 1, key_id.length() - colon_position); - - if (version.empty()) return true; - - char *endptr = nullptr; - ulong ulong_key_version = strtoul(version.c_str(), &endptr, 10); - if (ulong_key_version > UINT_MAX || endptr == nullptr || *endptr != '\0') - return true; - - key_version = static_cast<uint>(ulong_key_version); - return false; -} - -bool System_keys_container::is_system_key_without_version(IKey *key) noexcept { - return key->get_user_id()->empty() && - key->get_key_id()->compare(0, system_key_prefix.length(), - system_key_prefix) == 0 && - key->get_key_id()->find_first_of(':') == - std::string::npos; // system keys cannot have ':' in their name -} - -bool System_keys_container::is_system_key_with_version( - IKey *key, std::string &system_key_id, uint &key_version) { - return key->get_user_id()->empty() && - !parse_system_key_id_with_version(*key->get_key_id(), system_key_id, - key_version) && - key->get_key_id()->compare(0, system_key_prefix.length(), - system_key_prefix) == 0; -} - -void System_keys_container::update_system_key(IKey *key, - const std::string &system_key_id, - uint key_version) { - if (system_key_id_to_system_key[system_key_id]->get_key_version() < - key_version) - system_key_id_to_system_key[system_key_id]->set_keyring_key(key, - key_version); -} - -bool System_keys_container::rotate_key_id_if_system_key_without_version( - IKey *key) { - if (!is_system_key_without_version(key)) return false; - - uint key_version = - 0; // if we rotate from plain system key, we assign version 0 to it - if (system_key_id_to_system_key.count(*key->get_key_id()) != 0) { - key_version = - system_key_id_to_system_key[*key->get_key_id()]->get_key_version(); - if (key_version == UINT_MAX) { - logger->log(MY_ERROR_LEVEL, - "System key cannot be rotated anymore, " - "the maximum key version has been reached."); - return true; - } - ++key_version; - } - std::ostringstream system_key_id_with_inc_version_ss; - system_key_id_with_inc_version_ss << *key->get_key_id() << ':' << key_version; - *(key->get_key_id()) = system_key_id_with_inc_version_ss.str(); - - return false; -} - -void System_keys_container::store_or_update_if_system_key_with_version( - IKey *key) { - std::string system_key_id; - uint key_version; - - if (is_system_key_with_version(key, system_key_id, key_version)) { - if (system_key_id_to_system_key.count(system_key_id) == - 0) // add a new system key - system_key_id_to_system_key.emplace( - system_key_id, new System_key_adapter(key_version, key)); - else - update_system_key(key, system_key_id, key_version); - } -} - -} // namespace keyring diff --git a/plugin/keyring/common/system_keys_container.h b/plugin/keyring/common/system_keys_container.h deleted file mode 100644 index 9a61a8d3bcb6..000000000000 --- a/plugin/keyring/common/system_keys_container.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright (c) 2018 Percona LLC and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 of - the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifndef SYSTEM_KEYS_CONTAINER_INCLUDED -#define SYSTEM_KEYS_CONTAINER_INCLUDED - -#include <unordered_map> -#include "i_system_keys_container.h" -#include "logger.h" -#include "system_key_adapter.h" - -namespace keyring { - -/** - System_keys_container stores system keys together with links to their latest - versions. Latest version of a key itself is stored somewhere else (presumably - in keys_container). For instance system_keys_container maps percona_binlog to - its latest version percona_binlog:12, the key percona_binlog:12 itself is - stored in keys_container. System_key_container only maps system key - percona_binlog to its latest version, i.e. percona_binlog:12, it does not know - about other versions of the key. The keys returned by System_keys_container - are encapsulated in System_key_adapter which allows to retrieve information - like key's version. -*/ -class System_keys_container : public ISystem_keys_container { - public: - System_keys_container(ILogger *logger) : logger(logger) {} - ~System_keys_container(); - - /** - Returns key with latest version when called with plain system key (ex. - percona_binlog) For instance - when key's (argument key) id is system_key - and latest version of system_key is x it will return key with id - system_key:x - - @return latest key version on success and NULL on failure - */ - virtual IKey *get_latest_key_if_system_key_without_version( - IKey *key) override; - - /** - Only system keys with already assigned version can be stored inside - system_keys_container for instance : percona_binlog:0 - */ - virtual void store_or_update_if_system_key_with_version(IKey *key) override; - - /** - Pass key with system_key id (for instance percona_binlog) to get next - version of the system_key, for instance : System_keys_container already has - percona_binlog key with version 12 : percona_binlog:12 Calling this function - will assing percona_binlog:13 as key_id to key passed as argument - */ - virtual bool rotate_key_id_if_system_key_without_version(IKey *key) override; - - /** - Returns true if key id of key argument is either system_key or system_key:x - For instance percona_binlog or percona_binlog:12 - */ - virtual bool is_system_key(IKey *key) override; - - private: - static bool parse_system_key_id_with_version(std::string &key_id, - std::string &system_key_id, - uint &key_version); - void update_system_key(IKey *key, const std::string &system_key_id, - uint key_version); - bool is_system_key_with_version(IKey *key, std::string &system_key_id, - uint &key_version); - static bool is_system_key_without_version(IKey *key) noexcept; - - typedef std::unordered_map<std::string, System_key_adapter *> - System_key_id_to_system_key; - System_key_id_to_system_key system_key_id_to_system_key; - static const std::string system_key_prefix; - - ILogger *logger; -}; - -} // namespace keyring - -#endif // SYSTEM_KEYS_CONTAINER_INCLUDED diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h index 34492c187125..f0ac752fdfa0 100644 --- a/storage/innobase/include/ut0new.h +++ b/storage/innobase/include/ut0new.h @@ -441,6 +441,15 @@ static constexpr const char *auto_event_names[] = { "ut0vec", "ut0wqueue", "zipdecompress", +#ifdef XTRABACKUP + /* added for Percona XtraBackup */ + "backup_copy", + "changed_page_tracking", + "fil_cur", + "redo_log", + "write_filt", + "xtrabackup", +#endif }; static constexpr size_t n_auto = UT_ARR_SIZE(auto_event_names); diff --git a/storage/innobase/xtrabackup/src/ds_fifo.cc b/storage/innobase/xtrabackup/src/ds_fifo.cc index 1b39440480c3..a81a37380588 100644 --- a/storage/innobase/xtrabackup/src/ds_fifo.cc +++ b/storage/innobase/xtrabackup/src/ds_fifo.cc @@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include "file_utils.h" #include "msg.h" -typedef struct { +struct ds_fifo_ctxt_t { /* List of FIFO files to be used for stream */ std::unordered_map<std::string, File> FIFO_list; /* Mutex protecting FIFO list */ @@ -65,7 +65,9 @@ typedef struct { } FIFO_list.clear(); } -} ds_fifo_ctxt_t; +}; + +typedef struct ds_fifo_ctxt_t ds_fifo_ctxt_t; typedef struct { File fd; diff --git a/storage/innobase/xtrabackup/src/keyring_plugins.cc b/storage/innobase/xtrabackup/src/keyring_plugins.cc index 77d725b8a2ca..6d169078565a 100644 --- a/storage/innobase/xtrabackup/src/keyring_plugins.cc +++ b/storage/innobase/xtrabackup/src/keyring_plugins.cc @@ -186,9 +186,10 @@ dberr_t xb_set_encryption(fil_space_t *space) { return (fil_set_encryption(space->id, Encryption::AES, key, iv)); } -const char *TRANSITION_KEY_PREFIX = "XBKey"; -const size_t TRANSITION_KEY_PREFIX_LEN = - sizeof(TRANSITION_KEY_PREFIX) / sizeof(char); +#define TRANSITION_KEY_PREFIX_STR "XBKey" + +const char *TRANSITION_KEY_PREFIX = TRANSITION_KEY_PREFIX_STR; +const size_t TRANSITION_KEY_PREFIX_LEN = sizeof(TRANSITION_KEY_PREFIX_STR) - 1; const size_t TRANSITION_KEY_RANDOM_DATA_LEN = 32; const size_t TRANSITION_KEY_NAME_MAX_LEN_V1 = Encryption::SERVER_UUID_LEN + 2 + 45; diff --git a/storage/innobase/xtrabackup/src/rapidxml/rapidxml.hpp b/storage/innobase/xtrabackup/src/rapidxml/rapidxml.hpp index c9fe40302b3f..22a628fbd4a3 100644 --- a/storage/innobase/xtrabackup/src/rapidxml/rapidxml.hpp +++ b/storage/innobase/xtrabackup/src/rapidxml/rapidxml.hpp @@ -82,10 +82,7 @@ namespace rapidxml //! Gets human readable description of error. //! \return Pointer to null terminated description of the error. - virtual const char *what() const throw() override - { - return m_what; - } + virtual const char *what() const noexcept override { return m_what; } //! Gets pointer to character data where error happened. //! Ch should be the same as char type of xml_document that produced the error. diff --git a/storage/innobase/xtrabackup/src/xbcloud/xbcloud.cc b/storage/innobase/xtrabackup/src/xbcloud/xbcloud.cc index c39f2b27f364..cbe17ecb6aa9 100644 --- a/storage/innobase/xtrabackup/src/xbcloud/xbcloud.cc +++ b/storage/innobase/xtrabackup/src/xbcloud/xbcloud.cc @@ -1154,10 +1154,10 @@ void download_func(download_thread_ctxt_t &cntx) { cntx.store->async_download_object( *cntx.container, chunk, &h, std::bind( - [&cntx, &thread_state](bool success, const Http_buffer &contents, - std::string chunk, my_off_t idx, - std::atomic<bool> *error, uint thread_id, - File fd, file_metadata_t file) { + [&thread_state](bool success, const Http_buffer &contents, + std::string chunk, my_off_t idx, + std::atomic<bool> *error, uint thread_id, File fd, + file_metadata_t file) { if (!success) { error->store(true); msg_ts("%s: [%d] Download failed. Cannot download %s.\n", diff --git a/storage/innobase/xtrabackup/src/xbstream.cc b/storage/innobase/xtrabackup/src/xbstream.cc index f999cbbd19da..6c5e1d3f9e9f 100644 --- a/storage/innobase/xtrabackup/src/xbstream.cc +++ b/storage/innobase/xtrabackup/src/xbstream.cc @@ -494,7 +494,7 @@ static void extract_worker_thread_func(extract_ctxt_t &ctxt) { xb_rstream_t *stream = NULL; xb_rstream_chunk_t chunk; file_entry_t *entry; - xb_rstream_result_t res; + xb_rstream_result_t res = XB_STREAM_READ_CHUNK; ctxt.mutex->lock(); stream = ctxt.streams->front(); diff --git a/storage/innobase/xtrabackup/test/bootstrap.sh b/storage/innobase/xtrabackup/test/bootstrap.sh index afe77b1f2961..87d062f6b3f8 100755 --- a/storage/innobase/xtrabackup/test/bootstrap.sh +++ b/storage/innobase/xtrabackup/test/bootstrap.sh @@ -22,15 +22,25 @@ function ssl_version() { 100|101) ;; 102) unset sslv; sslv="102.$OS" ;; *) - if ! test -r "${1}"; then - >&2 echo "tarball for your openssl version (${sslv}) is not available" - exit 1 - fi + >&2 echo "tarball for your openssl version (${sslv}) is not available" + exit 1 ;; esac echo ${sslv} } +function glibc_version() { + glibc=$(ldd --version | head -1 | awk '{print $NF}') + case ${glibc} in + 2.12|2.17|2.27|2.28|2.31|2.34|2.35) ;; + *) + >&2 echo "tarball for your glibc version (${glibc}) is not available" + exit 1 + ;; + esac + echo ${glibc} +} + shell_quote_string() { echo "$1" | sed -e 's,\([^a-zA-Z0-9/_.=-]\),\\\1,g' } @@ -114,13 +124,15 @@ main () { short_version=$(echo ${VERSION} | awk -F "." '{ print $3 }' | cut -d '-' -f1) if [[ ${PXB_TYPE} == "Debug" ]] || [[ ${PXB_TYPE} == "debug" ]]; then SUFFIX="-debug" + else + SUFFIX="-minimal" fi if [[ ${short_version} -lt "20" ]]; then tarball="Percona-Server-${VERSION}-Linux.${arch}.ssl$(ssl_version).tar.gz" elif [[ ${short_version} -ge "20" && ${short_version} -lt "22" ]]; then tarball="Percona-Server-${VERSION}-Linux.${arch}.glibc2.12${SUFFIX}.tar.gz" elif [[ ${short_version} -ge "22" ]]; then - tarball="Percona-Server-${VERSION}-Linux.${arch}.glibc2.17${SUFFIX}.tar.gz" + tarball="Percona-Server-${VERSION}-Linux.${arch}.glibc$(glibc_version)${SUFFIX}.tar.gz" fi ;; *) @@ -165,7 +177,7 @@ main () { TYPE="xtradb80" PXB_TYPE="release" -VERSION="8.0.18-9" +VERSION="8.0.34-26" DESTDIR="./server" parse_arguments PICK-ARGS-FROM-ARGV "$@" main diff --git a/storage/innobase/xtrabackup/test/inc/keyring_common.sh b/storage/innobase/xtrabackup/test/inc/keyring_common.sh index d25bdc77ca5b..aebde24200a5 100644 --- a/storage/innobase/xtrabackup/test/inc/keyring_common.sh +++ b/storage/innobase/xtrabackup/test/inc/keyring_common.sh @@ -14,15 +14,15 @@ function test_do() vlog "-- transition_key: ${transition_key} --" vlog "-- keyring_type: ${keyring_type} --" if [[ "$transition_key" = "generate" ]] ; then - backup_options="--generate-transition-key" + backup_options="--generate-transition-key --xtrabackup-plugin-dir=${plugin_dir}" prepare_options="--xtrabackup-plugin-dir=${plugin_dir} ${keyring_args}" copyback_options="--xtrabackup-plugin-dir=${plugin_dir} ${keyring_args}" elif [[ "$transition_key" = "none" ]] ; then - backup_options= + backup_options="--xtrabackup-plugin-dir=${plugin_dir}" prepare_options="--xtrabackup-plugin-dir=${plugin_dir} ${keyring_args}" copyback_options="--xtrabackup-plugin-dir=${plugin_dir} ${keyring_args}" else - backup_options="--transition-key=$transition_key" + backup_options="--transition-key=$transition_key --xtrabackup-plugin-dir=${plugin_dir}" prepare_options="--transition-key=$transition_key" copyback_options="--transition-key=$transition_key --xtrabackup-plugin-dir=${plugin_dir} ${keyring_args}" fi @@ -36,7 +36,7 @@ function test_do() run_cmd $MYSQL $MYSQL_ARGS test -e "SELECT @@server_uuid" # PXB-1540: XB removes and recreate keyring file of 0 size - xtrabackup --backup --target-dir=$topdir/backup0 + xtrabackup --backup --target-dir=$topdir/backup0 $backup_options rm -rf $topdir/backup0 diff --git a/storage/innobase/xtrabackup/test/inc/xbcloud_common.sh b/storage/innobase/xtrabackup/test/inc/xbcloud_common.sh index 5d1037b4c8e4..52dccaa1b88e 100644 --- a/storage/innobase/xtrabackup/test/inc/xbcloud_common.sh +++ b/storage/innobase/xtrabackup/test/inc/xbcloud_common.sh @@ -23,8 +23,10 @@ secure-file-priv=$TEST_VAR_ROOT is_galera && skip_test "skipping" function is_xbcloud_credentials_set() { - [ "${XBCLOUD_CREDENTIALS:-unset}" == "unset" ] && \ - skip_test "Requires XBCLOUD_CREDENTIALS" + if [ -z ${XBCLOUD_CREDENTIALS+x} ]; + then + skip_test "Requires XBCLOUD_CREDENTIALS" + fi } now=$(date +%s) diff --git a/storage/innobase/xtrabackup/test/suites/keyring/innodb_encryption_mix_plugins.sh b/storage/innobase/xtrabackup/test/suites/keyring/innodb_encryption_mix_plugins.sh index 696cfb7e10fe..173d8ebea06e 100644 --- a/storage/innobase/xtrabackup/test/suites/keyring/innodb_encryption_mix_plugins.sh +++ b/storage/innobase/xtrabackup/test/suites/keyring/innodb_encryption_mix_plugins.sh @@ -4,6 +4,8 @@ require_server_version_higher_than 5.7.10 +is_xtradb || skip_test "Keyring vault requires Percona Server" + vlog setup keyring_file . inc/keyring_file.sh diff --git a/unittest/gunit/keyring/CMakeLists.txt b/unittest/gunit/keyring/CMakeLists.txt index d0191df9b843..49022184e394 100644 --- a/unittest/gunit/keyring/CMakeLists.txt +++ b/unittest/gunit/keyring/CMakeLists.txt @@ -22,7 +22,6 @@ SET(TESTS keyring-api - keys_container buffered_file_io converter file_io @@ -41,8 +40,6 @@ LIST(APPEND SRC_FILES ${CMAKE_SOURCE_DIR}/plugin/keyring/common/keyring_key.cc ${CMAKE_SOURCE_DIR}/plugin/keyring/common/keys_container.cc ${CMAKE_SOURCE_DIR}/plugin/keyring/common/keys_iterator.cc - ${CMAKE_SOURCE_DIR}/plugin/keyring/common/system_keys_container.cc - ${CMAKE_SOURCE_DIR}/plugin/keyring/common/system_key_adapter.cc ${CMAKE_SOURCE_DIR}/plugin/keyring/common/keyring_impl.cc ${CMAKE_SOURCE_DIR}/plugin/keyring/buffered_file_io.cc ${CMAKE_SOURCE_DIR}/plugin/keyring/converter.cc diff --git a/unittest/gunit/keyring/keyring-api-t.cc b/unittest/gunit/keyring/keyring-api-t.cc index 746363911003..6f87e3a9c02e 100644 --- a/unittest/gunit/keyring/keyring-api-t.cc +++ b/unittest/gunit/keyring/keyring-api-t.cc @@ -245,23 +245,6 @@ TEST_F(Keyring_api_test, StoreTwiceTheSameDifferentTypes) { 1); } -TEST_F(Keyring_api_test, KeyGenerate) { - EXPECT_EQ(mysql_key_generate("Robert_key", "AES", "Robert", 128), 0); - char *key_type; - size_t key_len; - void *key; - EXPECT_EQ(mysql_key_fetch("Robert_key", &key_type, "Robert", &key, &key_len), - 0); - EXPECT_STREQ("AES", key_type); - EXPECT_EQ(key_len, (size_t)128); - // Try accessing the last byte of key - char ch = ((char *)key)[key_len - 1]; - // Just to get rid of unused variable compiler error - (void)ch; - my_free(key); - my_free(key_type); -} - TEST_F(Keyring_api_test, InitWithDifferentKeyringFile) { EXPECT_EQ( mysql_key_store("Robert_key", "AES", "Robert", sample_key_data.c_str(), diff --git a/unittest/gunit/keyring/keys_container-t.cc b/unittest/gunit/keyring/keys_container-t.cc deleted file mode 100644 index 4b1b9d379eda..000000000000 --- a/unittest/gunit/keyring/keys_container-t.cc +++ /dev/null @@ -1,1467 +0,0 @@ -/* Copyright (c) 2016, 2023, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include <gmock/gmock.h> -#include <gtest/gtest.h> -#include <mysql/plugin_keyring.h> -#include <fstream> - -#include "mock_serialized_object.h" -#include "mock_serializer.h" -#include "my_inttypes.h" -#include "plugin/keyring/buffered_file_io.h" -#include "plugin/keyring/common/i_serialized_object.h" -#include "plugin/keyring/common/keys_container.h" -#include "unittest/gunit/keyring/buffered_file_io_10.h" -#include "unittest/gunit/keyring/mock_logger.h" - -namespace keyring__keys_container_unittest { -using namespace keyring; -using ::testing::_; -using ::testing::DoAll; -using ::testing::InSequence; -using ::testing::Return; -using ::testing::SetArgPointee; -using ::testing::StrEq; - -bool check_if_file_exists_and_TAG_is_correct(const char *file_name) { - char tag[4]; - std::fstream file; - - file.open(file_name, std::fstream::in | std::fstream::binary); - if (!file.is_open()) return false; - file.seekg(0, file.end); - if (file.tellg() < (3 + 32)) // tag + sha256 - return false; // File do not contains tag - file.seekg(-(3 + 32), file.end); - if (file.good() == false) return false; - file.read(tag, 3); - size_t chars_read = file.gcount(); - if (file.good() == false || chars_read < 3) return false; - tag[3] = '\0'; - file.close(); - return strcmp(tag, "EOF") == 0; -} - -class Keys_container_test : public ::testing::Test { - public: - Keys_container_test() : file_name("./keyring") {} - - protected: - void SetUp() override { - sample_key_data = "Robi"; - sample_key = new Key("Roberts_key", "AES", "Robert", - sample_key_data.c_str(), sample_key_data.length() + 1); - - remove(file_name.c_str()); - remove("./keyring.backup"); - - logger = new Mock_logger(); - keys_container = new Keys_container(logger); - } - void TearDown() override { - remove(file_name.c_str()); - delete keys_container; - delete logger; - } - void create_keyring_file(const char *file_name, const char *keyring_buffer); - void generate_keyring_file_with_correct_ver_1_0_structure( - const char *file_name); - void generate_keyring_file_with_correct_ver_2_0_structure( - const char *file_name); - void generate_keyring_file_with_incorrect_file_version(const char *file_name); - void generate_keyring_file_with_incorrect_TAG(const char *file_name); - - protected: - Keys_container *keys_container; - ILogger *logger; - Key *sample_key; - std::string sample_key_data; - std::string file_name; -}; - -void Keys_container_test::create_keyring_file(const char *file_name, - const char *keyring_buffer) { - std::fstream file; - file.open(file_name, - std::fstream::out | std::fstream::binary | std::fstream::trunc); - ASSERT_TRUE(file.is_open()); - file.write(keyring_buffer, strlen(keyring_buffer)); - file.close(); -} - -void Keys_container_test::generate_keyring_file_with_correct_ver_1_0_structure( - const char *file_name) { - static const char *keyring_buffer = "Keyring file version:1.0EOF"; - create_keyring_file(file_name, keyring_buffer); -} - -void Keys_container_test::generate_keyring_file_with_correct_ver_2_0_structure( - const char *file_name) { - static const char *keyring_buffer = - "Keyring file version:2.0EOF" - "01234567890123456789012345678901"; - create_keyring_file(file_name, keyring_buffer); -} - -void Keys_container_test::generate_keyring_file_with_incorrect_file_version( - const char *file_name) { - static const char *keyring_buffer = "Keyring file version:3.0EOF"; - create_keyring_file(file_name, keyring_buffer); -} - -void Keys_container_test::generate_keyring_file_with_incorrect_TAG( - const char *file_name) { - static const char *keyring_buffer = "Keyring file version:2.0EF"; - create_keyring_file(file_name, keyring_buffer); -} - -TEST_F(Keys_container_test, InitWithFileWithCorrect_1_0_Struct) { - const char *keyring_correct_struct = "./keyring_correct_1_0_struct"; - remove(keyring_correct_struct); - std::vector<std::string> allowedFileVersionsToInit; - // this keyring will work with keyring files in the following versions: - allowedFileVersionsToInit.push_back(keyring::keyring_file_version_2_0); - allowedFileVersionsToInit.push_back(keyring::keyring_file_version_1_0); - generate_keyring_file_with_correct_ver_1_0_structure(keyring_correct_struct); - IKeyring_io *keyring_io = - new Buffered_file_io(logger, &allowedFileVersionsToInit); - EXPECT_EQ(keys_container->init(keyring_io, keyring_correct_struct), 0); - remove(keyring_correct_struct); - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_test, InitWithFileWithCorrect_2_0_Struct) { - const char *keyring_correct_struct = "./keyring_correct_2_0_struct"; - remove(keyring_correct_struct); - generate_keyring_file_with_correct_ver_2_0_structure(keyring_correct_struct); - Buffered_file_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, keyring_correct_struct), 0); - remove(keyring_correct_struct); - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_test, InitWithFileWithIncorrectKeyringVersion) { - const char *keyring_incorrect_version = "./keyring_incorrect_version"; - remove(keyring_incorrect_version); - generate_keyring_file_with_incorrect_file_version(keyring_incorrect_version); - Buffered_file_io *keyring_io = new Buffered_file_io(logger); - EXPECT_CALL(*((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Incorrect Keyring file"))); - EXPECT_CALL(*((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Error while loading keyring content." - " The keyring might be malformed"))); - EXPECT_EQ(keys_container->init(keyring_io, keyring_incorrect_version), 1); - remove(keyring_incorrect_version); - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_test, InitWithFileWithIncorrectTAG) { - const char *keyring_incorrect_tag = "./keyring_incorrect_tag"; - remove(keyring_incorrect_tag); - generate_keyring_file_with_incorrect_TAG(keyring_incorrect_tag); - Buffered_file_io *keyring_io = new Buffered_file_io(logger); - EXPECT_CALL(*((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Incorrect Keyring file"))); - EXPECT_CALL(*((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Error while loading keyring content. The " - "keyring might be malformed"))); - EXPECT_EQ(keys_container->init(keyring_io, keyring_incorrect_tag), 1); - remove(keyring_incorrect_tag); - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_test, StoreFetchRemove) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - Key key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - IKey *fetched_key = keys_container->fetch_key(&key_id); - - ASSERT_TRUE(fetched_key != nullptr); - std::string expected_key_signature = "Roberts_keyRobert"; - EXPECT_STREQ(fetched_key->get_key_signature()->c_str(), - expected_key_signature.c_str()); - EXPECT_EQ(fetched_key->get_key_signature()->length(), - expected_key_signature.length()); - uchar *key_data_fetched = fetched_key->get_key_data(); - size_t key_data_fetched_size = fetched_key->get_key_data_size(); - EXPECT_STREQ(sample_key_data.c_str(), - reinterpret_cast<const char *>(key_data_fetched)); - EXPECT_STREQ("AES", fetched_key->get_key_type_as_string()->c_str()); - ASSERT_TRUE(sample_key_data.length() + 1 == key_data_fetched_size); - - keys_container->remove_key(&key_id); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - my_free(fetched_key->release_key_data()); -} - -TEST_F(Keys_container_test, FetchNotExisting) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - Key key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - IKey *fetched_key = keys_container->fetch_key(&key_id); - ASSERT_TRUE(fetched_key == nullptr); - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_test, RemoveNotExisting) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - Key key_id("Roberts_key", "AES", "Robert", nullptr, 0); - ASSERT_TRUE(keys_container->remove_key(&key_id) == true); - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_test, StoreFetchNotExisting) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - Key key_id("NotRoberts_key", nullptr, "NotRobert", nullptr, 0); - IKey *fetched_key = keys_container->fetch_key(&key_id); - ASSERT_TRUE(fetched_key == nullptr); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); -} - -TEST_F(Keys_container_test, StoreRemoveNotExisting) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - Key key_id("NotRoberts_key", "AES", "NotRobert", nullptr, 0); - // Failed to remove key - ASSERT_TRUE(keys_container->remove_key(&key_id) == true); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); -} - -TEST_F(Keys_container_test, StoreStoreStoreFetchRemove) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - std::string key_data1("Robi1"); - Key *key1 = new Key("Roberts_key1", "AES", "Robert", key_data1.c_str(), - key_data1.length() + 1); - - EXPECT_EQ(keys_container->store_key(key1), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - - std::string key_data2("Robi2"); - Key *key2 = new Key("Roberts_key2", "AES", "Robert", key_data2.c_str(), - key_data2.length() + 1); - - EXPECT_EQ(keys_container->store_key(key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 3); - - std::string key_data3("Robi3"); - Key *key3 = new Key("Roberts_key3", "AES", "Robert", key_data3.c_str(), - key_data3.length() + 1); - - EXPECT_EQ(keys_container->store_key(key3), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 4); - - Key key2_id("Roberts_key2", nullptr, "Robert", nullptr, 0); - IKey *fetched_key = keys_container->fetch_key(&key2_id); - - ASSERT_TRUE(fetched_key != nullptr); - std::string expected_key_signature = "Roberts_key2Robert"; - EXPECT_STREQ(fetched_key->get_key_signature()->c_str(), - expected_key_signature.c_str()); - EXPECT_EQ(fetched_key->get_key_signature()->length(), - expected_key_signature.length()); - uchar *key_data_fetched = fetched_key->get_key_data(); - size_t key_data_fetched_size = fetched_key->get_key_data_size(); - EXPECT_STREQ(key_data2.c_str(), - reinterpret_cast<const char *>(key_data_fetched)); - ASSERT_TRUE(key_data2.length() + 1 == key_data_fetched_size); - - Key key3_id("Roberts_key3", "AES", "Robert", nullptr, 0); - keys_container->remove_key(&key3_id); - ASSERT_TRUE(keys_container->get_number_of_keys() == 3); - - my_free(fetched_key->release_key_data()); -} - -TEST_F(Keys_container_test, StoreTwiceTheSame) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - EXPECT_EQ(keys_container->store_key(sample_key), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); -} - -class Buffered_file_io_20 : public Buffered_file_io { - public: - Buffered_file_io_20(ILogger *logger) : Buffered_file_io(logger) {} - void set_memory_needed_for_buffer(size_t memory_needed) { - memory_needed_for_buffer = memory_needed; - } -}; - -TEST_F(Keys_container_test, StoreKeyInVer10StoreKeyInVer20FetchKeyInVer20) { - size_t memory_needed_for_buffer; - { - Buffered_file_io_10 keyring_io_10(logger); - EXPECT_EQ(keys_container->init(&keyring_io_10, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - memory_needed_for_buffer = keyring_io_10.get_memory_needed_for_buffer(); - } - Buffered_file_io_20 *keyring_io_20 = new Buffered_file_io_20(logger); - EXPECT_EQ(keyring_io_20->init(&file_name), 0); - keyring_io_20->set_memory_needed_for_buffer(memory_needed_for_buffer); - keys_container->set_keyring_io(keyring_io_20); - - std::string key_data1("Robi1"); - Key key_1_id("Roberts_key1", nullptr, "Robert", nullptr, 0); - Key *key1 = new Key("Roberts_key1", "AES", "Robert", key_data1.c_str(), - key_data1.length() + 1); - EXPECT_EQ(keys_container->store_key(key1), 0); - - Key key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - IKey *fetched_key = keys_container->fetch_key(&key_id); - ASSERT_TRUE(fetched_key != nullptr); - std::string expected_key_signature = "Roberts_keyRobert"; - EXPECT_STREQ(fetched_key->get_key_signature()->c_str(), - expected_key_signature.c_str()); - EXPECT_EQ(fetched_key->get_key_signature()->length(), - expected_key_signature.length()); - uchar *key_data_fetched = fetched_key->get_key_data(); - size_t key_data_fetched_size = fetched_key->get_key_data_size(); - EXPECT_STREQ(sample_key_data.c_str(), - reinterpret_cast<const char *>(key_data_fetched)); - ASSERT_TRUE(sample_key_data.length() + 1 == key_data_fetched_size); - - keys_container->remove_key(&key_id); - - IKey *fetched_key_1 = keys_container->fetch_key(&key_1_id); - ASSERT_TRUE(fetched_key_1 != nullptr); - expected_key_signature = "Roberts_key1Robert"; - EXPECT_STREQ(fetched_key_1->get_key_signature()->c_str(), - expected_key_signature.c_str()); - EXPECT_EQ(fetched_key_1->get_key_signature()->length(), - expected_key_signature.length()); - key_data_fetched = fetched_key_1->get_key_data(); - key_data_fetched_size = fetched_key_1->get_key_data_size(); - EXPECT_STREQ(key_data1.c_str(), - reinterpret_cast<const char *>(key_data_fetched)); - ASSERT_TRUE(key_data1.length() + 1 == key_data_fetched_size); - - keys_container->remove_key(&key_1_id); - - my_free(fetched_key->release_key_data()); - my_free(fetched_key_1->release_key_data()); -} - -TEST_F(Keys_container_test, - CheckIfKeyIsNotDumpedIntoKeyringFileIfKeyringFileDoesnotExist) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - remove("./keyring"); - std::string key_data1("Robi1"); - Key *key1 = new Key("Roberts_key1", "AES", "Robert", key_data1.c_str(), - key_data1.length() + 1); - EXPECT_CALL( - *((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring's backup"))); - // it should not be possible to store_key if the keyring file does not exist - EXPECT_EQ(keys_container->store_key(key1), 1); - delete key1; - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), 0); -} - -TEST_F(Keys_container_test, - CheckIfKeyIsNotDumpedIntoKeyringFileIfKeyringFileHasInvalidDigest) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - - std::fstream keyring_file("./keyring"); - ASSERT_TRUE(keyring_file.is_open()); - keyring_file.seekp(-3, std::ios_base::end); - keyring_file.write("a", 1); // changed digest - keyring_file.close(); - EXPECT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring")); - - std::string key_data1("Robi1"); - Key *key1 = new Key("Roberts_key1", "AES", "Robert", key_data1.c_str(), - key_data1.length() + 1); - EXPECT_CALL( - *((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring's backup"))); - EXPECT_CALL(*((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Incorrect Keyring file"))); - - // it should not be possible to store_key if the keyring file was changed - EXPECT_EQ(keys_container->store_key(key1), 1); - delete key1; - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); -} - -class Buffered_file_io_dont_remove_backup : public Buffered_file_io { - public: - Buffered_file_io_dont_remove_backup(ILogger *logger) - : Buffered_file_io(logger) {} - - bool remove_backup(myf) { return false; } -}; - -class Keys_container_test_dont_close : public ::testing::Test { - public: - Keys_container_test_dont_close() : file_name("./keyring") {} - - protected: - void SetUp() override { - sample_key_data = "Robi"; - sample_key = new Key("Roberts_key", "AES", "Robert", - sample_key_data.c_str(), sample_key_data.length() + 1); - std::string sample_key_data2 = "xobi2"; - sample_key2 = - new Key("Roberts_key2", "AES", "Robert", sample_key_data2.c_str(), - sample_key_data2.length() + 1); - - // Remove Keyring files just to be save - remove(file_name.c_str()); - remove("./keyring.backup"); - remove("./keyring.backup.backup"); - } - void TearDown() override { remove(file_name.c_str()); } - void generate_malformed_keyring_file_without_tag(const char *file_name); - - protected: - Key *sample_key; - Key *sample_key2; - std::string sample_key_data; - std::string file_name; -}; - -void Keys_container_test_dont_close:: - generate_malformed_keyring_file_without_tag(const char *file_name) { - static const char *malformed_keyring_buffer = - "Key1AESRobertKEYDATA" - "Key2AESZibiDATAKey3DATA...crashing"; - - std::fstream file; - file.open(file_name, - std::fstream::out | std::fstream::binary | std::fstream::trunc); - ASSERT_TRUE(file.is_open()); - file.write(malformed_keyring_buffer, strlen(malformed_keyring_buffer)); - file.close(); -} - -TEST_F(Keys_container_test_dont_close, - CheckIfCorrectBackupFileIsCreatedAfterStoringOneKey) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io_dont_remove_backup = - new Buffered_file_io_dont_remove_backup(logger); - Keys_container *keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io_dont_remove_backup, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), true); - - // Check if backup file is empty - delete keys_container; - delete logger; - logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io(logger); - keys_container = new Keys_container(logger); - ASSERT_TRUE(keys_container->init(keyring_io, "./keyring.backup") == 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - - remove("./keyring.backup"); - remove("./keyring.backup.backup"); // leftover from initializing keyring with - // backup file - remove(file_name.c_str()); - delete keys_container; - delete logger; - delete sample_key2; // unused in this test -} - -TEST_F(Keys_container_test_dont_close, - CheckIfCorrectBackupFileIsCreatedAfterStoringTwoKeys) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io(logger); - Keys_container *keys_container = new Keys_container(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - // successfully stored the key - backup file does not exist - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - delete keys_container; - delete logger; - - logger = new Mock_logger(); - IKeyring_io *keyring_io_dont_remove_backup = - new Buffered_file_io_dont_remove_backup(logger); - keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io_dont_remove_backup, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), true); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); - - delete keys_container; - delete logger; - // Check that backup file contains sample_key only - logger = new Mock_logger(); - IKeyring_io *keyring_io_2 = new Buffered_file_io(logger); - keys_container = new Keys_container(logger); - EXPECT_EQ(keys_container->init(keyring_io_2, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - Key sample_key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - IKey *fetchedKey = keys_container->fetch_key(&sample_key_id); - ASSERT_TRUE(fetchedKey != nullptr); - - ASSERT_TRUE(*fetchedKey->get_key_signature() == "Roberts_keyRobert"); - ASSERT_TRUE(memcmp(fetchedKey->get_key_data(), "Robi", - fetchedKey->get_key_data_size()) == 0); - - remove("./keyring.backup"); - remove("./keyring.backup.backup"); // leftover from initializing keyring with - // backup file - remove(file_name.c_str()); - delete keys_container; - delete logger; - my_free(fetchedKey->release_key_data()); -} - -TEST_F(Keys_container_test_dont_close, - CheckIfCorrectBackupFileIsCreatedBeforeRemovingKey) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io(logger); - Keys_container *keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - // successfully stored the key - backup file does not exist - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - EXPECT_EQ(keys_container->store_key(sample_key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - - delete keys_container; - delete logger; - logger = new Mock_logger(); - IKeyring_io *keyring_io_dont_remove_backup = - new Buffered_file_io_dont_remove_backup(logger); - keys_container = new Keys_container(logger); - - ASSERT_TRUE(keys_container->init(keyring_io_dont_remove_backup, file_name) == - 0); - Key sample_key_id("Roberts_key", "AES", "Robert", nullptr, 0); - EXPECT_EQ(keys_container->remove_key(&sample_key_id), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), true); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); - - delete keys_container; - delete logger; - // Check that backup file contains sample_key and sample_key2 - logger = new Mock_logger(); - IKeyring_io *keyring_io_2 = new Buffered_file_io(logger); - keys_container = new Keys_container(logger); - EXPECT_EQ(keys_container->init(keyring_io_2, "./keyring.backup"), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - Key sample_key2_id("Roberts_key2", nullptr, "Robert", nullptr, 0); - IKey *fetchedKey = keys_container->fetch_key(&sample_key2_id); - ASSERT_TRUE(fetchedKey != nullptr); - ASSERT_TRUE(*fetchedKey->get_key_signature() == "Roberts_key2Robert"); - ASSERT_TRUE(memcmp(fetchedKey->get_key_data(), "xobi2", - fetchedKey->get_key_data_size()) == 0); - - remove("./keyring.backup"); - remove("./keyring.backup.backup"); // leftover from initializing keyring with - // backup file - remove(file_name.c_str()); - delete keys_container; - delete logger; - my_free(fetchedKey->release_key_data()); -} - -TEST_F(Keys_container_test_dont_close, - CheckIfBackupFileIsNotCreatedForFetching) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io(logger); - Keys_container *keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - // successfully stored the key - backup file does not exist - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - EXPECT_EQ(keys_container->store_key(sample_key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - - delete keys_container; - delete logger; - logger = new Mock_logger(); - IKeyring_io *keyring_io_dont_remove_backup = - new Buffered_file_io_dont_remove_backup(logger); - keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io_dont_remove_backup, file_name), 0); - Key sample_key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - IKey *fetchedKey = keys_container->fetch_key(&sample_key_id); - ASSERT_TRUE(fetchedKey != nullptr); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - // check if the backup file was not created - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); - - remove("./keyring.backup"); - remove(file_name.c_str()); - delete keys_container; - delete logger; - my_free(fetchedKey->release_key_data()); -} - -TEST_F(Keys_container_test_dont_close, - KeyringfileIsMalformedCheckIfBackupIsLoaded) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io(logger); - Keys_container *keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - // successfully stored the key - backup file does not exist - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - EXPECT_EQ(keys_container->store_key(sample_key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - // Now we have correct backup file - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - - delete keys_container; - delete logger; - logger = new Mock_logger(); - IKeyring_io *keyring_io_dont_remove_backup = - new Buffered_file_io_dont_remove_backup(logger); - keys_container = new Keys_container(logger); - - // this key will not be in backup file thus we do not care about it - Key *sample_key3 = - new Key("Roberts_key3", "ZZZZ", "MaybeRobert", "DATA", strlen("DATA")); - - EXPECT_EQ(keys_container->init(keyring_io_dont_remove_backup, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key3), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 3); - // Now we have correct backup file - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), true); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - - delete keys_container; - delete logger; - remove("./keyring"); - generate_malformed_keyring_file_without_tag("./keyring"); - logger = new Mock_logger(); - IKeyring_io *keyring_io_2 = new Buffered_file_io(logger); - keys_container = new Keys_container(logger); - - ASSERT_TRUE(keys_container->init(keyring_io_2, file_name) == 0); - // Check that keyring from backup was loaded as the keyring file is corrupted - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - Key sample_key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - Key sample_key2_id("Roberts_key2", nullptr, "Robert", nullptr, 0); - IKey *fetchedKey = keys_container->fetch_key(&sample_key2_id); - ASSERT_TRUE(fetchedKey != nullptr); - ASSERT_TRUE(*fetchedKey->get_key_signature() == "Roberts_key2Robert"); - ASSERT_TRUE(memcmp(fetchedKey->get_key_data(), "xobi2", - fetchedKey->get_key_data_size()) == 0); - IKey *fetchedKey2 = keys_container->fetch_key(&sample_key_id); - ASSERT_TRUE(fetchedKey2 != nullptr); - ASSERT_TRUE(*fetchedKey2->get_key_signature() == "Roberts_keyRobert"); - ASSERT_TRUE(memcmp(fetchedKey2->get_key_data(), "Robi", - fetchedKey2->get_key_data_size()) == 0); - - // check if the backup file was removed - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); - - remove("./keyring.backup"); - remove(file_name.c_str()); - delete keys_container; - delete logger; - my_free(fetchedKey->release_key_data()); - my_free(fetchedKey2->release_key_data()); -} - -TEST_F(Keys_container_test_dont_close, - BackupfileIsMalformedCheckItIsIgnoredAndDeleted) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io(logger); - Keys_container *keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - // successfully stored the key - backup file does not exist - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - EXPECT_EQ(keys_container->store_key(sample_key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - - delete keys_container; - delete logger; - generate_malformed_keyring_file_without_tag("./keyring.backup"); - logger = new Mock_logger(); - IKeyring_io *keyring_io_2 = new Buffered_file_io(logger); - keys_container = new Keys_container(logger); - - // Check that backup file was ignored (as backup file is malformed) - EXPECT_CALL(*((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Incorrect Keyring file"))); - EXPECT_CALL(*((Mock_logger *)logger), - log(WARNING_LEVEL, - StrEq("Found malformed keyring backup file - removing it"))); - EXPECT_EQ(keys_container->init(keyring_io_2, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - Key sample_key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - Key sample_key2_id("Roberts_key2", nullptr, "Robert", nullptr, 0); - IKey *fetchedKey = keys_container->fetch_key(&sample_key2_id); - ASSERT_TRUE(fetchedKey != nullptr); - ASSERT_TRUE(*fetchedKey->get_key_signature() == "Roberts_key2Robert"); - ASSERT_TRUE(memcmp(fetchedKey->get_key_data(), "xobi2", - fetchedKey->get_key_data_size()) == 0); - IKey *fetchedKey2 = keys_container->fetch_key(&sample_key_id); - ASSERT_TRUE(fetchedKey2 != nullptr); - ASSERT_TRUE(*fetchedKey2->get_key_signature() == "Roberts_keyRobert"); - ASSERT_TRUE(memcmp(fetchedKey2->get_key_data(), "Robi", - fetchedKey2->get_key_data_size()) == 0); - - // check if the backup file was removed - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); - - delete keys_container; - delete logger; - my_free(fetchedKey->release_key_data()); - my_free(fetchedKey2->release_key_data()); -} - -TEST_F( - Keys_container_test_dont_close, - CheckIfBackupIsCreatedAfterEachOperationAndIsUsedWhenKeyringDoesNotExist) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io_dont_remove_backup(logger); - Keys_container *keys_container = new Keys_container(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), true); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - - remove("./keyring.backup"); - rename("keyring", "keyring.backup"); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == false); - // Now keyring file should be recreated based on keyring.backup - delete keys_container; - keyring_io = new Buffered_file_io_dont_remove_backup(logger); - keys_container = new Keys_container(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - EXPECT_EQ(keys_container->store_key(sample_key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), true); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); - - Key sample_key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - IKey *fetchedKey = keys_container->fetch_key(&sample_key_id); - ASSERT_TRUE(fetchedKey != nullptr); - - ASSERT_TRUE(*fetchedKey->get_key_signature() == "Roberts_keyRobert"); - ASSERT_TRUE(memcmp(fetchedKey->get_key_data(), "Robi", - fetchedKey->get_key_data_size()) == 0); - - remove("./keyring.backup"); - remove(file_name.c_str()); - delete keys_container; - delete logger; - my_free(fetchedKey->release_key_data()); - // fetchedKey->release_key_data(); -} - -class Mock_keyring_io : public IKeyring_io { - public: - MOCK_METHOD1(init, bool(const std::string *keyring_filename)); - MOCK_METHOD1(flush_to_backup, bool(ISerialized_object *serialized_object)); - MOCK_METHOD1(flush_to_storage, bool(ISerialized_object *serialized_object)); - MOCK_METHOD0(get_serializer, ISerializer *()); - MOCK_METHOD1(get_serialized_object, - bool(ISerialized_object **serialized_object)); - MOCK_METHOD0(has_next_serialized_object, bool()); -}; - -class Keys_container_with_mocked_io_test : public ::testing::Test { - protected: - void SetUp() override { - std::string sample_key_data("Robi"); - sample_key = new Key("Roberts_key", "AES", "Robert", - sample_key_data.c_str(), sample_key_data.length() + 1); - - file_name = "/home/rob/write_key"; - } - void TearDown() override { - remove(file_name.c_str()); - delete keys_container; - } - - protected: - Keys_container *keys_container; - Mock_keyring_io *keyring_io; - Key *sample_key; - char *sample_key_data; - std::string file_name; - - void expect_calls_on_init(); - void expect_calls_on_store_sample_key(); -}; - -void Keys_container_with_mocked_io_test::expect_calls_on_init() { - Mock_serialized_object *mock_serialized_object = new Mock_serialized_object; - - EXPECT_CALL(*keyring_io, init(Pointee(StrEq(file_name)))) - .WillOnce(Return(0)); // init successful - EXPECT_CALL(*keyring_io, get_serialized_object(_)) - .WillOnce(DoAll(SetArgPointee<0>(mock_serialized_object), Return(false))); - EXPECT_CALL(*mock_serialized_object, has_next_key()) - .WillOnce(Return(false)); // no keys to read - EXPECT_CALL(*keyring_io, has_next_serialized_object()) - .WillOnce(Return(false)); -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromIODuringInitOnGettingSerializedObject) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - - EXPECT_CALL(*keyring_io, init(Pointee(StrEq(file_name)))) - .WillOnce(Return(0)); // init successful - EXPECT_CALL(*keyring_io, get_serialized_object(_)).WillOnce(Return(true)); - EXPECT_CALL(*logger, - log(ERROR_LEVEL, StrEq("Error while loading keyring content. The " - "keyring might be malformed"))); - - EXPECT_EQ(keys_container->init(keyring_io, file_name), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - delete logger; - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromIODuringInitInvalidKeyAndMockedSerializedObject) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - - IKey *invalid_key = new Key(); - std::string invalid_key_type("ZZZ"); - invalid_key->set_key_type(&invalid_key_type); - - Mock_serialized_object *mock_serialized_object = new Mock_serialized_object; - - EXPECT_CALL(*keyring_io, init(Pointee(StrEq(file_name)))) - .WillOnce(Return(0)); // init successful - { - InSequence dummy; - EXPECT_CALL(*keyring_io, get_serialized_object(_)) - .WillOnce( - DoAll(SetArgPointee<0>(mock_serialized_object), Return(false))); - EXPECT_CALL(*mock_serialized_object, has_next_key()).WillOnce(Return(true)); - EXPECT_CALL(*mock_serialized_object, get_next_key(_)) - .WillOnce(DoAll(SetArgPointee<0>(sample_key), Return(false))); - EXPECT_CALL(*mock_serialized_object, has_next_key()).WillOnce(Return(true)); - EXPECT_CALL(*mock_serialized_object, get_next_key(_)) - .WillOnce(DoAll(SetArgPointee<0>(invalid_key), Return(false))); - - EXPECT_CALL(*logger, - log(ERROR_LEVEL, StrEq("Error while loading keyring content. " - "The keyring might be malformed"))); - } - - EXPECT_EQ(keys_container->init(keyring_io, file_name), 1); - ASSERT_EQ(0u, keys_container->get_number_of_keys()); - delete logger; -} - -TEST_F(Keys_container_with_mocked_io_test, ErrorFromIODuringInitInvalidKey) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - - IKey *invalid_key = new Key(); - std::string invalid_key_type("ZZZ"); - invalid_key->set_key_type(&invalid_key_type); - - Buffer *buffer = new Buffer(sample_key->get_key_pod_size() + - invalid_key->get_key_pod_size()); - sample_key->store_in_buffer(buffer->data, &(buffer->position)); - invalid_key->store_in_buffer(buffer->data, &(buffer->position)); - buffer->position = 0; // rewind buffer - - EXPECT_CALL(*keyring_io, init(Pointee(StrEq(file_name)))) - .WillOnce(Return(0)); // init successful - { - InSequence dummy; - EXPECT_CALL(*keyring_io, get_serialized_object(_)) - .WillOnce(DoAll(SetArgPointee<0>(buffer), Return(false))); - EXPECT_CALL(*logger, - log(ERROR_LEVEL, StrEq("Error while loading keyring content. " - "The keyring might be malformed"))); - } - EXPECT_EQ(keys_container->init(keyring_io, file_name), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - delete logger; - delete invalid_key; - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromSerializerOnFlushToBackupWhenStoringKey) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - { - InSequence dummy; - - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return((ISerialized_object *)nullptr)); - EXPECT_CALL( - *logger, - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring's backup"))); - } - EXPECT_EQ(keys_container->store_key(sample_key), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - - delete logger; - delete sample_key; - delete mock_serializer; -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromSerializerOnFlushToKeyringWhenStoringKey) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - ISerialized_object *empty_serialized_object = new Buffer; - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_backup(empty_serialized_object)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, STORE_KEY)) - .WillOnce(Return((ISerialized_object *)nullptr)); - EXPECT_CALL(*logger, - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring"))); - } - EXPECT_EQ(keys_container->store_key(sample_key), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - - delete logger; - delete sample_key; - delete mock_serializer; -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromSerializerOnFlushToBackupWhenRemovingKey) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - ISerialized_object *empty_serialized_object = new Buffer; - Buffer *serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_backup(empty_serialized_object)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key)); - } - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - { - InSequence dummy; - - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return((ISerialized_object *)nullptr)); - EXPECT_CALL( - *logger, - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring's backup"))); - } - EXPECT_EQ(keys_container->remove_key(sample_key), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - delete logger; - delete mock_serializer; -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromSerializerOnFlushToKeyringWhenRemovingKey) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - ISerialized_object *empty_serialized_object = new Buffer; - Buffer *serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_backup(empty_serialized_object)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key)); - } - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_backup(serialized_object_with_sample_key)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, REMOVE_KEY)) - .WillOnce(Return((ISerialized_object *)nullptr)); - EXPECT_CALL(*logger, - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring"))); - } - - EXPECT_EQ(keys_container->remove_key(sample_key), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - delete logger; - delete mock_serializer; -} - -TEST_F(Keys_container_with_mocked_io_test, StoreAndRemoveKey) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - ISerialized_object *empty_serialized_object = new Buffer; - Buffer *serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_backup(empty_serialized_object)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key)); - } - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - // recreate serialized objects - empty_serialized_object = new Buffer; - - serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_backup(serialized_object_with_sample_key)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, REMOVE_KEY)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_storage(empty_serialized_object)); - } - - EXPECT_EQ(keys_container->remove_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - - delete logger; - delete mock_serializer; -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromIOWhileRemovingKeyAfterAdding2Keys) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - ISerialized_object *empty_serialized_object = new Buffer; - Buffer *serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_backup(empty_serialized_object)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key)); - } - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - std::string key_data2("Robi2"); - Key *key2 = new Key("Roberts_key2", "AES", "Robert", key_data2.c_str(), - key_data2.length() + 1); - - serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - Buffer *serialized_object_with_sample_key_and_key2 = - new Buffer(sample_key->get_key_pod_size() + key2->get_key_pod_size()); - sample_key->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - key2->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - serialized_object_with_sample_key_and_key2->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_backup(serialized_object_with_sample_key)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, key2, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key_and_key2)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key_and_key2)); - } - EXPECT_EQ(keys_container->store_key(key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - - serialized_object_with_sample_key_and_key2 = - new Buffer(sample_key->get_key_pod_size() + key2->get_key_pod_size()); - sample_key->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - key2->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - serialized_object_with_sample_key_and_key2->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_sample_key_and_key2)); - EXPECT_CALL(*keyring_io, - flush_to_backup(serialized_object_with_sample_key_and_key2)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, REMOVE_KEY)) - .WillOnce(Return((ISerialized_object *)nullptr)); - EXPECT_CALL(*logger, - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring"))); - } - - EXPECT_EQ(keys_container->remove_key(sample_key), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - - delete logger; - delete mock_serializer; -} - -TEST_F(Keys_container_with_mocked_io_test, Store2KeysAndRemoveThem) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - ISerialized_object *empty_serialized_object = new Buffer; - Buffer *serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_backup(empty_serialized_object)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key)); - } - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - std::string key_data2("Robi2"); - Key *key2 = new Key("Roberts_key2", "AES", "Robert", key_data2.c_str(), - key_data2.length() + 1); - - serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - Buffer *serialized_object_with_sample_key_and_key2 = - new Buffer(sample_key->get_key_pod_size() + key2->get_key_pod_size()); - sample_key->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - key2->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - serialized_object_with_sample_key_and_key2->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_backup(serialized_object_with_sample_key)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, key2, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key_and_key2)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key_and_key2)); - } - EXPECT_EQ(keys_container->store_key(key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - - serialized_object_with_sample_key_and_key2 = - new Buffer(sample_key->get_key_pod_size() + key2->get_key_pod_size()); - sample_key->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - key2->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - serialized_object_with_sample_key_and_key2->position = 0; // rewind buffer - - Buffer *serialized_object_with_key2 = new Buffer(key2->get_key_pod_size()); - key2->store_in_buffer(serialized_object_with_key2->data, - &(serialized_object_with_key2->position)); - serialized_object_with_key2->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_sample_key_and_key2)); - EXPECT_CALL(*keyring_io, - flush_to_backup(serialized_object_with_sample_key_and_key2)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, REMOVE_KEY)) - .WillOnce(Return(serialized_object_with_key2)); - EXPECT_CALL(*keyring_io, flush_to_storage(serialized_object_with_key2)); - } - - EXPECT_EQ(keys_container->remove_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - serialized_object_with_key2 = new Buffer(key2->get_key_pod_size()); - key2->store_in_buffer(serialized_object_with_key2->data, - &(serialized_object_with_key2->position)); - serialized_object_with_key2->position = 0; // rewind buffer - - empty_serialized_object = new Buffer; - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_key2)); - EXPECT_CALL(*keyring_io, flush_to_backup(serialized_object_with_key2)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, key2, REMOVE_KEY)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_storage(empty_serialized_object)); - } - - EXPECT_EQ(keys_container->remove_key(key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - - delete logger; - delete mock_serializer; -} - -} // namespace keyring__keys_container_unittest