Skip to content

Commit d7d7304

Browse files
committed
MDEV-36556: MariaDB restart after upgrade fails with innodb_encrypt_tables
ibuf_upgrade_needed(): Adjust the check for the case that the InnoDB system tablespace had been created without innodb_checksum_algorithm=full_crc32 and innodb_encrypt_tables was enabled at the time the change buffer was upgraded.
1 parent 5b72e95 commit d7d7304

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

mysql-test/suite/encryption/r/recovery_memory.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
SET GLOBAL innodb_encrypt_tables=ON,innodb_encryption_threads=1;
2+
SET GLOBAL innodb_saved_page_number_debug=4,innodb_fil_make_page_dirty_debug=0;
13
CREATE TABLE t1(f1 text, index idx(f1(20))) ENGINE INNODB;
24
set global innodb_fast_shutdown=0;
35
# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[full_crc32]
2+
--innodb-checksum-algorithm=full_crc32
3+
[crc32]
4+
--innodb-checksum-algorithm=crc32

mysql-test/suite/encryption/t/recovery_memory.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
77
let MYSQLD_DATADIR=`select @@datadir`;
8+
# Encrypt the change buffer root page
9+
SET GLOBAL innodb_encrypt_tables=ON,innodb_encryption_threads=1;
10+
SET GLOBAL innodb_saved_page_number_debug=4,innodb_fil_make_page_dirty_debug=0;
811

912
CREATE TABLE t1(f1 text, index idx(f1(20))) ENGINE INNODB;
1013

storage/innobase/ibuf/ibuf0ibuf.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,10 +1046,13 @@ dberr_t ibuf_upgrade_needed()
10461046
if (!root)
10471047
goto err_exit;
10481048

1049+
const size_t payload= fil_system.sys_space->full_crc32() ||
1050+
!fil_system.sys_space->crypt_data
1051+
? FIL_PAGE_TYPE : FIL_PAGE_SPACE_ID;
1052+
10491053
if (UNIV_LIKELY(!page_has_siblings(root->page.frame)) &&
1050-
UNIV_LIKELY(!memcmp(root->page.frame + FIL_PAGE_TYPE, field_ref_zero,
1051-
srv_page_size -
1052-
(FIL_PAGE_DATA_END + FIL_PAGE_TYPE))))
1054+
UNIV_LIKELY(!memcmp(root->page.frame + payload, field_ref_zero,
1055+
srv_page_size - (FIL_PAGE_DATA_END + payload))))
10531056
/* the change buffer was removed; no need to upgrade */;
10541057
else if (page_is_comp(root->page.frame) ||
10551058
btr_page_get_index_id(root->page.frame) != ibuf_index_id ||

0 commit comments

Comments
 (0)