Commit d910c5ac authored by Marko Mäkelä's avatar Marko Mäkelä

Bug#16409715 ASSERT SYNC_THREAD_LEVELS_G(ARRAY, LEVEL - 1, TRUE),

IBUF, FREE SPACE MANAGEMENT

ibuf_merge_or_delete_for_page(): Declare the user index page latched
for UNIV_SYNC_DEBUG after opening the change buffer cursor. This
should avoid the bogus latching order violation.

ibuf_delete_rec(): Add assertions to the callers, checking that the
mini-transaction was committed when the function returned TRUE. This
is a non-functional change, just clarifying the code.

rb#2136 approved by Kevin Lewis
parent b5f4385e
...@@ -4271,7 +4271,7 @@ Deletes from ibuf the record on which pcur is positioned. If we have to ...@@ -4271,7 +4271,7 @@ Deletes from ibuf the record on which pcur is positioned. If we have to
resort to a pessimistic delete, this function commits mtr and closes resort to a pessimistic delete, this function commits mtr and closes
the cursor. the cursor.
@return TRUE if mtr was committed and pcur closed in this operation */ @return TRUE if mtr was committed and pcur closed in this operation */
static static __attribute__((warn_unused_result))
ibool ibool
ibuf_delete_rec( ibuf_delete_rec(
/*============*/ /*============*/
...@@ -4577,6 +4577,12 @@ ibuf_merge_or_delete_for_page( ...@@ -4577,6 +4577,12 @@ ibuf_merge_or_delete_for_page(
loop: loop:
ibuf_mtr_start(&mtr); ibuf_mtr_start(&mtr);
/* Position pcur in the insert buffer at the first entry for this
index page */
btr_pcur_open_on_user_rec(
ibuf->index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF,
&pcur, &mtr);
if (block) { if (block) {
ibool success; ibool success;
...@@ -4595,12 +4601,6 @@ loop: ...@@ -4595,12 +4601,6 @@ loop:
buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE); buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE);
} }
/* Position pcur in the insert buffer at the first entry for this
index page */
btr_pcur_open_on_user_rec(
ibuf->index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF,
&pcur, &mtr);
if (!btr_pcur_is_on_user_rec(&pcur)) { if (!btr_pcur_is_on_user_rec(&pcur)) {
ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr)); ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
...@@ -4743,6 +4743,7 @@ loop: ...@@ -4743,6 +4743,7 @@ loop:
/* Deletion was pessimistic and mtr was committed: /* Deletion was pessimistic and mtr was committed:
we start from the beginning again */ we start from the beginning again */
ut_ad(mtr.state == MTR_COMMITTED);
goto loop; goto loop;
} else if (btr_pcur_is_after_last_on_page(&pcur)) { } else if (btr_pcur_is_after_last_on_page(&pcur)) {
ibuf_mtr_commit(&mtr); ibuf_mtr_commit(&mtr);
...@@ -4873,6 +4874,7 @@ loop: ...@@ -4873,6 +4874,7 @@ loop:
/* Deletion was pessimistic and mtr was committed: /* Deletion was pessimistic and mtr was committed:
we start from the beginning again */ we start from the beginning again */
ut_ad(mtr.state == MTR_COMMITTED);
goto loop; goto loop;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment