Commit 352d27ce authored by Jan Lindström's avatar Jan Lindström

MDEV-13557: Startup failure, unable to decrypt ibdata1

Fixes also MDEV-13488: InnoDB writes CRYPT_INFO even though
encryption is not enabled.

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.

fil_crypt_set_thread_cnt: Send message to background encryption threads
if they exits when they are ready. 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.

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.

open_or_create_data_files: Do not create encryption metadata
by default to system tablespace.
parent dda40b93
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
FLUSH STATUS;
create database innodb_test;
use innodb_test;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
......@@ -50,40 +51,48 @@ insert into innodb_datadir1 select * from innodb_normal;
insert into innodb_datadir2 select * from innodb_normal;
insert into innodb_datadir3 select * from innodb_normal;
commit;
FLUSH STATUS;
# Restart server and see how many page 0's are read
# result should be less than actual number of tables
# i.e. < 23 + 3 = 26
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 19
# result should actual number of tables except remote tables could be read twice
# i.e. < 23 + 3*2 = 29
SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read';
VARIABLE_VALUE <= 29
1
use innodb_test;
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 19
SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read';
VARIABLE_VALUE <= 29
1
use test;
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 19
SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read';
VARIABLE_VALUE <= 29
1
set global innodb_encrypt_tables=OFF;
# wait until tables are decrypted
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 29
# result should be actual number of tables except remote tables could be read twice
# i.e. < 23 + 3*2 = 29
SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read';
VARIABLE_VALUE <= 29
1
use innodb_test;
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 29
SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read';
VARIABLE_VALUE <= 29
1
use test;
SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read';
VARIABLE_VALUE <= 29
1
FLUSH STATUS;
# restart and see number read page 0
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 19
SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read';
VARIABLE_VALUE <= 29
1
use innodb_test;
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 19
SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read';
VARIABLE_VALUE <= 29
1
use test;
SELECT VARIABLE_VALUE <= 29 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'innodb_pages0_read';
VARIABLE_VALUE <= 29
1
drop database innodb_test;
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 29
FLUSH STATUS;
......@@ -2,9 +2,6 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_
NAME
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
mysql/innodb_table_stats
mysql/innodb_index_stats
./ibdata1
create database enctests;
use enctests;
create table t1(a int not null primary key, b char(200)) engine=innodb;
......
......@@ -8,25 +8,22 @@ innodb_encrypt_tables ON
innodb_encryption_rotate_key_age 15
innodb_encryption_rotation_iops 100
innodb_encryption_threads 4
DESCRIBE INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
Field Type Null Key Default Extra
SPACE int(11) unsigned NO 0
NAME varchar(655) YES NULL
ENCRYPTION_SCHEME int(11) unsigned NO 0
KEYSERVER_REQUESTS int(11) unsigned NO 0
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
ROTATING_OR_FLUSHING int(1) 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
SET GLOBAL innodb_encrypt_tables = ON;
# Wait max 10 min for key encryption threads to encrypt all spaces
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME
./ibdata1
# Success!
# Now turn off encryption and wait for threads to decrypt everything
SET GLOBAL innodb_encrypt_tables = off;
# Wait max 10 min for key encryption threads to decrypt all space
# Wait max 10 min for key encryption threads to encrypt all spaces
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
./ibdata1
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME
# Success!
# Shutdown innodb_encryption_threads
SET GLOBAL innodb_encryption_threads=0;
......@@ -34,16 +31,20 @@ SET GLOBAL innodb_encryption_threads=0;
# since threads are off tables should remain unencrypted
SET GLOBAL innodb_encrypt_tables = on;
# Wait 15s to check that nothing gets encrypted
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
./ibdata1
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME
# Success!
# Startup innodb_encryption_threads
SET GLOBAL innodb_encryption_threads=@start_global_value;
# Wait 1 min to check that it start encrypting again
# Success!
#
# Check that restart with encryption turned off works
# even if spaces are encrypted
#
# First wait max 10 min for key encryption threads to encrypt all spaces
# Wait max 10 min for key encryption threads to encrypt all spaces
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME
./ibdata1
# Success!
# Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0
SHOW VARIABLES LIKE 'innodb_encrypt%';
......@@ -53,9 +54,8 @@ innodb_encrypt_tables OFF
innodb_encryption_rotate_key_age 15
innodb_encryption_rotation_iops 100
innodb_encryption_threads 0
SELECT COUNT(*) > 0 as should_be_1
FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
WHERE MIN_KEY_VERSION <> 0;
should_be_1
1
# Restart mysqld again...with default options
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME
./ibdata1
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
......@@ -19,10 +19,9 @@ commit work;
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 3
# should be 100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE NAME LIKE 'innodb_encrypted%';
COUNT(*)
100
# should be empty
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE NAME LIKE 'innodb_encrypted%';
NAME
create database innodb_encrypted_2;
use innodb_encrypted_2;
show status like 'innodb_pages0_read%';
......@@ -34,14 +33,112 @@ set autocommit=1;
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 3
# should be 100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
100
# should be 100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
100
# should contain 100 tables
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
NAME
innodb_encrypted_2/t_1
innodb_encrypted_2/t_10
innodb_encrypted_2/t_100
innodb_encrypted_2/t_11
innodb_encrypted_2/t_12
innodb_encrypted_2/t_13
innodb_encrypted_2/t_14
innodb_encrypted_2/t_15
innodb_encrypted_2/t_16
innodb_encrypted_2/t_17
innodb_encrypted_2/t_18
innodb_encrypted_2/t_19
innodb_encrypted_2/t_2
innodb_encrypted_2/t_20
innodb_encrypted_2/t_21
innodb_encrypted_2/t_22
innodb_encrypted_2/t_23
innodb_encrypted_2/t_24
innodb_encrypted_2/t_25
innodb_encrypted_2/t_26
innodb_encrypted_2/t_27
innodb_encrypted_2/t_28
innodb_encrypted_2/t_29
innodb_encrypted_2/t_3
innodb_encrypted_2/t_30
innodb_encrypted_2/t_31
innodb_encrypted_2/t_32
innodb_encrypted_2/t_33
innodb_encrypted_2/t_34
innodb_encrypted_2/t_35
innodb_encrypted_2/t_36
innodb_encrypted_2/t_37
innodb_encrypted_2/t_38
innodb_encrypted_2/t_39
innodb_encrypted_2/t_4
innodb_encrypted_2/t_40
innodb_encrypted_2/t_41
innodb_encrypted_2/t_42
innodb_encrypted_2/t_43
innodb_encrypted_2/t_44
innodb_encrypted_2/t_45
innodb_encrypted_2/t_46
innodb_encrypted_2/t_47
innodb_encrypted_2/t_48
innodb_encrypted_2/t_49
innodb_encrypted_2/t_5
innodb_encrypted_2/t_50
innodb_encrypted_2/t_51
innodb_encrypted_2/t_52
innodb_encrypted_2/t_53
innodb_encrypted_2/t_54
innodb_encrypted_2/t_55
innodb_encrypted_2/t_56
innodb_encrypted_2/t_57
innodb_encrypted_2/t_58
innodb_encrypted_2/t_59
innodb_encrypted_2/t_6
innodb_encrypted_2/t_60
innodb_encrypted_2/t_61
innodb_encrypted_2/t_62
innodb_encrypted_2/t_63
innodb_encrypted_2/t_64
innodb_encrypted_2/t_65
innodb_encrypted_2/t_66
innodb_encrypted_2/t_67
innodb_encrypted_2/t_68
innodb_encrypted_2/t_69
innodb_encrypted_2/t_7
innodb_encrypted_2/t_70
innodb_encrypted_2/t_71
innodb_encrypted_2/t_72
innodb_encrypted_2/t_73
innodb_encrypted_2/t_74
innodb_encrypted_2/t_75
innodb_encrypted_2/t_76
innodb_encrypted_2/t_77
innodb_encrypted_2/t_78
innodb_encrypted_2/t_79
innodb_encrypted_2/t_8
innodb_encrypted_2/t_80
innodb_encrypted_2/t_81
innodb_encrypted_2/t_82
innodb_encrypted_2/t_83
innodb_encrypted_2/t_84
innodb_encrypted_2/t_85
innodb_encrypted_2/t_86
innodb_encrypted_2/t_87
innodb_encrypted_2/t_88
innodb_encrypted_2/t_89
innodb_encrypted_2/t_9
innodb_encrypted_2/t_90
innodb_encrypted_2/t_91
innodb_encrypted_2/t_92
innodb_encrypted_2/t_93
innodb_encrypted_2/t_94
innodb_encrypted_2/t_95
innodb_encrypted_2/t_96
innodb_encrypted_2/t_97
innodb_encrypted_2/t_98
innodb_encrypted_2/t_99
# should contain 0 tables
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
NAME
create database innodb_encrypted_3;
use innodb_encrypted_3;
show status like 'innodb_pages0_read%';
......@@ -53,33 +150,626 @@ set autocommit=1;
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 3
# should be 100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
100
# should be 200
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
200
# should contain 100 tables
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
NAME
innodb_encrypted_2/t_1
innodb_encrypted_2/t_10
innodb_encrypted_2/t_100
innodb_encrypted_2/t_11
innodb_encrypted_2/t_12
innodb_encrypted_2/t_13
innodb_encrypted_2/t_14
innodb_encrypted_2/t_15
innodb_encrypted_2/t_16
innodb_encrypted_2/t_17
innodb_encrypted_2/t_18
innodb_encrypted_2/t_19
innodb_encrypted_2/t_2
innodb_encrypted_2/t_20
innodb_encrypted_2/t_21
innodb_encrypted_2/t_22
innodb_encrypted_2/t_23
innodb_encrypted_2/t_24
innodb_encrypted_2/t_25
innodb_encrypted_2/t_26
innodb_encrypted_2/t_27
innodb_encrypted_2/t_28
innodb_encrypted_2/t_29
innodb_encrypted_2/t_3
innodb_encrypted_2/t_30
innodb_encrypted_2/t_31
innodb_encrypted_2/t_32
innodb_encrypted_2/t_33
innodb_encrypted_2/t_34
innodb_encrypted_2/t_35
innodb_encrypted_2/t_36
innodb_encrypted_2/t_37
innodb_encrypted_2/t_38
innodb_encrypted_2/t_39
innodb_encrypted_2/t_4
innodb_encrypted_2/t_40
innodb_encrypted_2/t_41
innodb_encrypted_2/t_42
innodb_encrypted_2/t_43
innodb_encrypted_2/t_44
innodb_encrypted_2/t_45
innodb_encrypted_2/t_46
innodb_encrypted_2/t_47
innodb_encrypted_2/t_48
innodb_encrypted_2/t_49
innodb_encrypted_2/t_5
innodb_encrypted_2/t_50
innodb_encrypted_2/t_51
innodb_encrypted_2/t_52
innodb_encrypted_2/t_53
innodb_encrypted_2/t_54
innodb_encrypted_2/t_55
innodb_encrypted_2/t_56
innodb_encrypted_2/t_57
innodb_encrypted_2/t_58
innodb_encrypted_2/t_59
innodb_encrypted_2/t_6
innodb_encrypted_2/t_60
innodb_encrypted_2/t_61
innodb_encrypted_2/t_62
innodb_encrypted_2/t_63
innodb_encrypted_2/t_64
innodb_encrypted_2/t_65
innodb_encrypted_2/t_66
innodb_encrypted_2/t_67
innodb_encrypted_2/t_68
innodb_encrypted_2/t_69
innodb_encrypted_2/t_7
innodb_encrypted_2/t_70
innodb_encrypted_2/t_71
innodb_encrypted_2/t_72
innodb_encrypted_2/t_73
innodb_encrypted_2/t_74
innodb_encrypted_2/t_75
innodb_encrypted_2/t_76
innodb_encrypted_2/t_77
innodb_encrypted_2/t_78
innodb_encrypted_2/t_79
innodb_encrypted_2/t_8
innodb_encrypted_2/t_80
innodb_encrypted_2/t_81
innodb_encrypted_2/t_82
innodb_encrypted_2/t_83
innodb_encrypted_2/t_84
innodb_encrypted_2/t_85
innodb_encrypted_2/t_86
innodb_encrypted_2/t_87
innodb_encrypted_2/t_88
innodb_encrypted_2/t_89
innodb_encrypted_2/t_9
innodb_encrypted_2/t_90
innodb_encrypted_2/t_91
innodb_encrypted_2/t_92
innodb_encrypted_2/t_93
innodb_encrypted_2/t_94
innodb_encrypted_2/t_95
innodb_encrypted_2/t_96
innodb_encrypted_2/t_97
innodb_encrypted_2/t_98
innodb_encrypted_2/t_99
# should contain 100 tables
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
NAME
innodb_encrypted_3/t_1
innodb_encrypted_3/t_10
innodb_encrypted_3/t_100
innodb_encrypted_3/t_11
innodb_encrypted_3/t_12
innodb_encrypted_3/t_13
innodb_encrypted_3/t_14
innodb_encrypted_3/t_15
innodb_encrypted_3/t_16
innodb_encrypted_3/t_17
innodb_encrypted_3/t_18
innodb_encrypted_3/t_19
innodb_encrypted_3/t_2
innodb_encrypted_3/t_20
innodb_encrypted_3/t_21
innodb_encrypted_3/t_22
innodb_encrypted_3/t_23
innodb_encrypted_3/t_24
innodb_encrypted_3/t_25
innodb_encrypted_3/t_26
innodb_encrypted_3/t_27
innodb_encrypted_3/t_28
innodb_encrypted_3/t_29
innodb_encrypted_3/t_3
innodb_encrypted_3/t_30
innodb_encrypted_3/t_31
innodb_encrypted_3/t_32
innodb_encrypted_3/t_33
innodb_encrypted_3/t_34
innodb_encrypted_3/t_35
innodb_encrypted_3/t_36
innodb_encrypted_3/t_37
innodb_encrypted_3/t_38
innodb_encrypted_3/t_39
innodb_encrypted_3/t_4
innodb_encrypted_3/t_40
innodb_encrypted_3/t_41
innodb_encrypted_3/t_42
innodb_encrypted_3/t_43
innodb_encrypted_3/t_44
innodb_encrypted_3/t_45
innodb_encrypted_3/t_46
innodb_encrypted_3/t_47
innodb_encrypted_3/t_48
innodb_encrypted_3/t_49
innodb_encrypted_3/t_5
innodb_encrypted_3/t_50
innodb_encrypted_3/t_51
innodb_encrypted_3/t_52
innodb_encrypted_3/t_53
innodb_encrypted_3/t_54
innodb_encrypted_3/t_55
innodb_encrypted_3/t_56
innodb_encrypted_3/t_57
innodb_encrypted_3/t_58
innodb_encrypted_3/t_59
innodb_encrypted_3/t_6
innodb_encrypted_3/t_60
innodb_encrypted_3/t_61
innodb_encrypted_3/t_62
innodb_encrypted_3/t_63
innodb_encrypted_3/t_64
innodb_encrypted_3/t_65
innodb_encrypted_3/t_66
innodb_encrypted_3/t_67
innodb_encrypted_3/t_68
innodb_encrypted_3/t_69
innodb_encrypted_3/t_7
innodb_encrypted_3/t_70
innodb_encrypted_3/t_71
innodb_encrypted_3/t_72
innodb_encrypted_3/t_73
innodb_encrypted_3/t_74
innodb_encrypted_3/t_75
innodb_encrypted_3/t_76
innodb_encrypted_3/t_77
innodb_encrypted_3/t_78
innodb_encrypted_3/t_79
innodb_encrypted_3/t_8
innodb_encrypted_3/t_80
innodb_encrypted_3/t_81
innodb_encrypted_3/t_82
innodb_encrypted_3/t_83
innodb_encrypted_3/t_84
innodb_encrypted_3/t_85
innodb_encrypted_3/t_86
innodb_encrypted_3/t_87
innodb_encrypted_3/t_88
innodb_encrypted_3/t_89
innodb_encrypted_3/t_9
innodb_encrypted_3/t_90
innodb_encrypted_3/t_91
innodb_encrypted_3/t_92
innodb_encrypted_3/t_93
innodb_encrypted_3/t_94
innodb_encrypted_3/t_95
innodb_encrypted_3/t_96
innodb_encrypted_3/t_97
innodb_encrypted_3/t_98
innodb_encrypted_3/t_99
use test;
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 3
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
200
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
NAME
innodb_encrypted_2/t_1
innodb_encrypted_2/t_10
innodb_encrypted_2/t_100
innodb_encrypted_2/t_11
innodb_encrypted_2/t_12
innodb_encrypted_2/t_13
innodb_encrypted_2/t_14
innodb_encrypted_2/t_15
innodb_encrypted_2/t_16
innodb_encrypted_2/t_17
innodb_encrypted_2/t_18
innodb_encrypted_2/t_19
innodb_encrypted_2/t_2
innodb_encrypted_2/t_20
innodb_encrypted_2/t_21
innodb_encrypted_2/t_22
innodb_encrypted_2/t_23
innodb_encrypted_2/t_24
innodb_encrypted_2/t_25
innodb_encrypted_2/t_26
innodb_encrypted_2/t_27
innodb_encrypted_2/t_28
innodb_encrypted_2/t_29
innodb_encrypted_2/t_3
innodb_encrypted_2/t_30
innodb_encrypted_2/t_31
innodb_encrypted_2/t_32
innodb_encrypted_2/t_33
innodb_encrypted_2/t_34
innodb_encrypted_2/t_35
innodb_encrypted_2/t_36
innodb_encrypted_2/t_37
innodb_encrypted_2/t_38
innodb_encrypted_2/t_39
innodb_encrypted_2/t_4
innodb_encrypted_2/t_40
innodb_encrypted_2/t_41
innodb_encrypted_2/t_42
innodb_encrypted_2/t_43
innodb_encrypted_2/t_44
innodb_encrypted_2/t_45
innodb_encrypted_2/t_46
innodb_encrypted_2/t_47
innodb_encrypted_2/t_48
innodb_encrypted_2/t_49
innodb_encrypted_2/t_5
innodb_encrypted_2/t_50
innodb_encrypted_2/t_51
innodb_encrypted_2/t_52
innodb_encrypted_2/t_53
innodb_encrypted_2/t_54
innodb_encrypted_2/t_55
innodb_encrypted_2/t_56
innodb_encrypted_2/t_57
innodb_encrypted_2/t_58
innodb_encrypted_2/t_59
innodb_encrypted_2/t_6
innodb_encrypted_2/t_60
innodb_encrypted_2/t_61
innodb_encrypted_2/t_62
innodb_encrypted_2/t_63
innodb_encrypted_2/t_64
innodb_encrypted_2/t_65
innodb_encrypted_2/t_66
innodb_encrypted_2/t_67
innodb_encrypted_2/t_68
innodb_encrypted_2/t_69
innodb_encrypted_2/t_7
innodb_encrypted_2/t_70
innodb_encrypted_2/t_71
innodb_encrypted_2/t_72
innodb_encrypted_2/t_73
innodb_encrypted_2/t_74
innodb_encrypted_2/t_75
innodb_encrypted_2/t_76
innodb_encrypted_2/t_77
innodb_encrypted_2/t_78
innodb_encrypted_2/t_79
innodb_encrypted_2/t_8
innodb_encrypted_2/t_80
innodb_encrypted_2/t_81
innodb_encrypted_2/t_82
innodb_encrypted_2/t_83
innodb_encrypted_2/t_84
innodb_encrypted_2/t_85
innodb_encrypted_2/t_86
innodb_encrypted_2/t_87
innodb_encrypted_2/t_88
innodb_encrypted_2/t_89
innodb_encrypted_2/t_9
innodb_encrypted_2/t_90
innodb_encrypted_2/t_91
innodb_encrypted_2/t_92
innodb_encrypted_2/t_93
innodb_encrypted_2/t_94
innodb_encrypted_2/t_95
innodb_encrypted_2/t_96
innodb_encrypted_2/t_97
innodb_encrypted_2/t_98
innodb_encrypted_2/t_99
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
NAME
innodb_encrypted_3/t_1
innodb_encrypted_3/t_10
innodb_encrypted_3/t_100
innodb_encrypted_3/t_11
innodb_encrypted_3/t_12
innodb_encrypted_3/t_13
innodb_encrypted_3/t_14
innodb_encrypted_3/t_15
innodb_encrypted_3/t_16
innodb_encrypted_3/t_17
innodb_encrypted_3/t_18
innodb_encrypted_3/t_19
innodb_encrypted_3/t_2
innodb_encrypted_3/t_20
innodb_encrypted_3/t_21
innodb_encrypted_3/t_22
innodb_encrypted_3/t_23
innodb_encrypted_3/t_24
innodb_encrypted_3/t_25
innodb_encrypted_3/t_26
innodb_encrypted_3/t_27
innodb_encrypted_3/t_28
innodb_encrypted_3/t_29
innodb_encrypted_3/t_3
innodb_encrypted_3/t_30
innodb_encrypted_3/t_31
innodb_encrypted_3/t_32
innodb_encrypted_3/t_33
innodb_encrypted_3/t_34
innodb_encrypted_3/t_35
innodb_encrypted_3/t_36
innodb_encrypted_3/t_37
innodb_encrypted_3/t_38
innodb_encrypted_3/t_39
innodb_encrypted_3/t_4
innodb_encrypted_3/t_40
innodb_encrypted_3/t_41
innodb_encrypted_3/t_42
innodb_encrypted_3/t_43
innodb_encrypted_3/t_44
innodb_encrypted_3/t_45
innodb_encrypted_3/t_46
innodb_encrypted_3/t_47
innodb_encrypted_3/t_48
innodb_encrypted_3/t_49
innodb_encrypted_3/t_5
innodb_encrypted_3/t_50
innodb_encrypted_3/t_51
innodb_encrypted_3/t_52
innodb_encrypted_3/t_53
innodb_encrypted_3/t_54
innodb_encrypted_3/t_55
innodb_encrypted_3/t_56
innodb_encrypted_3/t_57
innodb_encrypted_3/t_58
innodb_encrypted_3/t_59
innodb_encrypted_3/t_6
innodb_encrypted_3/t_60
innodb_encrypted_3/t_61
innodb_encrypted_3/t_62
innodb_encrypted_3/t_63
innodb_encrypted_3/t_64
innodb_encrypted_3/t_65
innodb_encrypted_3/t_66
innodb_encrypted_3/t_67
innodb_encrypted_3/t_68
innodb_encrypted_3/t_69
innodb_encrypted_3/t_7
innodb_encrypted_3/t_70
innodb_encrypted_3/t_71
innodb_encrypted_3/t_72
innodb_encrypted_3/t_73
innodb_encrypted_3/t_74
innodb_encrypted_3/t_75
innodb_encrypted_3/t_76
innodb_encrypted_3/t_77
innodb_encrypted_3/t_78
innodb_encrypted_3/t_79
innodb_encrypted_3/t_8
innodb_encrypted_3/t_80
innodb_encrypted_3/t_81
innodb_encrypted_3/t_82
innodb_encrypted_3/t_83
innodb_encrypted_3/t_84
innodb_encrypted_3/t_85
innodb_encrypted_3/t_86
innodb_encrypted_3/t_87
innodb_encrypted_3/t_88
innodb_encrypted_3/t_89
innodb_encrypted_3/t_9
innodb_encrypted_3/t_90
innodb_encrypted_3/t_91
innodb_encrypted_3/t_92
innodb_encrypted_3/t_93
innodb_encrypted_3/t_94
innodb_encrypted_3/t_95
innodb_encrypted_3/t_96
innodb_encrypted_3/t_97
innodb_encrypted_3/t_98
innodb_encrypted_3/t_99
SET GLOBAL innodb_encrypt_tables = on;
SET GLOBAL innodb_encryption_threads=4;
# Wait until all encrypted tables have been encrypted
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
200
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
100
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
NAME
innodb_encrypted_2/t_1
innodb_encrypted_2/t_10
innodb_encrypted_2/t_100
innodb_encrypted_2/t_11
innodb_encrypted_2/t_12
innodb_encrypted_2/t_13
innodb_encrypted_2/t_14
innodb_encrypted_2/t_15
innodb_encrypted_2/t_16
innodb_encrypted_2/t_17
innodb_encrypted_2/t_18
innodb_encrypted_2/t_19
innodb_encrypted_2/t_2
innodb_encrypted_2/t_20
innodb_encrypted_2/t_21
innodb_encrypted_2/t_22
innodb_encrypted_2/t_23
innodb_encrypted_2/t_24
innodb_encrypted_2/t_25
innodb_encrypted_2/t_26
innodb_encrypted_2/t_27
innodb_encrypted_2/t_28
innodb_encrypted_2/t_29
innodb_encrypted_2/t_3
innodb_encrypted_2/t_30
innodb_encrypted_2/t_31
innodb_encrypted_2/t_32
innodb_encrypted_2/t_33
innodb_encrypted_2/t_34
innodb_encrypted_2/t_35
innodb_encrypted_2/t_36
innodb_encrypted_2/t_37
innodb_encrypted_2/t_38
innodb_encrypted_2/t_39
innodb_encrypted_2/t_4
innodb_encrypted_2/t_40
innodb_encrypted_2/t_41
innodb_encrypted_2/t_42
innodb_encrypted_2/t_43
innodb_encrypted_2/t_44
innodb_encrypted_2/t_45
innodb_encrypted_2/t_46
innodb_encrypted_2/t_47
innodb_encrypted_2/t_48
innodb_encrypted_2/t_49
innodb_encrypted_2/t_5
innodb_encrypted_2/t_50
innodb_encrypted_2/t_51
innodb_encrypted_2/t_52
innodb_encrypted_2/t_53
innodb_encrypted_2/t_54
innodb_encrypted_2/t_55
innodb_encrypted_2/t_56
innodb_encrypted_2/t_57
innodb_encrypted_2/t_58
innodb_encrypted_2/t_59
innodb_encrypted_2/t_6
innodb_encrypted_2/t_60
innodb_encrypted_2/t_61
innodb_encrypted_2/t_62
innodb_encrypted_2/t_63
innodb_encrypted_2/t_64
innodb_encrypted_2/t_65
innodb_encrypted_2/t_66
innodb_encrypted_2/t_67
innodb_encrypted_2/t_68
innodb_encrypted_2/t_69
innodb_encrypted_2/t_7
innodb_encrypted_2/t_70
innodb_encrypted_2/t_71
innodb_encrypted_2/t_72
innodb_encrypted_2/t_73
innodb_encrypted_2/t_74
innodb_encrypted_2/t_75
innodb_encrypted_2/t_76
innodb_encrypted_2/t_77
innodb_encrypted_2/t_78
innodb_encrypted_2/t_79
innodb_encrypted_2/t_8
innodb_encrypted_2/t_80
innodb_encrypted_2/t_81
innodb_encrypted_2/t_82
innodb_encrypted_2/t_83
innodb_encrypted_2/t_84
innodb_encrypted_2/t_85
innodb_encrypted_2/t_86
innodb_encrypted_2/t_87
innodb_encrypted_2/t_88
innodb_encrypted_2/t_89
innodb_encrypted_2/t_9
innodb_encrypted_2/t_90
innodb_encrypted_2/t_91
innodb_encrypted_2/t_92
innodb_encrypted_2/t_93
innodb_encrypted_2/t_94
innodb_encrypted_2/t_95
innodb_encrypted_2/t_96
innodb_encrypted_2/t_97
innodb_encrypted_2/t_98
innodb_encrypted_2/t_99
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
NAME
innodb_encrypted_3/t_1
innodb_encrypted_3/t_10
innodb_encrypted_3/t_100
innodb_encrypted_3/t_11
innodb_encrypted_3/t_12
innodb_encrypted_3/t_13
innodb_encrypted_3/t_14
innodb_encrypted_3/t_15
innodb_encrypted_3/t_16
innodb_encrypted_3/t_17
innodb_encrypted_3/t_18
innodb_encrypted_3/t_19
innodb_encrypted_3/t_2
innodb_encrypted_3/t_20
innodb_encrypted_3/t_21
innodb_encrypted_3/t_22
innodb_encrypted_3/t_23
innodb_encrypted_3/t_24
innodb_encrypted_3/t_25
innodb_encrypted_3/t_26
innodb_encrypted_3/t_27
innodb_encrypted_3/t_28
innodb_encrypted_3/t_29
innodb_encrypted_3/t_3
innodb_encrypted_3/t_30
innodb_encrypted_3/t_31
innodb_encrypted_3/t_32
innodb_encrypted_3/t_33
innodb_encrypted_3/t_34
innodb_encrypted_3/t_35
innodb_encrypted_3/t_36
innodb_encrypted_3/t_37
innodb_encrypted_3/t_38
innodb_encrypted_3/t_39
innodb_encrypted_3/t_4
innodb_encrypted_3/t_40
innodb_encrypted_3/t_41
innodb_encrypted_3/t_42
innodb_encrypted_3/t_43
innodb_encrypted_3/t_44
innodb_encrypted_3/t_45
innodb_encrypted_3/t_46
innodb_encrypted_3/t_47
innodb_encrypted_3/t_48
innodb_encrypted_3/t_49
innodb_encrypted_3/t_5
innodb_encrypted_3/t_50
innodb_encrypted_3/t_51
innodb_encrypted_3/t_52
innodb_encrypted_3/t_53
innodb_encrypted_3/t_54
innodb_encrypted_3/t_55
innodb_encrypted_3/t_56
innodb_encrypted_3/t_57
innodb_encrypted_3/t_58
innodb_encrypted_3/t_59
innodb_encrypted_3/t_6
innodb_encrypted_3/t_60
innodb_encrypted_3/t_61
innodb_encrypted_3/t_62
innodb_encrypted_3/t_63
innodb_encrypted_3/t_64
innodb_encrypted_3/t_65
innodb_encrypted_3/t_66
innodb_encrypted_3/t_67
innodb_encrypted_3/t_68
innodb_encrypted_3/t_69
innodb_encrypted_3/t_7
innodb_encrypted_3/t_70
innodb_encrypted_3/t_71
innodb_encrypted_3/t_72
innodb_encrypted_3/t_73
innodb_encrypted_3/t_74
innodb_encrypted_3/t_75
innodb_encrypted_3/t_76
innodb_encrypted_3/t_77
innodb_encrypted_3/t_78
innodb_encrypted_3/t_79
innodb_encrypted_3/t_8
innodb_encrypted_3/t_80
innodb_encrypted_3/t_81
innodb_encrypted_3/t_82
innodb_encrypted_3/t_83
innodb_encrypted_3/t_84
innodb_encrypted_3/t_85
innodb_encrypted_3/t_86
innodb_encrypted_3/t_87
innodb_encrypted_3/t_88
innodb_encrypted_3/t_89
innodb_encrypted_3/t_9
innodb_encrypted_3/t_90
innodb_encrypted_3/t_91
innodb_encrypted_3/t_92
innodb_encrypted_3/t_93
innodb_encrypted_3/t_94
innodb_encrypted_3/t_95
innodb_encrypted_3/t_96
innodb_encrypted_3/t_97
innodb_encrypted_3/t_98
innodb_encrypted_3/t_99
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 3
......@@ -129,26 +819,416 @@ Innodb_pages0_read 203
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 303
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
200
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
NAME
innodb_encrypted_3/t_1
innodb_encrypted_3/t_10
innodb_encrypted_3/t_100
innodb_encrypted_3/t_11
innodb_encrypted_3/t_12
innodb_encrypted_3/t_13
innodb_encrypted_3/t_14
innodb_encrypted_3/t_15
innodb_encrypted_3/t_16
innodb_encrypted_3/t_17
innodb_encrypted_3/t_18
innodb_encrypted_3/t_19
innodb_encrypted_3/t_2
innodb_encrypted_3/t_20
innodb_encrypted_3/t_21
innodb_encrypted_3/t_22
innodb_encrypted_3/t_23
innodb_encrypted_3/t_24
innodb_encrypted_3/t_25
innodb_encrypted_3/t_26
innodb_encrypted_3/t_27
innodb_encrypted_3/t_28
innodb_encrypted_3/t_29
innodb_encrypted_3/t_3
innodb_encrypted_3/t_30
innodb_encrypted_3/t_31
innodb_encrypted_3/t_32
innodb_encrypted_3/t_33
innodb_encrypted_3/t_34
innodb_encrypted_3/t_35
innodb_encrypted_3/t_36
innodb_encrypted_3/t_37
innodb_encrypted_3/t_38
innodb_encrypted_3/t_39
innodb_encrypted_3/t_4
innodb_encrypted_3/t_40
innodb_encrypted_3/t_41
innodb_encrypted_3/t_42
innodb_encrypted_3/t_43
innodb_encrypted_3/t_44
innodb_encrypted_3/t_45
innodb_encrypted_3/t_46
innodb_encrypted_3/t_47
innodb_encrypted_3/t_48
innodb_encrypted_3/t_49
innodb_encrypted_3/t_5
innodb_encrypted_3/t_50
innodb_encrypted_3/t_51
innodb_encrypted_3/t_52
innodb_encrypted_3/t_53
innodb_encrypted_3/t_54
innodb_encrypted_3/t_55
innodb_encrypted_3/t_56
innodb_encrypted_3/t_57
innodb_encrypted_3/t_58
innodb_encrypted_3/t_59
innodb_encrypted_3/t_6
innodb_encrypted_3/t_60
innodb_encrypted_3/t_61
innodb_encrypted_3/t_62
innodb_encrypted_3/t_63
innodb_encrypted_3/t_64
innodb_encrypted_3/t_65
innodb_encrypted_3/t_66
innodb_encrypted_3/t_67
innodb_encrypted_3/t_68
innodb_encrypted_3/t_69
innodb_encrypted_3/t_7
innodb_encrypted_3/t_70
innodb_encrypted_3/t_71
innodb_encrypted_3/t_72
innodb_encrypted_3/t_73
innodb_encrypted_3/t_74
innodb_encrypted_3/t_75
innodb_encrypted_3/t_76
innodb_encrypted_3/t_77
innodb_encrypted_3/t_78
innodb_encrypted_3/t_79
innodb_encrypted_3/t_8
innodb_encrypted_3/t_80
innodb_encrypted_3/t_81
innodb_encrypted_3/t_82
innodb_encrypted_3/t_83
innodb_encrypted_3/t_84
innodb_encrypted_3/t_85
innodb_encrypted_3/t_86
innodb_encrypted_3/t_87
innodb_encrypted_3/t_88
innodb_encrypted_3/t_89
innodb_encrypted_3/t_9
innodb_encrypted_3/t_90
innodb_encrypted_3/t_91
innodb_encrypted_3/t_92
innodb_encrypted_3/t_93
innodb_encrypted_3/t_94
innodb_encrypted_3/t_95
innodb_encrypted_3/t_96
innodb_encrypted_3/t_97
innodb_encrypted_3/t_98
innodb_encrypted_3/t_99
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
NAME
innodb_encrypted_2/t_1
innodb_encrypted_2/t_10
innodb_encrypted_2/t_100
innodb_encrypted_2/t_11
innodb_encrypted_2/t_12
innodb_encrypted_2/t_13
innodb_encrypted_2/t_14
innodb_encrypted_2/t_15
innodb_encrypted_2/t_16
innodb_encrypted_2/t_17
innodb_encrypted_2/t_18
innodb_encrypted_2/t_19
innodb_encrypted_2/t_2
innodb_encrypted_2/t_20
innodb_encrypted_2/t_21
innodb_encrypted_2/t_22
innodb_encrypted_2/t_23
innodb_encrypted_2/t_24
innodb_encrypted_2/t_25
innodb_encrypted_2/t_26
innodb_encrypted_2/t_27
innodb_encrypted_2/t_28
innodb_encrypted_2/t_29
innodb_encrypted_2/t_3
innodb_encrypted_2/t_30
innodb_encrypted_2/t_31
innodb_encrypted_2/t_32
innodb_encrypted_2/t_33
innodb_encrypted_2/t_34
innodb_encrypted_2/t_35
innodb_encrypted_2/t_36
innodb_encrypted_2/t_37
innodb_encrypted_2/t_38
innodb_encrypted_2/t_39
innodb_encrypted_2/t_4
innodb_encrypted_2/t_40
innodb_encrypted_2/t_41
innodb_encrypted_2/t_42
innodb_encrypted_2/t_43
innodb_encrypted_2/t_44
innodb_encrypted_2/t_45
innodb_encrypted_2/t_46
innodb_encrypted_2/t_47
innodb_encrypted_2/t_48
innodb_encrypted_2/t_49
innodb_encrypted_2/t_5
innodb_encrypted_2/t_50
innodb_encrypted_2/t_51
innodb_encrypted_2/t_52
innodb_encrypted_2/t_53
innodb_encrypted_2/t_54
innodb_encrypted_2/t_55
innodb_encrypted_2/t_56
innodb_encrypted_2/t_57
innodb_encrypted_2/t_58
innodb_encrypted_2/t_59
innodb_encrypted_2/t_6
innodb_encrypted_2/t_60
innodb_encrypted_2/t_61
innodb_encrypted_2/t_62
innodb_encrypted_2/t_63
innodb_encrypted_2/t_64
innodb_encrypted_2/t_65
innodb_encrypted_2/t_66
innodb_encrypted_2/t_67
innodb_encrypted_2/t_68
innodb_encrypted_2/t_69
innodb_encrypted_2/t_7
innodb_encrypted_2/t_70
innodb_encrypted_2/t_71
innodb_encrypted_2/t_72
innodb_encrypted_2/t_73
innodb_encrypted_2/t_74
innodb_encrypted_2/t_75
innodb_encrypted_2/t_76
innodb_encrypted_2/t_77
innodb_encrypted_2/t_78
innodb_encrypted_2/t_79
innodb_encrypted_2/t_8
innodb_encrypted_2/t_80
innodb_encrypted_2/t_81
innodb_encrypted_2/t_82
innodb_encrypted_2/t_83
innodb_encrypted_2/t_84
innodb_encrypted_2/t_85
innodb_encrypted_2/t_86
innodb_encrypted_2/t_87
innodb_encrypted_2/t_88
innodb_encrypted_2/t_89
innodb_encrypted_2/t_9
innodb_encrypted_2/t_90
innodb_encrypted_2/t_91
innodb_encrypted_2/t_92
innodb_encrypted_2/t_93
innodb_encrypted_2/t_94
innodb_encrypted_2/t_95
innodb_encrypted_2/t_96
innodb_encrypted_2/t_97
innodb_encrypted_2/t_98
innodb_encrypted_2/t_99
SET GLOBAL innodb_encrypt_tables = off;
SET GLOBAL innodb_encryption_threads=4;
# Wait until all default encrypted tables have been decrypted
# should be 100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
100
# should be 200
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
200
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 303
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
NAME
innodb_encrypted_2/t_1
innodb_encrypted_2/t_10
innodb_encrypted_2/t_100
innodb_encrypted_2/t_11
innodb_encrypted_2/t_12
innodb_encrypted_2/t_13
innodb_encrypted_2/t_14
innodb_encrypted_2/t_15
innodb_encrypted_2/t_16
innodb_encrypted_2/t_17
innodb_encrypted_2/t_18
innodb_encrypted_2/t_19
innodb_encrypted_2/t_2
innodb_encrypted_2/t_20
innodb_encrypted_2/t_21
innodb_encrypted_2/t_22
innodb_encrypted_2/t_23
innodb_encrypted_2/t_24
innodb_encrypted_2/t_25
innodb_encrypted_2/t_26
innodb_encrypted_2/t_27
innodb_encrypted_2/t_28
innodb_encrypted_2/t_29
innodb_encrypted_2/t_3
innodb_encrypted_2/t_30
innodb_encrypted_2/t_31
innodb_encrypted_2/t_32
innodb_encrypted_2/t_33
innodb_encrypted_2/t_34
innodb_encrypted_2/t_35
innodb_encrypted_2/t_36
innodb_encrypted_2/t_37
innodb_encrypted_2/t_38
innodb_encrypted_2/t_39
innodb_encrypted_2/t_4
innodb_encrypted_2/t_40
innodb_encrypted_2/t_41
innodb_encrypted_2/t_42
innodb_encrypted_2/t_43
innodb_encrypted_2/t_44
innodb_encrypted_2/t_45
innodb_encrypted_2/t_46
innodb_encrypted_2/t_47
innodb_encrypted_2/t_48
innodb_encrypted_2/t_49
innodb_encrypted_2/t_5
innodb_encrypted_2/t_50
innodb_encrypted_2/t_51
innodb_encrypted_2/t_52
innodb_encrypted_2/t_53
innodb_encrypted_2/t_54
innodb_encrypted_2/t_55
innodb_encrypted_2/t_56
innodb_encrypted_2/t_57
innodb_encrypted_2/t_58
innodb_encrypted_2/t_59
innodb_encrypted_2/t_6
innodb_encrypted_2/t_60
innodb_encrypted_2/t_61
innodb_encrypted_2/t_62
innodb_encrypted_2/t_63
innodb_encrypted_2/t_64
innodb_encrypted_2/t_65
innodb_encrypted_2/t_66
innodb_encrypted_2/t_67
innodb_encrypted_2/t_68
innodb_encrypted_2/t_69
innodb_encrypted_2/t_7
innodb_encrypted_2/t_70
innodb_encrypted_2/t_71
innodb_encrypted_2/t_72
innodb_encrypted_2/t_73
innodb_encrypted_2/t_74
innodb_encrypted_2/t_75
innodb_encrypted_2/t_76
innodb_encrypted_2/t_77
innodb_encrypted_2/t_78
innodb_encrypted_2/t_79
innodb_encrypted_2/t_8
innodb_encrypted_2/t_80
innodb_encrypted_2/t_81
innodb_encrypted_2/t_82
innodb_encrypted_2/t_83
innodb_encrypted_2/t_84
innodb_encrypted_2/t_85
innodb_encrypted_2/t_86
innodb_encrypted_2/t_87
innodb_encrypted_2/t_88
innodb_encrypted_2/t_89
innodb_encrypted_2/t_9
innodb_encrypted_2/t_90
innodb_encrypted_2/t_91
innodb_encrypted_2/t_92
innodb_encrypted_2/t_93
innodb_encrypted_2/t_94
innodb_encrypted_2/t_95
innodb_encrypted_2/t_96
innodb_encrypted_2/t_97
innodb_encrypted_2/t_98
innodb_encrypted_2/t_99
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
NAME
innodb_encrypted_3/t_1
innodb_encrypted_3/t_10
innodb_encrypted_3/t_100
innodb_encrypted_3/t_11
innodb_encrypted_3/t_12
innodb_encrypted_3/t_13
innodb_encrypted_3/t_14
innodb_encrypted_3/t_15
innodb_encrypted_3/t_16
innodb_encrypted_3/t_17
innodb_encrypted_3/t_18
innodb_encrypted_3/t_19
innodb_encrypted_3/t_2
innodb_encrypted_3/t_20
innodb_encrypted_3/t_21
innodb_encrypted_3/t_22
innodb_encrypted_3/t_23
innodb_encrypted_3/t_24
innodb_encrypted_3/t_25
innodb_encrypted_3/t_26
innodb_encrypted_3/t_27
innodb_encrypted_3/t_28
innodb_encrypted_3/t_29
innodb_encrypted_3/t_3
innodb_encrypted_3/t_30
innodb_encrypted_3/t_31
innodb_encrypted_3/t_32
innodb_encrypted_3/t_33
innodb_encrypted_3/t_34
innodb_encrypted_3/t_35
innodb_encrypted_3/t_36
innodb_encrypted_3/t_37
innodb_encrypted_3/t_38
innodb_encrypted_3/t_39
innodb_encrypted_3/t_4
innodb_encrypted_3/t_40
innodb_encrypted_3/t_41
innodb_encrypted_3/t_42
innodb_encrypted_3/t_43
innodb_encrypted_3/t_44
innodb_encrypted_3/t_45
innodb_encrypted_3/t_46
innodb_encrypted_3/t_47
innodb_encrypted_3/t_48
innodb_encrypted_3/t_49
innodb_encrypted_3/t_5
innodb_encrypted_3/t_50
innodb_encrypted_3/t_51
innodb_encrypted_3/t_52
innodb_encrypted_3/t_53
innodb_encrypted_3/t_54
innodb_encrypted_3/t_55
innodb_encrypted_3/t_56
innodb_encrypted_3/t_57
innodb_encrypted_3/t_58
innodb_encrypted_3/t_59
innodb_encrypted_3/t_6
innodb_encrypted_3/t_60
innodb_encrypted_3/t_61
innodb_encrypted_3/t_62
innodb_encrypted_3/t_63
innodb_encrypted_3/t_64
innodb_encrypted_3/t_65
innodb_encrypted_3/t_66
innodb_encrypted_3/t_67
innodb_encrypted_3/t_68
innodb_encrypted_3/t_69
innodb_encrypted_3/t_7
innodb_encrypted_3/t_70
innodb_encrypted_3/t_71
innodb_encrypted_3/t_72
innodb_encrypted_3/t_73
innodb_encrypted_3/t_74
innodb_encrypted_3/t_75
innodb_encrypted_3/t_76
innodb_encrypted_3/t_77
innodb_encrypted_3/t_78
innodb_encrypted_3/t_79
innodb_encrypted_3/t_8
innodb_encrypted_3/t_80
innodb_encrypted_3/t_81
innodb_encrypted_3/t_82
innodb_encrypted_3/t_83
innodb_encrypted_3/t_84
innodb_encrypted_3/t_85
innodb_encrypted_3/t_86
innodb_encrypted_3/t_87
innodb_encrypted_3/t_88
innodb_encrypted_3/t_89
innodb_encrypted_3/t_9
innodb_encrypted_3/t_90
innodb_encrypted_3/t_91
innodb_encrypted_3/t_92
innodb_encrypted_3/t_93
innodb_encrypted_3/t_94
innodb_encrypted_3/t_95
innodb_encrypted_3/t_96
innodb_encrypted_3/t_97
innodb_encrypted_3/t_98
innodb_encrypted_3/t_99
use test;
drop database innodb_encrypted_1;
drop database innodb_encrypted_2;
......
......@@ -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;
......@@ -15,78 +15,29 @@ SET @start_global_value = @@global.innodb_encryption_threads;
SHOW VARIABLES LIKE 'innodb_encrypt%';
DESCRIBE INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
--echo # Wait max 5 min for key encryption threads to encrypt one space
let $cnt=300;
while ($cnt)
{
let $success=`SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION > 0`;
if ($success)
{
let $cnt=0;
}
if (!$success)
{
real_sleep 1;
dec $cnt;
}
}
if (!$success)
{
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
SHOW STATUS LIKE 'innodb_encryption%';
-- die Timeout waiting for encryption threads
}
--echo # Success!
SET GLOBAL innodb_encrypt_tables = ON;
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) >= 1 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/wait_condition.inc
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--echo # Wait max 10 min for key encryption threads to encrypt all space
let $cnt=600;
while ($cnt)
{
let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0`;
if ($success)
{
let $cnt=0;
}
if (!$success)
{
real_sleep 1;
dec $cnt;
}
}
if (!$success)
{
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
SHOW STATUS LIKE 'innodb_encryption%';
-- die Timeout waiting for encryption threads
}
--echo # Success!
--echo # Now turn off encryption and wait for threads to decrypt everything
SET GLOBAL innodb_encrypt_tables = off;
--echo # Wait max 10 min for key encryption threads to decrypt all space
let $cnt=600;
while ($cnt)
{
let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0`;
if ($success)
{
let $cnt=0;
}
if (!$success)
{
real_sleep 1;
dec $cnt;
}
}
if (!$success)
{
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
SHOW STATUS LIKE 'innodb_encryption%';
-- die Timeout waiting for encryption threads
}
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/wait_condition.inc
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--echo # Success!
--echo # Shutdown innodb_encryption_threads
......@@ -97,84 +48,32 @@ SET GLOBAL innodb_encryption_threads=0;
SET GLOBAL innodb_encrypt_tables = on;
--echo # Wait 15s to check that nothing gets encrypted
let $cnt=15;
while ($cnt)
{
let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0`;
if ($success)
{
real_sleep 1;
dec $cnt;
}
if (!$success)
{
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
-- die Failure, tablespace getting encrypted even if innodb_encryption_threads=0
}
}
--let $wait_timeout= 15
--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/wait_condition.inc
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--echo # Success!
--echo # Startup innodb_encryption_threads
SET GLOBAL innodb_encryption_threads=@start_global_value;
--echo # Wait 1 min to check that it start encrypting again
let $cnt=60;
while ($cnt)
{
let $success=`SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 OR KEY_ROTATION_PAGE_NUMBER IS NOT NULL`;
if ($success)
{
let $cnt=0;
}
if (!$success)
{
real_sleep 1;
dec $cnt;
}
}
if (!$success)
{
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
SHOW STATUS LIKE 'innodb_encryption%';
-- die Timeout waiting for encryption threads
}
--echo # Success!
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) >=1 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/wait_condition.inc
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--echo #
--echo # Check that restart with encryption turned off works
--echo # even if spaces are encrypted
--echo #
--echo # First wait max 10 min for key encryption threads to encrypt all spaces
let $cnt=600;
while ($cnt)
{
let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0`;
if ($success)
{
let $cnt=0;
}
if (!$success)
{
real_sleep 1;
dec $cnt;
}
}
if (!$success)
{
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
SHOW STATUS LIKE 'innodb_encryption%';
-- die Timeout waiting for encryption threads
}
--echo # Success!
--echo # Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0
-- let $restart_parameters=--innodb_encrypt_tables=0 --innodb_encryption_threads=0
-- source include/restart_mysqld.inc
SHOW VARIABLES LIKE 'innodb_encrypt%';
SELECT COUNT(*) > 0 as should_be_1
FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
WHERE MIN_KEY_VERSION <> 0;
--echo # Restart mysqld again...with default options
-- let $restart_parameters=
-- source include/restart_mysqld.inc
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
......@@ -53,9 +53,8 @@ show status like 'innodb_pages0_read%';
#
# Verify
#
--echo # should be 100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE NAME LIKE 'innodb_encrypted%';
--echo # should be empty
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE NAME LIKE 'innodb_encrypted%';
#
# This will create 100 tables that are encrypted always
......@@ -89,10 +88,10 @@ show status like 'innodb_pages0_read%';
#
# Verify
#
--echo # should be 100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%';
--echo # should be 100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
--echo # should contain 100 tables
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
--echo # should contain 0 tables
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
#
# This will create 100 tables that are not encrypted
......@@ -126,45 +125,26 @@ show status like 'innodb_pages0_read%';
#
# Verify
#
--echo # should be 100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%';
--echo # should be 200
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
--echo # should contain 100 tables
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
--echo # should contain 100 tables
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
use test;
show status like 'innodb_pages0_read%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
SET GLOBAL innodb_encrypt_tables = on;
SET GLOBAL innodb_encryption_threads=4;
--echo # Wait until all encrypted tables have been encrypted
let $cnt=600;
while ($cnt)
{
let $success=`SELECT COUNT(*) = 100 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0`;
if ($success)
{
let $cnt=0;
}
if (!$success)
{
real_sleep 1;
dec $cnt;
}
}
if (!$success)
{
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
SHOW STATUS LIKE 'innodb_encryption%';
-- die Timeout waiting for encryption threads
}
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 100 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/wait_condition.inc
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
show status like 'innodb_pages0_read%';
--echo # Success!
......@@ -231,40 +211,19 @@ while ($tables)
show status like 'innodb_pages0_read%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%';
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
SET GLOBAL innodb_encrypt_tables = off;
SET GLOBAL innodb_encryption_threads=4;
--echo # Wait until all default encrypted tables have been decrypted
let $cnt=600;
while ($cnt)
{
let $success=`SELECT COUNT(*) = 100 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0`;
if ($success)
{
let $cnt=0;
}
if (!$success)
{
real_sleep 1;
dec $cnt;
}
}
if (!$success)
{
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
SHOW STATUS LIKE 'innodb_encryption%';
-- die Timeout waiting for encryption threads
}
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 100 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/wait_condition.inc
--echo # should be 100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%';
--echo # should be 200
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
show status like 'innodb_pages0_read%';
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%' ORDER BY NAME;
#
# Cleanup
......
......@@ -1403,7 +1403,7 @@ fil_crypt_realloc_iops(
DBUG_PRINT("ib_crypt",
("thr_no: %u only waited %lu%% skip re-estimate.",
state->thread_no,
(100 * state->cnt_waited) / state->batch));
(100 * state->cnt_waited) / (state->batch ? state->batch : 1)));
}
if (state->estimated_max_iops <= state->allocated_iops) {
......@@ -1506,7 +1506,7 @@ fil_crypt_find_space_to_rotate(
/* we need iops to start rotating */
while (!state->should_shutdown() && !fil_crypt_alloc_iops(state)) {
os_event_reset(fil_crypt_threads_event);
os_event_wait_time(fil_crypt_threads_event, 1000000);
os_event_wait_time(fil_crypt_threads_event, 100000);
}
if (state->should_shutdown()) {
......@@ -2303,7 +2303,7 @@ fil_crypt_set_thread_cnt(
os_thread_create(fil_crypt_thread, NULL, &rotation_thread_id);
ib_logf(IB_LOG_LEVEL_INFO,
"Creating #%d thread id %lu total threads %u.",
"Creating #%d encryption thread id %lu total threads %u.",
i+1, os_thread_pf(rotation_thread_id), new_cnt);
}
} else if (new_cnt < srv_n_fil_crypt_threads) {
......@@ -2315,7 +2315,13 @@ fil_crypt_set_thread_cnt(
while(srv_n_fil_crypt_threads_started != srv_n_fil_crypt_threads) {
os_event_reset(fil_crypt_event);
os_event_wait_time(fil_crypt_event, 1000000);
os_event_wait_time(fil_crypt_event, 100000);
}
/* Send a message to encryption threads that there could be
something to do. */
if (srv_n_fil_crypt_threads) {
os_event_set(fil_crypt_threads_event);
}
}
......@@ -2461,9 +2467,10 @@ fil_space_crypt_get_status(
ut_ad(space->n_pending_ops > 0);
fil_crypt_read_crypt_data(const_cast<fil_space_t*>(space));
status->space = space->id;
status->space = ULINT_UNDEFINED;
if (fil_space_crypt_t* crypt_data = space->crypt_data) {
status->space = space->id;
mutex_enter(&crypt_data->mutex);
status->scheme = crypt_data->type;
status->keyserver_requests = crypt_data->keyserver_requests;
......
......@@ -2214,7 +2214,7 @@ fil_write_flushed_lsn(
/* If tablespace is not encrypted, stamp flush_lsn to
first page of all system tablespace datafiles to avoid
unnecessary error messages on possible downgrade. */
if (space->crypt_data->min_key_version == 0) {
if (!space->crypt_data || space->crypt_data->min_key_version == 0) {
fil_node_t* node;
ulint sum_of_sizes = 0;
......
......@@ -726,7 +726,11 @@ fsp_header_init(ulint space_id, ulint size, mtr_t* mtr)
fil_space_t* space = fil_space_acquire(space_id);
ut_ad(space);
if (space->crypt_data) {
/* Write encryption metadata to page 0 if tablespace is
encrypted or encryption is disabled by table option. */
if (space->crypt_data &&
(space->crypt_data->should_encrypt() ||
space->crypt_data->not_encrypted())) {
space->crypt_data->write_page0(page, mtr);
}
......
......@@ -8212,6 +8212,12 @@ i_s_dict_fill_tablespaces_encryption(
fil_space_crypt_get_status(space, &status);
/* If tablespace id does not match, we did not find
encryption information for this tablespace. */
if (!space->crypt_data || space->id != status.space) {
goto skip;
}
OK(fields[TABLESPACES_ENCRYPTION_SPACE]->store(space->id));
OK(field_store_string(fields[TABLESPACES_ENCRYPTION_NAME],
......@@ -8246,6 +8252,7 @@ i_s_dict_fill_tablespaces_encryption(
OK(schema_table_store_record(thd, table_to_fill));
skip:
DBUG_RETURN(0);
}
/*******************************************************************//**
......
......@@ -1191,11 +1191,6 @@ open_or_create_data_files(
ut_a(ret);
if (i == 0) {
if (!crypt_data) {
crypt_data = fil_space_create_crypt_data(FIL_ENCRYPTION_DEFAULT,
FIL_DEFAULT_ENCRYPTION_KEY);
}
flags = FSP_FLAGS_PAGE_SSIZE();
fil_space_create(name, 0, flags, FIL_TABLESPACE,
......
......@@ -1403,7 +1403,7 @@ fil_crypt_realloc_iops(
DBUG_PRINT("ib_crypt",
("thr_no: %u only waited %lu%% skip re-estimate.",
state->thread_no,
(100 * state->cnt_waited) / state->batch));
(100 * state->cnt_waited) / (state->batch ? state->batch : 1)));
}
if (state->estimated_max_iops <= state->allocated_iops) {
......@@ -1506,7 +1506,7 @@ fil_crypt_find_space_to_rotate(
/* we need iops to start rotating */
while (!state->should_shutdown() && !fil_crypt_alloc_iops(state)) {
os_event_reset(fil_crypt_threads_event);
os_event_wait_time(fil_crypt_threads_event, 1000000);
os_event_wait_time(fil_crypt_threads_event, 100000);
}
if (state->should_shutdown()) {
......@@ -2303,7 +2303,7 @@ fil_crypt_set_thread_cnt(
os_thread_create(fil_crypt_thread, NULL, &rotation_thread_id);
ib_logf(IB_LOG_LEVEL_INFO,
"Creating #%d thread id %lu total threads %u.",
"Creating #%d encryption thread id %lu total threads %u.",
i+1, os_thread_pf(rotation_thread_id), new_cnt);
}
} else if (new_cnt < srv_n_fil_crypt_threads) {
......@@ -2315,7 +2315,13 @@ fil_crypt_set_thread_cnt(
while(srv_n_fil_crypt_threads_started != srv_n_fil_crypt_threads) {
os_event_reset(fil_crypt_event);
os_event_wait_time(fil_crypt_event, 1000000);
os_event_wait_time(fil_crypt_event, 100000);
}
/* Send a message to encryption threads that there could be
something to do. */
if (srv_n_fil_crypt_threads) {
os_event_set(fil_crypt_threads_event);
}
}
......@@ -2461,9 +2467,10 @@ fil_space_crypt_get_status(
ut_ad(space->n_pending_ops > 0);
fil_crypt_read_crypt_data(const_cast<fil_space_t*>(space));
status->space = space->id;
status->space = ULINT_UNDEFINED;
if (fil_space_crypt_t* crypt_data = space->crypt_data) {
status->space = space->id;
mutex_enter(&crypt_data->mutex);
status->scheme = crypt_data->type;
status->keyserver_requests = crypt_data->keyserver_requests;
......
......@@ -654,7 +654,7 @@ fil_node_open_file(
page = static_cast<byte*>(ut_align(buf2, UNIV_PAGE_SIZE));
success = os_file_read(node->handle, page, 0, UNIV_PAGE_SIZE);
srv_stats.page0_read.add(1);
srv_stats.page0_read.inc();
const ulint space_id = fsp_header_get_space_id(page);
ulint flags = fsp_header_get_flags(page);
......@@ -2268,7 +2268,7 @@ fil_write_flushed_lsn(
/* If tablespace is not encrypted, stamp flush_lsn to
first page of all system tablespace datafiles to avoid
unnecessary error messages on possible downgrade. */
if (space->crypt_data->min_key_version == 0) {
if (!space->crypt_data || space->crypt_data->min_key_version == 0) {
fil_node_t* node;
ulint sum_of_sizes = 0;
......@@ -2414,7 +2414,7 @@ fil_read_first_page(
os_file_read(data_file, page, 0, UNIV_PAGE_SIZE);
srv_stats.page0_read.add(1);
srv_stats.page0_read.inc();
/* The FSP_HEADER on page 0 is only valid for the first file
in a tablespace. So if this is not the first datafile, leave
......
......@@ -729,7 +729,11 @@ fsp_header_init(ulint space_id, ulint size, mtr_t* mtr)
fil_space_t* space = fil_space_acquire(space_id);
ut_ad(space);
if (space->crypt_data) {
/* Write encryption metadata to page 0 if tablespace is
encrypted or encryption is disabled by table option. */
if (space->crypt_data &&
(space->crypt_data->should_encrypt() ||
space->crypt_data->not_encrypted())) {
space->crypt_data->write_page0(page, mtr);
}
......
......@@ -8524,6 +8524,12 @@ i_s_dict_fill_tablespaces_encryption(
fil_space_crypt_get_status(space, &status);
/* If tablespace id does not match, we did not find
encryption information for this tablespace. */
if (!space->crypt_data || space->id != status.space) {
goto skip;
}
OK(fields[TABLESPACES_ENCRYPTION_SPACE]->store(space->id));
OK(field_store_string(fields[TABLESPACES_ENCRYPTION_NAME],
......@@ -8558,6 +8564,7 @@ i_s_dict_fill_tablespaces_encryption(
OK(schema_table_store_record(thd, table_to_fill));
skip:
DBUG_RETURN(0);
}
/*******************************************************************//**
......
......@@ -1228,11 +1228,6 @@ open_or_create_data_files(
ut_a(ret);
if (i == 0) {
if (!crypt_data) {
crypt_data = fil_space_create_crypt_data(FIL_ENCRYPTION_DEFAULT,
FIL_DEFAULT_ENCRYPTION_KEY);
}
flags = FSP_FLAGS_PAGE_SSIZE();
fil_space_create(name, 0, flags, FIL_TABLESPACE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment