mirror of
https://github.com/MariaDB/server.git
synced 2025-02-05 13:22:17 +01:00
23833dce05
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.
96 lines
2.9 KiB
Text
96 lines
2.9 KiB
Text
SHOW VARIABLES LIKE 'innodb_encrypt%';
|
|
Variable_name Value
|
|
innodb_encrypt_log ON
|
|
innodb_encrypt_tables ON
|
|
innodb_encrypt_temporary_tables OFF
|
|
innodb_encryption_rotate_key_age 1
|
|
innodb_encryption_rotation_iops 100
|
|
innodb_encryption_threads 1
|
|
SET GLOBAL innodb_encrypt_tables = ON;
|
|
CREATE TABLE t1(f1 BIGINT PRIMARY KEY, f2 int not null,
|
|
f3 int not null, index(f1), index idx_1(f2),
|
|
index(f2, f3)) ENGINE=InnoDB;
|
|
# 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
|
|
innodb_system
|
|
mysql/innodb_index_stats
|
|
mysql/innodb_table_stats
|
|
mysql/transaction_registry
|
|
test/t1
|
|
CREATE TABLE t2 (f1 int not null)engine=innodb;
|
|
# restart: --debug=d,ib_log_checkpoint_avoid
|
|
connect con1,localhost,root,,,;
|
|
begin;
|
|
insert into t2 values(1);
|
|
connection default;
|
|
set global innodb_encrypt_tables = OFF;
|
|
# Wait max 10 min for key encryption threads to decrypt all spaces
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
|
NAME
|
|
innodb_system
|
|
mysql/innodb_index_stats
|
|
mysql/innodb_table_stats
|
|
mysql/transaction_registry
|
|
test/t1
|
|
test/t2
|
|
alter table t1 drop index idx_1;
|
|
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
|
|
innodb_system
|
|
mysql/innodb_index_stats
|
|
mysql/innodb_table_stats
|
|
mysql/transaction_registry
|
|
test/t1
|
|
test/t2
|
|
disconnect con1;
|
|
# restart: --debug=d,ib_log_checkpoint_avoid
|
|
drop table t1, t2;
|
|
CREATE TABLE t1(f1 BIGINT PRIMARY KEY, f2 int not null,
|
|
f3 int not null, index(f1), index idx_1(f2),
|
|
index(f2, f3)) ENGINE=InnoDB;
|
|
# 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
|
|
innodb_system
|
|
mysql/innodb_index_stats
|
|
mysql/innodb_table_stats
|
|
mysql/transaction_registry
|
|
test/t1
|
|
CREATE TABLE t2 (f1 int not null)engine=innodb;
|
|
# restart: --debug=d,ib_log_checkpoint_avoid
|
|
connect con1,localhost,root,,,;
|
|
begin;
|
|
insert into t2 values(1);
|
|
connection default;
|
|
set global innodb_encrypt_tables = OFF;
|
|
# Wait max 10 min for key encryption threads to decrypt all spaces
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
|
NAME
|
|
innodb_system
|
|
mysql/innodb_index_stats
|
|
mysql/innodb_table_stats
|
|
mysql/transaction_registry
|
|
test/t1
|
|
test/t2
|
|
alter table t1 drop index idx_1;
|
|
disconnect con1;
|
|
# restart: --debug=d,ib_log_checkpoint_avoid
|
|
connect con1,localhost,root,,,;
|
|
begin;
|
|
insert into t2 values(1);
|
|
connection default;
|
|
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
|
|
innodb_system
|
|
mysql/innodb_index_stats
|
|
mysql/innodb_table_stats
|
|
mysql/transaction_registry
|
|
test/t1
|
|
test/t2
|
|
disconnect con1;
|
|
drop table t2, t1;
|