diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 9fd6491a1ca1..1c74075cb92b 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -3791,18 +3791,16 @@ static void ibuf_delete(const dtuple_t *entry, /*!< in: entry */ } /** Restores insert buffer tree cursor position - @return true if the position was restored; false if not */ -static bool ibuf_restore_pos( - space_id_t space, /*!< in: space id */ - page_no_t page_no, /*!< in: index page number where the record - should belong */ - const dtuple_t *search_tuple, - /*!< in: search tuple for entries of page_no */ - ulint mode, /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */ - btr_pcur_t *pcur, /*!< in/out: persistent cursor whose - position is to be restored */ - mtr_t *mtr) /*!< in/out: mini-transaction */ -{ +@param[in] space_id Tablespace id +@param[in] page_no index page number where the record should belong +@param [in] search_tuple search tuple for entries of page_no +@param[in] mode BTR_MODIFY_LEAF or BTR_MODIFY_TREE +@param[in,out] pcur persistent cursor whose position is to be restored +@param[in, out] mtr mini-transaction +@return true if the position was restored; false if not */ +static bool ibuf_restore_pos(space_id_t space_id, page_no_t page_no, + const dtuple_t *search_tuple, ulint mode, + btr_pcur_t *pcur, mtr_t *mtr) { ut_ad(mode == BTR_MODIFY_LEAF || BTR_LATCH_MODE_WITHOUT_INTENTION(mode) == BTR_MODIFY_TREE); @@ -3810,15 +3808,14 @@ static bool ibuf_restore_pos( return true; } - if (fil_space_get_flags(space) == UINT32_UNDEFINED) { - /* The tablespace has been dropped. It is possible - that another thread has deleted the insert buffer - entry. Do not complain. */ + if (const auto space = fil_space_acquire_silent(space_id); space == nullptr) { + /* The tablespace has been(or being) deleted. Do not complain. */ ibuf_btr_pcur_commit_specify_mtr(pcur, mtr); } else { + fil_space_release(space); ib::error(ER_IB_MSG_620) << "ibuf cursor restoration fails!." " ibuf record inserted to page " - << space << ":" << page_no; + << space_id << ":" << page_no; ib::error(ER_IB_MSG_621) << BUG_REPORT_MSG;