mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-9640: Add used key_id to INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
This commit is contained in:
@ -16,6 +16,7 @@ MIN_KEY_VERSION int(11) unsigned NO 0
|
||||
CURRENT_KEY_VERSION int(11) unsigned NO 0
|
||||
KEY_ROTATION_PAGE_NUMBER bigint(21) unsigned YES NULL
|
||||
KEY_ROTATION_MAX_PAGE_NUMBER bigint(21) unsigned YES NULL
|
||||
CURRENT_KEY_ID int(11) unsigned NO 0
|
||||
# Wait max 5 min for key encryption threads to encrypt one space
|
||||
# Success!
|
||||
# Wait max 10 min for key encryption threads to encrypt all space
|
||||
|
14
mysql-test/suite/encryption/r/innodb_encryption_is.result
Normal file
14
mysql-test/suite/encryption/r/innodb_encryption_is.result
Normal file
@ -0,0 +1,14 @@
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
|
||||
CREATE TABLE t2 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
|
||||
INSERT INTO t1 VALUES ('foobar');
|
||||
INSERT INTO t2 VALUES ('foobar');
|
||||
SELECT NAME, ENCRYPTION_SCHEME, MIN_KEY_VERSION, CURRENT_KEY_VERSION,
|
||||
CURRENT_KEY_ID
|
||||
FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
|
||||
WHERE NAME LIKE '%t1' OR NAME LIKE '%t2';
|
||||
NAME ENCRYPTION_SCHEME MIN_KEY_VERSION CURRENT_KEY_VERSION CURRENT_KEY_ID
|
||||
test/t1 1 1 1 1
|
||||
test/t2 1 1 1 2
|
||||
DROP TABLE t1, t2;
|
1
mysql-test/suite/encryption/t/innodb_encryption_is.opt
Normal file
1
mysql-test/suite/encryption/t/innodb_encryption_is.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-innodb-tablespaces-encryption
|
31
mysql-test/suite/encryption/t/innodb_encryption_is.test
Normal file
31
mysql-test/suite/encryption/t/innodb_encryption_is.test
Normal file
@ -0,0 +1,31 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_file_key_management_plugin.inc
|
||||
|
||||
--disable_query_log
|
||||
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
|
||||
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
|
||||
--enable_query_log
|
||||
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
|
||||
CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
|
||||
CREATE TABLE t2 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
|
||||
INSERT INTO t1 VALUES ('foobar');
|
||||
INSERT INTO t2 VALUES ('foobar');
|
||||
|
||||
#
|
||||
# MDEV-9640: Add used key_id to INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
|
||||
#
|
||||
SELECT NAME, ENCRYPTION_SCHEME, MIN_KEY_VERSION, CURRENT_KEY_VERSION,
|
||||
CURRENT_KEY_ID
|
||||
FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
|
||||
WHERE NAME LIKE '%t1' OR NAME LIKE '%t2';
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
# reset system
|
||||
--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;
|
||||
--enable_query_log
|
@ -376,7 +376,7 @@ space_id page_id start_lsn end_lsn
|
||||
Warnings:
|
||||
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_changed_pages but the InnoDB storage engine is not installed
|
||||
select * from information_schema.innodb_tablespaces_encryption;
|
||||
SPACE NAME ENCRYPTION_SCHEME KEYSERVER_REQUESTS MIN_KEY_VERSION CURRENT_KEY_VERSION KEY_ROTATION_PAGE_NUMBER KEY_ROTATION_MAX_PAGE_NUMBER
|
||||
SPACE NAME ENCRYPTION_SCHEME KEYSERVER_REQUESTS MIN_KEY_VERSION CURRENT_KEY_VERSION KEY_ROTATION_PAGE_NUMBER KEY_ROTATION_MAX_PAGE_NUMBER CURRENT_KEY_ID
|
||||
Warnings:
|
||||
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_tablespaces_encryption but the InnoDB storage engine is not installed
|
||||
select * from information_schema.innodb_tablespaces_scrubbing;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
|
||||
Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
|
||||
Copyright (C) 2014, 2016, MariaDB Corporation. 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
|
||||
@ -2522,6 +2522,7 @@ fil_space_crypt_get_status(
|
||||
mutex_enter(&crypt_data->mutex);
|
||||
status->keyserver_requests = crypt_data->keyserver_requests;
|
||||
status->min_key_version = crypt_data->min_key_version;
|
||||
status->key_id = crypt_data->key_id;
|
||||
|
||||
if (crypt_data->rotate_state.active_threads > 0 ||
|
||||
crypt_data->rotate_state.flushing) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2007, 2015, Oracle and/or its affiliates.
|
||||
Copyrigth (c) 2014, 2015, MariaDB Corporation
|
||||
Copyrigth (c) 2014, 2016, MariaDB Corporation
|
||||
|
||||
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
|
||||
@ -8134,6 +8134,15 @@ static ST_FIELD_INFO innodb_tablespaces_encryption_fields_info[] =
|
||||
STRUCT_FLD(old_name, ""),
|
||||
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
|
||||
|
||||
#define TABLESPACES_ENCRYPTION_CURRENT_KEY_ID 8
|
||||
{STRUCT_FLD(field_name, "CURRENT_KEY_ID"),
|
||||
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
|
||||
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
|
||||
STRUCT_FLD(value, 0),
|
||||
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
|
||||
STRUCT_FLD(old_name, ""),
|
||||
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
|
||||
|
||||
END_OF_ST_FIELD_INFO
|
||||
};
|
||||
|
||||
@ -8172,6 +8181,8 @@ i_s_dict_fill_tablespaces_encryption(
|
||||
status.min_key_version));
|
||||
OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_VERSION]->store(
|
||||
status.current_key_version));
|
||||
OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_ID]->store(
|
||||
status.key_id));
|
||||
if (status.rotating) {
|
||||
fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->set_notnull();
|
||||
OK(fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->store(
|
||||
|
@ -333,6 +333,7 @@ struct fil_space_crypt_status_t {
|
||||
uint min_key_version; /*!< min key version */
|
||||
uint current_key_version;/*!< current key version */
|
||||
uint keyserver_requests;/*!< no of key requests to key server */
|
||||
ulint key_id; /*!< current key_id */
|
||||
bool rotating; /*!< is key rotation ongoing */
|
||||
bool flushing; /*!< is flush at end of rotation ongoing */
|
||||
ulint rotate_next_page_number; /*!< next page if key rotating */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
|
||||
Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
|
||||
Copyright (C) 2014, 2016, MariaDB Corporation. 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
|
||||
@ -2522,6 +2522,7 @@ fil_space_crypt_get_status(
|
||||
mutex_enter(&crypt_data->mutex);
|
||||
status->keyserver_requests = crypt_data->keyserver_requests;
|
||||
status->min_key_version = crypt_data->min_key_version;
|
||||
status->key_id = crypt_data->key_id;
|
||||
|
||||
if (crypt_data->rotate_state.active_threads > 0 ||
|
||||
crypt_data->rotate_state.flushing) {
|
||||
|
@ -1,11 +1,10 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
|
||||
Copyright (c) 2013, 2015, MariaDB Corporation.
|
||||
Copyright (c) 2013, 2016, MariaDB Corporation.
|
||||
Copyright (c) 2008, 2009 Google Inc.
|
||||
Copyright (c) 2009, Percona Inc.
|
||||
Copyright (c) 2012, Facebook Inc.
|
||||
Copyright (c) 2013, 2014 SkySQL Ab. All Rights Reserved.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -8317,7 +8316,7 @@ ha_innobase::write_row(
|
||||
|
||||
if (share->ib_table != prebuilt->table) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
|
||||
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
|
||||
}
|
||||
|
||||
@ -8670,7 +8669,7 @@ func_exit:
|
||||
|
||||
if (share->ib_table != prebuilt->table) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
|
||||
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
|
||||
}
|
||||
|
||||
@ -9090,7 +9089,7 @@ ha_innobase::update_row(
|
||||
|
||||
if (share->ib_table != prebuilt->table) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
|
||||
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
|
||||
}
|
||||
|
||||
@ -9211,7 +9210,7 @@ wsrep_error:
|
||||
|
||||
if (share->ib_table != prebuilt->table) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
|
||||
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
|
||||
}
|
||||
|
||||
@ -12739,7 +12738,7 @@ ha_innobase::truncate()
|
||||
|
||||
if (share->ib_table != prebuilt->table) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
|
||||
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
|
||||
}
|
||||
|
||||
@ -12760,7 +12759,7 @@ ha_innobase::truncate()
|
||||
|
||||
if (share->ib_table != prebuilt->table) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
|
||||
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
|
||||
}
|
||||
|
||||
@ -14156,7 +14155,7 @@ ha_innobase::analyze(
|
||||
|
||||
if (share->ib_table != prebuilt->table) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
|
||||
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
|
||||
}
|
||||
|
||||
@ -14172,7 +14171,7 @@ ha_innobase::analyze(
|
||||
|
||||
if (share->ib_table != prebuilt->table) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
|
||||
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
|
||||
}
|
||||
|
||||
@ -15387,7 +15386,7 @@ ha_innobase::transactional_table_lock(
|
||||
|
||||
if (share->ib_table != prebuilt->table) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
|
||||
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
|
||||
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyrigth (c) 2014, 2015, MariaDB Corporation
|
||||
Copyrigth (c) 2014, 2016, MariaDB Corporation
|
||||
|
||||
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
|
||||
@ -8468,6 +8468,15 @@ static ST_FIELD_INFO innodb_tablespaces_encryption_fields_info[] =
|
||||
STRUCT_FLD(old_name, ""),
|
||||
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
|
||||
|
||||
#define TABLESPACES_ENCRYPTION_CURRENT_KEY_ID 8
|
||||
{STRUCT_FLD(field_name, "CURRENT_KEY_ID"),
|
||||
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
|
||||
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
|
||||
STRUCT_FLD(value, 0),
|
||||
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
|
||||
STRUCT_FLD(old_name, ""),
|
||||
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
|
||||
|
||||
END_OF_ST_FIELD_INFO
|
||||
};
|
||||
|
||||
@ -8506,6 +8515,8 @@ i_s_dict_fill_tablespaces_encryption(
|
||||
status.min_key_version));
|
||||
OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_VERSION]->store(
|
||||
status.current_key_version));
|
||||
OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_ID]->store(
|
||||
status.key_id));
|
||||
if (status.rotating) {
|
||||
fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->set_notnull();
|
||||
OK(fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->store(
|
||||
|
@ -333,6 +333,7 @@ struct fil_space_crypt_status_t {
|
||||
uint min_key_version; /*!< min key version */
|
||||
uint current_key_version;/*!< current key version */
|
||||
uint keyserver_requests;/*!< no of key requests to key server */
|
||||
ulint key_id; /*!< current key_id */
|
||||
bool rotating; /*!< is key rotation ongoing */
|
||||
bool flushing; /*!< is flush at end of rotation ongoing */
|
||||
ulint rotate_next_page_number; /*!< next page if key rotating */
|
||||
|
Reference in New Issue
Block a user