Skip to content

Commit fd8c68c

Browse files
committed
MDEV-25491 fixup: Race between DROP TABLE and purge of DROP INDEX
xdes_get_descriptor_with_space_hdr(): Use the correct mode BUF_GET_POSSIBLY_FREED also when the tablespace is larger than innodb_page_size pages. This function could be called by fseg_free_step(). fsp_alloc_seg_inode(): For completeness (and for improved robustness in case of a corrupted tablespace), use BUF_GET_POSSIBLY_FREED. With this, the entire compilation unit fsp0fsp.cc will use that mode.
1 parent f21e159 commit fd8c68c

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

storage/innobase/fsp/fsp0fsp.cc

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -348,18 +348,23 @@ xdes_get_descriptor_with_space_hdr(
348348
buf_block_t* block = header;
349349

350350
if (descr_page_no) {
351-
block = buf_page_get(
352-
page_id_t(space->id, descr_page_no), zip_size,
353-
RW_SX_LATCH, mtr);
351+
block = buf_page_get_gen(page_id_t(space->id, descr_page_no),
352+
zip_size, RW_SX_LATCH, nullptr,
353+
BUF_GET_POSSIBLY_FREED, mtr);
354+
if (block && block->page.status == buf_page_t::FREED) {
355+
block = nullptr;
356+
}
354357
}
355358

356359
if (desc_block != NULL) {
357360
*desc_block = block;
358361
}
359362

360-
return XDES_ARR_OFFSET + XDES_SIZE
363+
return block
364+
? XDES_ARR_OFFSET + XDES_SIZE
361365
* xdes_calc_descriptor_index(zip_size, offset)
362-
+ block->frame;
366+
+ block->frame
367+
: nullptr;
363368
}
364369

365370
/** Get the extent descriptor of a page.
@@ -440,7 +445,6 @@ MY_ATTRIBUTE((nonnull(3), warn_unused_result))
440445
extent descriptor resides is x-locked.
441446
@param space tablespace
442447
@param lst_node file address of the list node contained in the descriptor
443-
@param mode BUF_GET or BUF_GET_POSSIBLY_FREED
444448
@param mtr mini-transaction
445449
@param block extent descriptor block
446450
@return pointer to the extent descriptor */
@@ -1439,7 +1443,12 @@ fsp_alloc_seg_inode(fil_space_t *space, buf_block_t *header,
14391443
flst_get_first(FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE
14401444
+ header->frame).page);
14411445

1442-
block = buf_page_get(page_id, space->zip_size(), RW_SX_LATCH, mtr);
1446+
block = buf_page_get_gen(page_id, space->zip_size(), RW_SX_LATCH,
1447+
nullptr, BUF_GET_POSSIBLY_FREED, mtr);
1448+
if (!block || block->page.status == buf_page_t::FREED) {
1449+
return nullptr;
1450+
}
1451+
14431452
if (!space->full_crc32()) {
14441453
fil_block_check_type(*block, FIL_PAGE_INODE, mtr);
14451454
}

0 commit comments

Comments
 (0)