From c73a65f55bb5af8e27c556fa0e9258b26671ed9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 21 Mar 2023 14:33:54 +0200 Subject: [PATCH] MDEV-29692 Assertion `(writeptr + (i * size)) != local_frame' failed upon IMPORT TABLESPACE fil_iterate(): Allocation bitmap pages are never encrypted. Reviewed by: Thirunarayanan Balathandayuthapani --- .../suite/encryption/r/import_4k.result | 10 ++++++++++ mysql-test/suite/encryption/t/import_4k.opt | 1 + mysql-test/suite/encryption/t/import_4k.test | 20 +++++++++++++++++++ storage/innobase/row/row0import.cc | 6 ++++-- 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/encryption/r/import_4k.result create mode 100644 mysql-test/suite/encryption/t/import_4k.opt create mode 100644 mysql-test/suite/encryption/t/import_4k.test diff --git a/mysql-test/suite/encryption/r/import_4k.result b/mysql-test/suite/encryption/r/import_4k.result new file mode 100644 index 00000000000..959e2498e00 --- /dev/null +++ b/mysql-test/suite/encryption/r/import_4k.result @@ -0,0 +1,10 @@ +set @save_limit = @@GLOBAL.innodb_limit_optimistic_insert_debug; +set global innodb_limit_optimistic_insert_debug=3; +create table t1 (a INT PRIMARY KEY) engine=InnoDB ENCRYPTED=YES; +insert into t1 select * from seq_1_to_6000; +flush table t1 for export; +unlock tables; +alter table t1 discard tablespace; +alter table t1 import tablespace; +set global innodb_limit_optimistic_insert_debug=@save_limit; +drop table t1; diff --git a/mysql-test/suite/encryption/t/import_4k.opt b/mysql-test/suite/encryption/t/import_4k.opt new file mode 100644 index 00000000000..e5b58602036 --- /dev/null +++ b/mysql-test/suite/encryption/t/import_4k.opt @@ -0,0 +1 @@ +--innodb-page-size=4k diff --git a/mysql-test/suite/encryption/t/import_4k.test b/mysql-test/suite/encryption/t/import_4k.test new file mode 100644 index 00000000000..aef7c702d12 --- /dev/null +++ b/mysql-test/suite/encryption/t/import_4k.test @@ -0,0 +1,20 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc +--source include/have_example_key_management_plugin.inc +--source include/have_debug.inc + +set @save_limit = @@GLOBAL.innodb_limit_optimistic_insert_debug; +set global innodb_limit_optimistic_insert_debug=3; +create table t1 (a INT PRIMARY KEY) engine=InnoDB ENCRYPTED=YES; +insert into t1 select * from seq_1_to_6000; +flush table t1 for export; +--let $datadir= `select @@datadir` +--copy_file $datadir/test/t1.ibd $datadir/t1.ibd +--copy_file $datadir/test/t1.cfg $datadir/t1.cfg +unlock tables; +alter table t1 discard tablespace; +--move_file $datadir/t1.ibd $datadir/test/t1.ibd +--move_file $datadir/t1.cfg $datadir/test/t1.cfg +alter table t1 import tablespace; +set global innodb_limit_optimistic_insert_debug=@save_limit; +drop table t1; diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 2afe7661e20..c4534938ad5 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -3971,14 +3971,15 @@ page_corrupted: src + FIL_PAGE_SPACE_ID); } + const uint16_t type = fil_page_get_type(src); page_compressed = (full_crc32 && fil_space_t::is_compressed( callback.get_space_flags()) && buf_page_is_compressed( src, callback.get_space_flags())) - || (fil_page_is_compressed_encrypted(src) - || fil_page_is_compressed(src)); + || type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED + || type == FIL_PAGE_PAGE_COMPRESSED; if (page_compressed && block->page.zip.data) { goto page_corrupted; @@ -3997,6 +3998,7 @@ page_corrupted: block->page.zip.data = src; frame_changed = true; } else if (!page_compressed + && type != FIL_PAGE_TYPE_XDES && !block->page.zip.data) { block->frame = src; frame_changed = true;