mirror of
https://github.com/MariaDB/server.git
synced 2025-07-04 01:23:45 +03:00
fsp_free_page() writes MLOG_INIT_FREE_PAGE, but does not update page type. But fil_crypt_rotate_page() checks the type to understand if the page is freshly initialized, and writes dummy record(updates space id) to force rotation during recovery. This dummy record causes assertion crash when the page is flushed after recovery, as it's supposed that pages LSN is 0 for freshly initialized pages. The bug is similiar to MDEV-24695, the difference is that in 10.5 the assertion crashes during log record applying, but in 10.4 it crashes during page flushing. The fix could be in marking page as freed and not writing dummy record during keys rotation procedure for such marked pages. But bpage->file_page_was_freed is not consistent enough for release builds in 10.4, and the issue is fixed in 10.5 and does not exist in 10.[23] as MLOG_INIT_FREE_PAGE was introduced since 10.4. So the better solution is just to relax the assertion and implement some additional property for freshly allocated pages, and check this property during pages flushing. The test is copied from MDEV-24695, the only change is in forcing pages flushing after each server start to cause crash in non-fixed code. There is no need to merge it to 10.5+, as the bug is already fixed by MDEV-24695.
99 lines
4.5 KiB
Plaintext
99 lines
4.5 KiB
Plaintext
#
|
|
#
|
|
#
|
|
-- source include/have_innodb.inc
|
|
-- source include/have_example_key_management_plugin.inc
|
|
-- source include/innodb_undo_tablespaces.inc
|
|
|
|
# embedded does not support restart
|
|
-- source include/not_embedded.inc
|
|
|
|
SET @start_global_value = @@global.innodb_encryption_threads;
|
|
|
|
SHOW VARIABLES LIKE 'innodb_encrypt%';
|
|
|
|
SET GLOBAL innodb_encrypt_tables = ON;
|
|
|
|
--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces + 1 from information_schema.tables where engine = 'InnoDB'`
|
|
|
|
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
|
|
--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
|
|
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
|
|
|
|
--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 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
|
|
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
|
|
|
|
--echo # Success!
|
|
|
|
--echo # Shutdown innodb_encryption_threads
|
|
SET GLOBAL innodb_encryption_threads=0;
|
|
|
|
--echo # Turn on encryption
|
|
--echo # since threads are off tables should remain unencrypted
|
|
SET GLOBAL innodb_encrypt_tables = on;
|
|
|
|
--echo # Wait 15s to check that nothing gets encrypted
|
|
--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
|
|
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
|
|
|
|
--echo # Success!
|
|
|
|
--echo # Startup innodb_encryption_threads
|
|
SET GLOBAL innodb_encryption_threads=@start_global_value;
|
|
|
|
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
|
|
--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
|
|
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
|
|
|
|
--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%';
|
|
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats' AND NAME NOT LIKE 'mysql/transaction_registry';
|