mirror of
https://github.com/MariaDB/server.git
synced 2025-06-03 07:02:23 +03:00
Also fixes MDEV-23929: innodb_flush_neighbors is not being ignored for system tablespace on SSD When the maximum configured number of file is exceeded, InnoDB will close data files. We used to maintain a fil_system.LRU list and a counter fil_node_t::n_pending to achieve this, at the huge cost of multiple fil_system.mutex operations per I/O operation. fil_node_open_file_low(): Implement a FIFO replacement policy: The last opened file will be moved to the end of fil_system.space_list, and files will be closed from the start of the list. However, we will not move tablespaces in fil_system.space_list while i_s_tablespaces_encryption_fill_table() is executing (producing output for INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION) because it may cause information of some tablespaces to go missing. We also avoid this in mariabackup --backup because datafiles_iter_next() assumes that the ordering is not changed. IORequest: Fold more parameters to IORequest::type. fil_space_t::io(): Replaces fil_io(). fil_space_t::flush(): Replaces fil_flush(). OS_AIO_IBUF: Remove. We will always issue synchronous reads of the change buffer pages in buf_read_page_low(). We will always ignore some errors for background reads. This should reduce fil_system.mutex contention a little. fil_node_t::complete_write(): Replaces fil_node_t::complete_io(). On both read and write completion, fil_space_t::release_for_io() will have to be called. fil_space_t::io(): Do not acquire fil_system.mutex in the normal code path. xb_delta_open_matching_space(): Do not try to open the system tablespace which was already opened. This fixes a file sharing violation in mariabackup --prepare --incremental. Reviewed by: Vladislav Vaintroub
89 lines
3.8 KiB
Plaintext
89 lines
3.8 KiB
Plaintext
-- source include/have_innodb.inc
|
|
-- source include/not_embedded.inc
|
|
-- source include/have_example_key_management_plugin.inc
|
|
|
|
CREATE TABLE t1 (f1 INT, f2 VARCHAR(256))engine=innodb;
|
|
INSERT INTO t1 VALUES(1, 'MariaDB'), (2, 'Robot'), (3, 'Science');
|
|
INSERT INTO t1 SELECT * FROM t1;
|
|
|
|
CREATE TABLE t2(f1 INT, f2 VARCHAR(256))engine=innodb;
|
|
INSERT INTO t2 SELECT * FROM t1;
|
|
|
|
CREATE TABLE t3(f1 INT, f2 VARCHAR(256))engine=innodb encrypted=yes;
|
|
INSERT INTO t3 SELECT * FROM t1;
|
|
|
|
--echo # Restart the server with encryption
|
|
|
|
let $restart_noprint=2;
|
|
let $restart_parameters= --innodb_encryption_threads=5 --innodb_encryption_rotate_key_age=16384;
|
|
--source include/restart_mysqld.inc
|
|
|
|
--echo # Wait until encryption threads have encrypted all tablespaces
|
|
|
|
--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
|
|
--let $wait_timeout= 600
|
|
--let $wait_condition=SELECT COUNT(*) >= $tables_count 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;
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
|
|
--echo # Restart the server with innodb_encryption_rotate_key_age= 0
|
|
|
|
let $restart_parameters= --innodb_encryption_threads=1 --innodb_encryption_rotate_key_age=0;
|
|
|
|
--source include/restart_mysqld.inc
|
|
|
|
create table t4 (f1 int not null)engine=innodb encrypted=NO;
|
|
|
|
--echo # Wait until encryption threads have encrypted all tablespaces
|
|
|
|
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
|
|
--let $wait_timeout= 600
|
|
--let $wait_condition=SELECT COUNT(*) >= $tables_count 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;
|
|
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
|
|
--echo # Disable encryption when innodb_encryption_rotate_key_age is 0
|
|
set global innodb_encrypt_tables = OFF;
|
|
|
|
--echo # Wait until encryption threads to decrypt all unencrypted tablespaces
|
|
|
|
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
|
|
--let $wait_timeout= 600
|
|
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND ROTATING_OR_FLUSHING = 0;
|
|
--source include/wait_condition.inc
|
|
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
|
--echo # Display only encrypted create tables (t3)
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
|
|
--echo # Enable encryption when innodb_encryption_rotate_key_age is 0
|
|
set global innodb_encrypt_tables = ON;
|
|
|
|
--echo # Wait until encryption threads to encrypt all unencrypted tablespaces
|
|
|
|
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
|
|
--let $wait_timeout= 600
|
|
--let $wait_condition=SELECT COUNT(*) >= $tables_count 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;
|
|
--echo # Display only unencrypted create tables (t4)
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
|
|
--let $restart_parameters=
|
|
-- source include/restart_mysqld.inc
|
|
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
DROP TABLE t4, t3, t2, t1;
|