diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2017-08-29 14:23:34 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-08-31 08:36:56 +0300 |
commit | eca238aea7925b3f165db7c8a0e03c5b3b179cf9 (patch) | |
tree | 9686c818f33aebfb223a7c508507d75f81595b1e /mysql-test/suite/encryption/t/innodb-first-page-read.test | |
parent | 43b262af55db507320b165bb0f9abf05b2f05a89 (diff) | |
download | mariadb-git-eca238aea7925b3f165db7c8a0e03c5b3b179cf9.tar.gz |
MDEV-13557: Startup failure, unable to decrypt ibdata1
Fixes also MDEV-13488: InnoDB writes CRYPT_INFO even though
encryption is not enabled.
Fixes also MDEV-13093: Leak of Datafile::m_crypt_info on
shutdown after failed startup.
Problem was that we created encryption metadata (crypt_data) for
system tablespace even when no encryption was enabled and too early.
System tablespace can be encrypted only using key rotation.
Test innodb-key-rotation-disable, innodb_encryption, innodb_lotoftables
require adjustment because INFORMATION_SCHEMA INNODB_TABLESPACES_ENCRYPTION
contain row only if tablespace really has encryption metadata.
xb_load_single_table_tablespace(): Do not call
fil_space_destroy_crypt_data() any more, because Datafile::m_crypt_data
has been removed.
fil_crypt_realloc_iops(): Avoid divide by zero.
fil_crypt_set_thread_cnt(): Set fil_crypt_threads_event if
encryption threads exist. This is required to find tablespaces
requiring key rotation if no other changes happen.
fil_crypt_find_space_to_rotate(): Decrease the amount of time waiting
when nothing happens to better enable key rotation on startup.
fil_ibd_open(), fil_ibd_load(): Load possible crypt_data from first
page.
class Datafile, class SysTablespace : remove m_crypt_info field.
Datafile::get_first_page(): Return a pointer to first page buffer.
fsp_header_init(): Write encryption metadata to page 0 only if
tablespace is encrypted or encryption is disabled by table option.
i_s_dict_fill_tablespaces_encryption(): Skip tablespaces that do not
contain encryption metadata. This is required to avoid too early
wait condition trigger in encrypted -> unencrypted state transfer.
Diffstat (limited to 'mysql-test/suite/encryption/t/innodb-first-page-read.test')
-rw-r--r-- | mysql-test/suite/encryption/t/innodb-first-page-read.test | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/mysql-test/suite/encryption/t/innodb-first-page-read.test b/mysql-test/suite/encryption/t/innodb-first-page-read.test index 1fc07159e05..d661e4565d2 100644 --- a/mysql-test/suite/encryption/t/innodb-first-page-read.test +++ b/mysql-test/suite/encryption/t/innodb-first-page-read.test @@ -7,6 +7,8 @@ SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; --enable_warnings +FLUSH STATUS; + create database innodb_test; use innodb_test; create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb; @@ -63,16 +65,19 @@ insert into innodb_datadir2 select * from innodb_normal; insert into innodb_datadir3 select * from innodb_normal; commit; +FLUSH STATUS; + --echo # Restart server and see how many page 0's are read --source include/restart_mysqld.inc ---echo # result should be less than actual number of tables ---echo # i.e. < 23 + 3 = 26 -show status like 'innodb_pages0_read%'; +--echo # result should actual number of tables except remote tables could be read twice +--echo # i.e. < 23 + 3*2 = 29 + +SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read'; use innodb_test; -show status like 'innodb_pages0_read%'; +SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read'; use test; -show status like 'innodb_pages0_read%'; +SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read'; set global innodb_encrypt_tables=OFF; @@ -80,18 +85,25 @@ set global innodb_encrypt_tables=OFF; --let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 --source include/wait_condition.inc -show status like 'innodb_pages0_read%'; +--echo # result should be actual number of tables except remote tables could be read twice +--echo # i.e. < 23 + 3*2 = 29 + +SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read'; use innodb_test; -show status like 'innodb_pages0_read%'; +SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read'; use test; +SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read'; + +FLUSH STATUS; --echo # restart and see number read page 0 -- source include/restart_mysqld.inc -show status like 'innodb_pages0_read%'; +SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read'; use innodb_test; -show status like 'innodb_pages0_read%'; +SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read'; use test; +SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read'; drop database innodb_test; -show status like 'innodb_pages0_read%'; +FLUSH STATUS; |