Skip to content

Commit ea764f5

Browse files
committed
s/innodb_default_encryption_key/innodb_default_encryption_key_id/
and make it a session variable, not global, as any decent default sysvar for a table attribute should be
1 parent 92ff523 commit ea764f5

File tree

12 files changed

+14
-164
lines changed

12 files changed

+14
-164
lines changed

mysql-test/suite/innodb/r/innodb-page_encryption.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_f
77
ERROR HY000: Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")
88
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encryption='ON' encryption_key_id=33;
99
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encryption='ON' encryption_key_id=4;
10-
SET GLOBAL innodb_default_encryption_key = 5;
10+
set innodb_default_encryption_key_id = 5;
1111
create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encryption='ON';
1212
show create table innodb_defkey;
1313
Table Create Table

mysql-test/suite/innodb/t/innodb-page_encryption.test

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
--disable_query_log
55
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
66
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
7-
let $default_encryption_key = `SELECT @@innodb_default_encryption_key`;
87
--enable_query_log
98

109
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
1817
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encryption='ON' encryption_key_id=33;
1918
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encryption='ON' encryption_key_id=4;
2019

21-
SET GLOBAL innodb_default_encryption_key = 5;
20+
set innodb_default_encryption_key_id = 5;
2221
create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encryption='ON';
2322
show create table innodb_defkey;
2423

@@ -162,5 +161,4 @@ drop table innodb_defkey;
162161
--disable_query_log
163162
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
164163
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
165-
EVAL SET GLOBAL innodb_default_encryption_key = $default_encryption_key;
166164
--enable_query_log

mysql-test/suite/sys_vars/r/all_vars.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ there should be *no* long test name listed below:
1010
select distinct variable_name as `there should be *no* variables listed below:` from t2
1111
left join t1 on variable_name=test_name where test_name is null;
1212
there should be *no* variables listed below:
13-
innodb_default_encryption_key
13+
innodb_default_encryption_key_id
1414
strict_password_validation
1515
drop table t1;
1616
drop table t2;

mysql-test/suite/sys_vars/r/innodb_default_page_encryption_key_basic.result

Lines changed: 0 additions & 71 deletions
This file was deleted.

mysql-test/suite/sys_vars/r/sysvars_innodb.result

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,12 +579,12 @@ NUMERIC_BLOCK_SIZE NULL
579579
ENUM_VALUE_LIST NULL
580580
READ_ONLY NO
581581
COMMAND_LINE_ARGUMENT REQUIRED
582-
VARIABLE_NAME INNODB_DEFAULT_ENCRYPTION_KEY
583-
SESSION_VALUE NULL
582+
VARIABLE_NAME INNODB_DEFAULT_ENCRYPTION_KEY_ID
583+
SESSION_VALUE 1
584584
GLOBAL_VALUE 1
585585
GLOBAL_VALUE_ORIGIN COMPILE-TIME
586586
DEFAULT_VALUE 1
587-
VARIABLE_SCOPE GLOBAL
587+
VARIABLE_SCOPE SESSION
588588
VARIABLE_TYPE INT UNSIGNED
589589
VARIABLE_COMMENT Default encryption key id used for table encryption.
590590
NUMERIC_MIN_VALUE 1

mysql-test/suite/sys_vars/t/innodb_default_page_encryption_key_basic.test

Lines changed: 0 additions & 60 deletions
This file was deleted.

storage/innobase/handler/ha_innodb.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,9 @@ ib_cb_t innodb_api_cb[] = {
548548
(ib_cb_t) ib_cursor_stmt_begin
549549
};
550550

551-
static MYSQL_SYSVAR_UINT(default_encryption_key, srv_default_encryption_key,
552-
PLUGIN_VAR_RQCMDARG,
551+
static MYSQL_THDVAR_UINT(default_encryption_key_id, PLUGIN_VAR_RQCMDARG,
553552
"Default encryption key id used for table encryption.",
554-
NULL,
555-
NULL,
553+
NULL, NULL,
556554
FIL_DEFAULT_ENCRYPTION_KEY, 1, UINT_MAX32, 0);
557555

558556
/**
@@ -576,7 +574,7 @@ ha_create_table_option innodb_table_option_list[]=
576574
/* With this option the user can enable encryption for the table */
577575
HA_TOPTION_ENUM("ENCRYPTION", encryption, "DEFAULT,ON,OFF", 0),
578576
/* With this option the user defines the key identifier using for the encryption */
579-
HA_TOPTION_SYSVAR("ENCRYPTION_KEY_ID", encryption_key_id, default_encryption_key),
577+
HA_TOPTION_SYSVAR("ENCRYPTION_KEY_ID", encryption_key_id, default_encryption_key_id),
580578

581579
HA_TOPTION_END
582580
};
@@ -19417,8 +19415,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
1941719415
MYSQL_SYSVAR(scrub_log),
1941819416
MYSQL_SYSVAR(scrub_log_speed),
1941919417
MYSQL_SYSVAR(encrypt_log),
19420-
MYSQL_SYSVAR(default_encryption_key),
19421-
19418+
MYSQL_SYSVAR(default_encryption_key_id),
1942219419
/* Scrubing feature */
1942319420
MYSQL_SYSVAR(immediate_scrub_data_uncompressed),
1942419421
MYSQL_SYSVAR(background_scrub_data_uncompressed),

storage/innobase/include/srv0srv.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,6 @@ that semaphore times out in InnoDB */
560560
#define DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT 600
561561
extern ulong srv_fatal_semaphore_wait_threshold;
562562

563-
/** Default encryption key used for tablespace encryption */
564-
extern uint srv_default_encryption_key;
565-
566563
/** Enable semaphore request instrumentation */
567564
extern my_bool srv_instrument_semaphores;
568565

storage/innobase/srv/srv0srv.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,6 @@ thread ensures that we flush the log files at least once per
523523
second. */
524524
static time_t srv_last_log_flush_time;
525525

526-
/** Default encryption key used for tablespace encryption */
527-
UNIV_INTERN uint srv_default_encryption_key = FIL_DEFAULT_ENCRYPTION_KEY;
528-
529526
/** Enable semaphore request instrumentation */
530527
UNIV_INTERN my_bool srv_instrument_semaphores = FALSE;
531528

storage/xtradb/handler/ha_innodb.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -613,11 +613,9 @@ ib_cb_t innodb_api_cb[] = {
613613
(ib_cb_t) ib_cursor_stmt_begin
614614
};
615615

616-
static MYSQL_SYSVAR_UINT(default_encryption_key, srv_default_encryption_key,
617-
PLUGIN_VAR_RQCMDARG,
616+
static MYSQL_THDVAR_UINT(default_encryption_key_id, PLUGIN_VAR_RQCMDARG,
618617
"Default encryption key id used for table encryption.",
619-
NULL,
620-
NULL,
618+
NULL, NULL,
621619
FIL_DEFAULT_ENCRYPTION_KEY, 1, UINT_MAX32, 0);
622620

623621
/**
@@ -641,7 +639,7 @@ ha_create_table_option innodb_table_option_list[]=
641639
/* With this option the user can enable encryption for the table */
642640
HA_TOPTION_ENUM("ENCRYPTION", encryption, "DEFAULT,ON,OFF", 0),
643641
/* With this option the user defines the key identifier using for the encryption */
644-
HA_TOPTION_SYSVAR("ENCRYPTION_KEY_ID", encryption_key_id, default_encryption_key),
642+
HA_TOPTION_SYSVAR("ENCRYPTION_KEY_ID", encryption_key_id, default_encryption_key_id),
645643

646644
HA_TOPTION_END
647645
};
@@ -20638,7 +20636,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
2063820636
MYSQL_SYSVAR(scrub_log),
2063920637
MYSQL_SYSVAR(scrub_log_speed),
2064020638
MYSQL_SYSVAR(encrypt_log),
20641-
MYSQL_SYSVAR(default_encryption_key),
20639+
MYSQL_SYSVAR(default_encryption_key_id),
2064220640
/* Scrubing feature */
2064320641
MYSQL_SYSVAR(immediate_scrub_data_uncompressed),
2064420642
MYSQL_SYSVAR(background_scrub_data_uncompressed),

storage/xtradb/include/srv0srv.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,9 +703,6 @@ that semaphore times out in InnoDB */
703703
#define DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT 600
704704
extern ulong srv_fatal_semaphore_wait_threshold;
705705

706-
/** Default encryption key used for tablespace encryption */
707-
extern uint srv_default_encryption_key;
708-
709706
/** Enable semaphore request instrumentation */
710707
extern my_bool srv_instrument_semaphores;
711708

storage/xtradb/srv/srv0srv.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,6 @@ thread ensures that we flush the log files at least once per
670670
second. */
671671
static time_t srv_last_log_flush_time;
672672

673-
/** Default encryption key used for tablespace encryption */
674-
UNIV_INTERN uint srv_default_encryption_key = FIL_DEFAULT_ENCRYPTION_KEY;
675-
676673
/** Enable semaphore request instrumentation */
677674
UNIV_INTERN my_bool srv_instrument_semaphores = FALSE;
678675

0 commit comments

Comments
 (0)