Skip to content

Commit 5d06230

Browse files
RahulSisondianawazn
authored andcommitted
Bug#36343647 [ERROR] [MY-013183] [InnoDB] Assertion failure:ibuf0ibuf.cc:3833:ib::fatal
This is a cherry-pick of the following bug fix which is already fixed in 8.4 through commit#79d67. Bug#35676106 Assertion failure: ibuf0ibuf.cc:3825:ib::fatal triggered thread Description: ------------ When the pages of secondary index are brought to the buffer pool either through the ibuf merge background thread or read through usual io thread, first cached entries from the change buffer are applied to the pages. Once the entries are applied to the page, they are removed from the change buffer. It may possible that the table is deleted or being deleted during change buffer related operations described in the earlier. In the current code we handled the situation of tablespace is deleted but not being deleted. Latter situation must also be handled similarly. Fix: ==== - Replaced the call fil_space_get_flags() with fil_space_acquire_silent(). Later method refuses to acquire the tablespace that is being deleted. - Improved the doxygen of the method ibuf_restore_pos() Change-Id: Ibc5a07c705988282b8b7906d645e2a108f4ada76
1 parent 4aa1d53 commit 5d06230

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

storage/innobase/ibuf/ibuf0ibuf.cc

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3791,34 +3791,31 @@ static void ibuf_delete(const dtuple_t *entry, /*!< in: entry */
37913791
}
37923792

37933793
/** Restores insert buffer tree cursor position
3794-
@return true if the position was restored; false if not */
3795-
static bool ibuf_restore_pos(
3796-
space_id_t space, /*!< in: space id */
3797-
page_no_t page_no, /*!< in: index page number where the record
3798-
should belong */
3799-
const dtuple_t *search_tuple,
3800-
/*!< in: search tuple for entries of page_no */
3801-
ulint mode, /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */
3802-
btr_pcur_t *pcur, /*!< in/out: persistent cursor whose
3803-
position is to be restored */
3804-
mtr_t *mtr) /*!< in/out: mini-transaction */
3805-
{
3794+
@param[in] space_id Tablespace id
3795+
@param[in] page_no index page number where the record should belong
3796+
@param [in] search_tuple search tuple for entries of page_no
3797+
@param[in] mode BTR_MODIFY_LEAF or BTR_MODIFY_TREE
3798+
@param[in,out] pcur persistent cursor whose position is to be restored
3799+
@param[in, out] mtr mini-transaction
3800+
@return true if the position was restored; false if not */
3801+
static bool ibuf_restore_pos(space_id_t space_id, page_no_t page_no,
3802+
const dtuple_t *search_tuple, ulint mode,
3803+
btr_pcur_t *pcur, mtr_t *mtr) {
38063804
ut_ad(mode == BTR_MODIFY_LEAF ||
38073805
BTR_LATCH_MODE_WITHOUT_INTENTION(mode) == BTR_MODIFY_TREE);
38083806

38093807
if (pcur->restore_position(mode, mtr, UT_LOCATION_HERE)) {
38103808
return true;
38113809
}
38123810

3813-
if (fil_space_get_flags(space) == UINT32_UNDEFINED) {
3814-
/* The tablespace has been dropped. It is possible
3815-
that another thread has deleted the insert buffer
3816-
entry. Do not complain. */
3811+
if (const auto space = fil_space_acquire_silent(space_id); space == nullptr) {
3812+
/* The tablespace has been(or being) deleted. Do not complain. */
38173813
ibuf_btr_pcur_commit_specify_mtr(pcur, mtr);
38183814
} else {
3815+
fil_space_release(space);
38193816
ib::error(ER_IB_MSG_620) << "ibuf cursor restoration fails!."
38203817
" ibuf record inserted to page "
3821-
<< space << ":" << page_no;
3818+
<< space_id << ":" << page_no;
38223819

38233820
ib::error(ER_IB_MSG_621) << BUG_REPORT_MSG;
38243821

0 commit comments

Comments
 (0)