summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-04-30 10:31:37 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-04-30 10:31:37 +0300
commitfd8c68c7fe6b74fa8f83483c028c83638a2edbf2 (patch)
treea6145313b7656fa312a1e6eb27e58a3e602643b3
parentf21e159bb5dcfc398263142a8f858a1291b25d8e (diff)
downloadmariadb-git-fd8c68c7fe6b74fa8f83483c028c83638a2edbf2.tar.gz
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.
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc23
1 files changed, 16 insertions, 7 deletions
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index cf9c5e45e69..6d855f48a66 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -348,18 +348,23 @@ xdes_get_descriptor_with_space_hdr(
buf_block_t* block = header;
if (descr_page_no) {
- block = buf_page_get(
- page_id_t(space->id, descr_page_no), zip_size,
- RW_SX_LATCH, mtr);
+ block = buf_page_get_gen(page_id_t(space->id, descr_page_no),
+ zip_size, RW_SX_LATCH, nullptr,
+ BUF_GET_POSSIBLY_FREED, mtr);
+ if (block && block->page.status == buf_page_t::FREED) {
+ block = nullptr;
+ }
}
if (desc_block != NULL) {
*desc_block = block;
}
- return XDES_ARR_OFFSET + XDES_SIZE
+ return block
+ ? XDES_ARR_OFFSET + XDES_SIZE
* xdes_calc_descriptor_index(zip_size, offset)
- + block->frame;
+ + block->frame
+ : nullptr;
}
/** Get the extent descriptor of a page.
@@ -440,7 +445,6 @@ MY_ATTRIBUTE((nonnull(3), warn_unused_result))
extent descriptor resides is x-locked.
@param space tablespace
@param lst_node file address of the list node contained in the descriptor
-@param mode BUF_GET or BUF_GET_POSSIBLY_FREED
@param mtr mini-transaction
@param block extent descriptor block
@return pointer to the extent descriptor */
@@ -1439,7 +1443,12 @@ fsp_alloc_seg_inode(fil_space_t *space, buf_block_t *header,
flst_get_first(FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE
+ header->frame).page);
- block = buf_page_get(page_id, space->zip_size(), RW_SX_LATCH, mtr);
+ block = buf_page_get_gen(page_id, space->zip_size(), RW_SX_LATCH,
+ nullptr, BUF_GET_POSSIBLY_FREED, mtr);
+ if (!block || block->page.status == buf_page_t::FREED) {
+ return nullptr;
+ }
+
if (!space->full_crc32()) {
fil_block_check_type(*block, FIL_PAGE_INODE, mtr);
}