From 67c0fd2a41034eae1ea04b81cace6a154783aedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 30 Oct 2024 09:36:12 +0200 Subject: [PATCH] MDEV-35289 innodb_fast_shutdown=0 might corrupt the system tablespace on 32-bit systems inode_info::get_unused(): Do not try to assign 64 bits into a potentially narrower variable. --- storage/innobase/fsp/fsp0fsp.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 05de5823f25..66a01ffd69d 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -3645,14 +3645,15 @@ public: { const fseg_inode_t *inode= fsp_seg_inode_page_get_nth_inode(block->page.frame, i); - ulint seg_id= mach_read_from_8(FSEG_ID + inode); /* Consider TRX_SYS_FSEG_HEADER as used segment. While reinitializing the undo tablespace, InnoDB fail to reset the value of TRX_SYS_FSEG_HEADER in TRX_SYS page. so InnoDB shouldn't consider this segment as unused one */ - if (seg_id == 0 || seg_id == 2) + switch (mach_read_from_8(FSEG_ID + inode)) { + case 0: case 2: continue; + } uint16_t offset= uint16_t(inode - block->page.frame); if (offset < FIL_PAGE_DATA || offset >= block->physical_size() - FIL_PAGE_DATA_END)