Skip to content

Commit aa4f76b

Browse files
MDEV-25018 [FATAL] InnoDB: Unable to read page (of a dropped tablespace)
- This issue is caused by commit deadec4 (MDEV-24569). InnoDB fails to read the change buffer bitmap page from dropped tablespace. In ibuf_bitmap_get_map_page_func(), InnoDB should fetch the page using BUF_GET_POSSIBLY_FREED mode. Callers of ibuf_bitmap_get_map_page() should be adjusted in that case.
1 parent 4b166ca commit aa4f76b

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

storage/innobase/ibuf/ibuf0ibuf.cc

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -688,19 +688,15 @@ ibuf_bitmap_get_map_page_func(
688688
unsigned line,
689689
mtr_t* mtr)
690690
{
691-
buf_block_t* block = NULL;
692-
dberr_t err = DB_SUCCESS;
693-
694-
block = buf_page_get_gen(
691+
buf_block_t* block = buf_page_get_gen(
695692
ibuf_bitmap_page_no_calc(page_id, zip_size),
696-
zip_size, RW_X_LATCH, NULL, BUF_GET, file, line, mtr, &err);
693+
zip_size, RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED,
694+
file, line, mtr);
697695

698-
if (err != DB_SUCCESS) {
699-
return NULL;
696+
if (block) {
697+
buf_block_dbg_add_level(block, SYNC_IBUF_BITMAP);
700698
}
701699

702-
703-
buf_block_dbg_add_level(block, SYNC_IBUF_BITMAP);
704700
return block;
705701
}
706702

@@ -741,9 +737,12 @@ ibuf_set_free_bits_low(
741737
#endif /* UNIV_IBUF_DEBUG */
742738
const page_id_t id(block->page.id());
743739

744-
ibuf_bitmap_page_set_bits<IBUF_BITMAP_FREE>(
745-
ibuf_bitmap_get_map_page(id, block->zip_size(), mtr),
746-
id, block->physical_size(), val, mtr);
740+
if (buf_block_t* bitmap_page = ibuf_bitmap_get_map_page(
741+
id, block->zip_size(), mtr)) {
742+
ibuf_bitmap_page_set_bits<IBUF_BITMAP_FREE>(
743+
bitmap_page, id, block->physical_size(),
744+
val, mtr);
745+
}
747746
}
748747

749748
/************************************************************************//**
@@ -887,10 +886,13 @@ ibuf_update_free_bits_zip(
887886
buf_page_make_young(&block->page);
888887
}
889888

890-
ibuf_bitmap_page_set_bits<IBUF_BITMAP_FREE>(
891-
ibuf_bitmap_get_map_page(block->page.id(), block->zip_size(),
892-
mtr),
893-
block->page.id(), block->physical_size(), after, mtr);
889+
if (buf_block_t* bitmap_page = ibuf_bitmap_get_map_page(
890+
block->page.id(), block->zip_size(), mtr)) {
891+
892+
ibuf_bitmap_page_set_bits<IBUF_BITMAP_FREE>(
893+
bitmap_page, block->page.id(),
894+
block->physical_size(), after, mtr);
895+
}
894896
}
895897

896898
/**********************************************************************//**
@@ -3669,14 +3671,15 @@ ibuf_insert_to_index_page_low(
36693671
"InnoDB: is now probably corrupt. Please run CHECK TABLE on\n"
36703672
"InnoDB: that table.\n", stderr);
36713673

3672-
ib::error() << "page " << block->page.id() << ", size "
3673-
<< block->physical_size() << ", bitmap bits "
3674-
<< ibuf_bitmap_page_get_bits(
3675-
ibuf_bitmap_get_map_page(block->page.id(),
3676-
block->zip_size(),
3677-
mtr)->frame,
3678-
block->page.id(), block->zip_size(),
3679-
IBUF_BITMAP_FREE, mtr);
3674+
if (buf_block_t *bitmap_page = ibuf_bitmap_get_map_page(
3675+
block->page.id(), block->zip_size(), mtr)) {
3676+
3677+
ib::error() << "page " << block->page.id() << ", size "
3678+
<< block->physical_size() << ", bitmap bits "
3679+
<< ibuf_bitmap_page_get_bits(bitmap_page->frame,
3680+
block->page.id(), block->zip_size(),
3681+
IBUF_BITMAP_FREE, mtr);
3682+
}
36803683

36813684
ib::error() << BUG_REPORT_MSG;
36823685

0 commit comments

Comments
 (0)