diff --git a/mysql-test/suite/innodb/r/innodb-page_encryption.result b/mysql-test/suite/innodb/r/innodb-page_encryption.result index c94150e5153..458fcc6c9d0 100644 --- a/mysql-test/suite/innodb/r/innodb-page_encryption.result +++ b/mysql-test/suite/innodb/r/innodb-page_encryption.result @@ -7,7 +7,7 @@ create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_f ERROR HY000: Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options") create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encryption='ON' encryption_key_id=33; create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encryption='ON' encryption_key_id=4; -SET GLOBAL innodb_default_encryption_key = 5; +set innodb_default_encryption_key_id = 5; create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encryption='ON'; show create table innodb_defkey; Table Create Table diff --git a/mysql-test/suite/innodb/t/innodb-page_encryption.test b/mysql-test/suite/innodb/t/innodb-page_encryption.test index 6832b2922d0..d2fa14e3761 100644 --- a/mysql-test/suite/innodb/t/innodb-page_encryption.test +++ b/mysql-test/suite/innodb/t/innodb-page_encryption.test @@ -4,7 +4,6 @@ --disable_query_log let $innodb_file_format_orig = `SELECT @@innodb_file_format`; let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; -let $default_encryption_key = `SELECT @@innodb_default_encryption_key`; --enable_query_log SET GLOBAL innodb_file_format = `Barracuda`; @@ -18,7 +17,7 @@ create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_f create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encryption='ON' encryption_key_id=33; create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encryption='ON' encryption_key_id=4; -SET GLOBAL innodb_default_encryption_key = 5; +set innodb_default_encryption_key_id = 5; create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encryption='ON'; show create table innodb_defkey; @@ -162,5 +161,4 @@ drop table innodb_defkey; --disable_query_log EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; -EVAL SET GLOBAL innodb_default_encryption_key = $default_encryption_key; --enable_query_log diff --git a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result index 8a8d8741236..5bd55dc8133 100644 --- a/mysql-test/suite/sys_vars/r/all_vars.result +++ b/mysql-test/suite/sys_vars/r/all_vars.result @@ -10,7 +10,7 @@ there should be *no* long test name listed below: select distinct variable_name as `there should be *no* variables listed below:` from t2 left join t1 on variable_name=test_name where test_name is null; there should be *no* variables listed below: -innodb_default_encryption_key +innodb_default_encryption_key_id strict_password_validation drop table t1; drop table t2; diff --git a/mysql-test/suite/sys_vars/r/innodb_default_page_encryption_key_basic.result b/mysql-test/suite/sys_vars/r/innodb_default_page_encryption_key_basic.result deleted file mode 100644 index b18a9301483..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_default_page_encryption_key_basic.result +++ /dev/null @@ -1,71 +0,0 @@ -SET @start_global_value = @@global.innodb_default_encryption_key; -SELECT @start_global_value; -@start_global_value -1 -Valid value 0-9 -select @@global.innodb_default_encryption_key <= 9; -@@global.innodb_default_encryption_key <= 9 -1 -select @@global.innodb_default_encryption_key; -@@global.innodb_default_encryption_key -1 -select @@session.innodb_default_encryption_key; -ERROR HY000: Variable 'innodb_default_encryption_key' is a GLOBAL variable -show global variables like 'innodb_default_encryption_key'; -Variable_name Value -innodb_default_encryption_key 1 -show session variables like 'innodb_default_encryption_key'; -Variable_name Value -innodb_default_encryption_key 1 -select * from information_schema.global_variables where variable_name='innodb_default_encryption_key'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_DEFAULT_ENCRYPTION_KEY 1 -select * from information_schema.session_variables where variable_name='innodb_default_encryption_key'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_DEFAULT_ENCRYPTION_KEY 1 -set global innodb_default_encryption_key=2; -select @@global.innodb_default_encryption_key; -@@global.innodb_default_encryption_key -2 -select * from information_schema.global_variables where variable_name='innodb_default_encryption_key'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_DEFAULT_ENCRYPTION_KEY 2 -select * from information_schema.session_variables where variable_name='innodb_default_encryption_key'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_DEFAULT_ENCRYPTION_KEY 2 -set session innodb_default_encryption_key=4; -ERROR HY000: Variable 'innodb_default_encryption_key' is a GLOBAL variable and should be set with SET GLOBAL -set global innodb_default_encryption_key=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_default_encryption_key' -set global innodb_default_encryption_key=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_default_encryption_key' -set global innodb_default_encryption_key="foo"; -ERROR 42000: Incorrect argument type to variable 'innodb_default_encryption_key' -set global innodb_default_encryption_key=10; -select @@global.innodb_default_encryption_key; -@@global.innodb_default_encryption_key -10 -select * from information_schema.global_variables where variable_name='innodb_default_encryption_key'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_DEFAULT_ENCRYPTION_KEY 10 -set global innodb_default_encryption_key=-7; -Warnings: -Warning 1292 Truncated incorrect innodb_default_encryption_key value: '-7' -select @@global.innodb_default_encryption_key; -@@global.innodb_default_encryption_key -1 -select * from information_schema.global_variables where variable_name='innodb_default_encryption_key'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_DEFAULT_ENCRYPTION_KEY 1 -set global innodb_default_encryption_key=1; -select @@global.innodb_default_encryption_key; -@@global.innodb_default_encryption_key -1 -set global innodb_default_encryption_key=255; -select @@global.innodb_default_encryption_key; -@@global.innodb_default_encryption_key -255 -SET @@global.innodb_default_encryption_key = @start_global_value; -SELECT @@global.innodb_default_encryption_key; -@@global.innodb_default_encryption_key -1 diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 250fcca0800..a3506b342b7 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -579,12 +579,12 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED -VARIABLE_NAME INNODB_DEFAULT_ENCRYPTION_KEY -SESSION_VALUE NULL +VARIABLE_NAME INNODB_DEFAULT_ENCRYPTION_KEY_ID +SESSION_VALUE 1 GLOBAL_VALUE 1 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 -VARIABLE_SCOPE GLOBAL +VARIABLE_SCOPE SESSION VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Default encryption key id used for table encryption. NUMERIC_MIN_VALUE 1 diff --git a/mysql-test/suite/sys_vars/t/innodb_default_page_encryption_key_basic.test b/mysql-test/suite/sys_vars/t/innodb_default_page_encryption_key_basic.test deleted file mode 100644 index b93ca26ba01..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_default_page_encryption_key_basic.test +++ /dev/null @@ -1,60 +0,0 @@ - ---source include/have_innodb.inc - -SET @start_global_value = @@global.innodb_default_encryption_key; -SELECT @start_global_value; - -# -# exists as global only -# ---echo Valid value 0-9 -select @@global.innodb_default_encryption_key <= 9; -select @@global.innodb_default_encryption_key; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.innodb_default_encryption_key; -show global variables like 'innodb_default_encryption_key'; -show session variables like 'innodb_default_encryption_key'; -select * from information_schema.global_variables where variable_name='innodb_default_encryption_key'; -select * from information_schema.session_variables where variable_name='innodb_default_encryption_key'; - -# -# show that it's writable -# -set global innodb_default_encryption_key=2; -select @@global.innodb_default_encryption_key; -select * from information_schema.global_variables where variable_name='innodb_default_encryption_key'; -select * from information_schema.session_variables where variable_name='innodb_default_encryption_key'; ---error ER_GLOBAL_VARIABLE -set session innodb_default_encryption_key=4; - -# -# incorrect types -# ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_default_encryption_key=1.1; ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_default_encryption_key=1e1; ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_default_encryption_key="foo"; - -set global innodb_default_encryption_key=10; -select @@global.innodb_default_encryption_key; -select * from information_schema.global_variables where variable_name='innodb_default_encryption_key'; -set global innodb_default_encryption_key=-7; -select @@global.innodb_default_encryption_key; -select * from information_schema.global_variables where variable_name='innodb_default_encryption_key'; - -# -# min/max values -# -set global innodb_default_encryption_key=1; -select @@global.innodb_default_encryption_key; -set global innodb_default_encryption_key=255; -select @@global.innodb_default_encryption_key; - -# -# cleanup -# - -SET @@global.innodb_default_encryption_key = @start_global_value; -SELECT @@global.innodb_default_encryption_key; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 7b5b6ef609b..65ee7b1c65a 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -548,11 +548,9 @@ ib_cb_t innodb_api_cb[] = { (ib_cb_t) ib_cursor_stmt_begin }; -static MYSQL_SYSVAR_UINT(default_encryption_key, srv_default_encryption_key, - PLUGIN_VAR_RQCMDARG, +static MYSQL_THDVAR_UINT(default_encryption_key_id, PLUGIN_VAR_RQCMDARG, "Default encryption key id used for table encryption.", - NULL, - NULL, + NULL, NULL, FIL_DEFAULT_ENCRYPTION_KEY, 1, UINT_MAX32, 0); /** @@ -576,7 +574,7 @@ ha_create_table_option innodb_table_option_list[]= /* With this option the user can enable encryption for the table */ HA_TOPTION_ENUM("ENCRYPTION", encryption, "DEFAULT,ON,OFF", 0), /* With this option the user defines the key identifier using for the encryption */ - HA_TOPTION_SYSVAR("ENCRYPTION_KEY_ID", encryption_key_id, default_encryption_key), + HA_TOPTION_SYSVAR("ENCRYPTION_KEY_ID", encryption_key_id, default_encryption_key_id), HA_TOPTION_END }; @@ -19417,8 +19415,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(scrub_log), MYSQL_SYSVAR(scrub_log_speed), MYSQL_SYSVAR(encrypt_log), - MYSQL_SYSVAR(default_encryption_key), - + MYSQL_SYSVAR(default_encryption_key_id), /* Scrubing feature */ MYSQL_SYSVAR(immediate_scrub_data_uncompressed), MYSQL_SYSVAR(background_scrub_data_uncompressed), diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 11e648efc85..7039349ad68 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -560,9 +560,6 @@ that semaphore times out in InnoDB */ #define DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT 600 extern ulong srv_fatal_semaphore_wait_threshold; -/** Default encryption key used for tablespace encryption */ -extern uint srv_default_encryption_key; - /** Enable semaphore request instrumentation */ extern my_bool srv_instrument_semaphores; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index c19da5dfd91..17470855fc4 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -523,9 +523,6 @@ thread ensures that we flush the log files at least once per second. */ static time_t srv_last_log_flush_time; -/** Default encryption key used for tablespace encryption */ -UNIV_INTERN uint srv_default_encryption_key = FIL_DEFAULT_ENCRYPTION_KEY; - /** Enable semaphore request instrumentation */ UNIV_INTERN my_bool srv_instrument_semaphores = FALSE; diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 26d2dca5699..fa9d8bc073f 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -613,11 +613,9 @@ ib_cb_t innodb_api_cb[] = { (ib_cb_t) ib_cursor_stmt_begin }; -static MYSQL_SYSVAR_UINT(default_encryption_key, srv_default_encryption_key, - PLUGIN_VAR_RQCMDARG, +static MYSQL_THDVAR_UINT(default_encryption_key_id, PLUGIN_VAR_RQCMDARG, "Default encryption key id used for table encryption.", - NULL, - NULL, + NULL, NULL, FIL_DEFAULT_ENCRYPTION_KEY, 1, UINT_MAX32, 0); /** @@ -641,7 +639,7 @@ ha_create_table_option innodb_table_option_list[]= /* With this option the user can enable encryption for the table */ HA_TOPTION_ENUM("ENCRYPTION", encryption, "DEFAULT,ON,OFF", 0), /* With this option the user defines the key identifier using for the encryption */ - HA_TOPTION_SYSVAR("ENCRYPTION_KEY_ID", encryption_key_id, default_encryption_key), + HA_TOPTION_SYSVAR("ENCRYPTION_KEY_ID", encryption_key_id, default_encryption_key_id), HA_TOPTION_END }; @@ -20638,7 +20636,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(scrub_log), MYSQL_SYSVAR(scrub_log_speed), MYSQL_SYSVAR(encrypt_log), - MYSQL_SYSVAR(default_encryption_key), + MYSQL_SYSVAR(default_encryption_key_id), /* Scrubing feature */ MYSQL_SYSVAR(immediate_scrub_data_uncompressed), MYSQL_SYSVAR(background_scrub_data_uncompressed), diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index 1ff9a823819..10d0cc961f7 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -703,9 +703,6 @@ that semaphore times out in InnoDB */ #define DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT 600 extern ulong srv_fatal_semaphore_wait_threshold; -/** Default encryption key used for tablespace encryption */ -extern uint srv_default_encryption_key; - /** Enable semaphore request instrumentation */ extern my_bool srv_instrument_semaphores; diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index 0391cd9eecb..ab05605114b 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -670,9 +670,6 @@ thread ensures that we flush the log files at least once per second. */ static time_t srv_last_log_flush_time; -/** Default encryption key used for tablespace encryption */ -UNIV_INTERN uint srv_default_encryption_key = FIL_DEFAULT_ENCRYPTION_KEY; - /** Enable semaphore request instrumentation */ UNIV_INTERN my_bool srv_instrument_semaphores = FALSE;