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

Cleanup: Use the alias BTR_PURGE_TREE for pessimistic delete

parent ae6ebafd
...@@ -4011,8 +4011,7 @@ bool ibuf_delete_rec(const page_id_t page_id, btr_pcur_t* pcur, ...@@ -4011,8 +4011,7 @@ bool ibuf_delete_rec(const page_id_t page_id, btr_pcur_t* pcur,
ibuf_mtr_start(mtr); ibuf_mtr_start(mtr);
mysql_mutex_lock(&ibuf_mutex); mysql_mutex_lock(&ibuf_mutex);
if (!ibuf_restore_pos(page_id, search_tuple, if (!ibuf_restore_pos(page_id, search_tuple, BTR_PURGE_TREE,
BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE,
pcur, mtr)) { pcur, mtr)) {
mysql_mutex_unlock(&ibuf_mutex); mysql_mutex_unlock(&ibuf_mutex);
......
...@@ -1598,8 +1598,7 @@ tree structure may be changed during a pessimistic delete. */ ...@@ -1598,8 +1598,7 @@ tree structure may be changed during a pessimistic delete. */
inline dberr_t IndexPurge::purge_pessimistic_delete() noexcept inline dberr_t IndexPurge::purge_pessimistic_delete() noexcept
{ {
dberr_t err; dberr_t err;
if (m_pcur.restore_position(BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE, if (m_pcur.restore_position(BTR_PURGE_TREE, &m_mtr) != btr_pcur_t::CORRUPTED)
&m_mtr) != btr_pcur_t::CORRUPTED)
{ {
ut_ad(rec_get_deleted_flag(btr_pcur_get_rec(&m_pcur), ut_ad(rec_get_deleted_flag(btr_pcur_get_rec(&m_pcur),
m_index->table->not_redundant())); m_index->table->not_redundant()));
......
...@@ -1696,8 +1696,7 @@ row_log_table_apply_delete_low( ...@@ -1696,8 +1696,7 @@ row_log_table_apply_delete_low(
mtr->start(); mtr->start();
index->set_modified(*mtr); index->set_modified(*mtr);
error = btr_pcur_open(index, entry, PAGE_CUR_LE, error = btr_pcur_open(index, entry, PAGE_CUR_LE,
BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE, BTR_PURGE_TREE, pcur, mtr);
pcur, mtr);
if (error) { if (error) {
goto err_exit; goto err_exit;
} }
...@@ -1780,8 +1779,7 @@ row_log_table_apply_delete( ...@@ -1780,8 +1779,7 @@ row_log_table_apply_delete(
mtr_start(&mtr); mtr_start(&mtr);
index->set_modified(mtr); index->set_modified(mtr);
dberr_t err = btr_pcur_open(index, old_pk, PAGE_CUR_LE, dberr_t err = btr_pcur_open(index, old_pk, PAGE_CUR_LE,
BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE, BTR_PURGE_TREE, &pcur, &mtr);
&pcur, &mtr);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
goto all_done; goto all_done;
} }
......
...@@ -216,7 +216,7 @@ row_purge_remove_clust_if_poss_low( ...@@ -216,7 +216,7 @@ row_purge_remove_clust_if_poss_low(
btr_pcur_get_btr_cur(&node->pcur), 0, &mtr); btr_pcur_get_btr_cur(&node->pcur), 0, &mtr);
} else { } else {
dberr_t err; dberr_t err;
ut_ad(mode == (BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE)); ut_ad(mode == BTR_PURGE_TREE);
btr_cur_pessimistic_delete( btr_cur_pessimistic_delete(
&err, FALSE, btr_pcur_get_btr_cur(&node->pcur), 0, &err, FALSE, btr_pcur_get_btr_cur(&node->pcur), 0,
false, &mtr); false, &mtr);
...@@ -257,8 +257,7 @@ row_purge_remove_clust_if_poss( ...@@ -257,8 +257,7 @@ row_purge_remove_clust_if_poss(
for (ulint n_tries = 0; for (ulint n_tries = 0;
n_tries < BTR_CUR_RETRY_DELETE_N_TIMES; n_tries < BTR_CUR_RETRY_DELETE_N_TIMES;
n_tries++) { n_tries++) {
if (row_purge_remove_clust_if_poss_low( if (row_purge_remove_clust_if_poss_low(node, BTR_PURGE_TREE)) {
node, BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE)) {
return(true); return(true);
} }
...@@ -349,10 +348,8 @@ row_purge_remove_sec_if_poss_tree( ...@@ -349,10 +348,8 @@ row_purge_remove_sec_if_poss_tree(
mtr.start(); mtr.start();
index->set_modified(mtr); index->set_modified(mtr);
search_result = row_search_index_entry( search_result = row_search_index_entry(index, entry, BTR_PURGE_TREE,
index, entry, &pcur, &mtr);
BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE,
&pcur, &mtr);
switch (search_result) { switch (search_result) {
case ROW_NOT_FOUND: case ROW_NOT_FOUND:
......
...@@ -207,9 +207,8 @@ row_undo_ins_remove_clust_rec( ...@@ -207,9 +207,8 @@ row_undo_ins_remove_clust_rec(
} else { } else {
index->set_modified(mtr); index->set_modified(mtr);
} }
ut_a( ut_a(node->pcur.restore_position(BTR_PURGE_TREE, &mtr)
node->pcur.restore_position(BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE, == btr_pcur_t::SAME_ALL);
&mtr) == btr_pcur_t::SAME_ALL);
btr_cur_pessimistic_delete(&err, FALSE, &node->pcur.btr_cur, 0, true, btr_cur_pessimistic_delete(&err, FALSE, &node->pcur.btr_cur, 0, true,
&mtr); &mtr);
...@@ -272,7 +271,7 @@ row_undo_ins_remove_sec_low( ...@@ -272,7 +271,7 @@ row_undo_ins_remove_sec_low(
mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED; mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED;
mtr_s_lock_index(index, &mtr); mtr_s_lock_index(index, &mtr);
} else { } else {
ut_ad(mode == (BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE)); ut_ad(mode == BTR_PURGE_TREE);
mtr_sx_lock_index(index, &mtr); mtr_sx_lock_index(index, &mtr);
} }
...@@ -349,9 +348,7 @@ row_undo_ins_remove_sec( ...@@ -349,9 +348,7 @@ row_undo_ins_remove_sec(
/* Try then pessimistic descent to the B-tree */ /* Try then pessimistic descent to the B-tree */
retry: retry:
err = row_undo_ins_remove_sec_low( err = row_undo_ins_remove_sec_low(BTR_PURGE_TREE, index, entry, thr);
BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE,
index, entry, thr);
/* The delete operation may fail if we have little /* The delete operation may fail if we have little
file space left: TODO: easiest to crash the database file space left: TODO: easiest to crash the database
......
...@@ -356,8 +356,7 @@ row_undo_mod_clust( ...@@ -356,8 +356,7 @@ row_undo_mod_clust(
} }
mtr.start(); mtr.start();
if (pcur->restore_position( if (pcur->restore_position(BTR_PURGE_TREE, &mtr) !=
BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE, &mtr) !=
btr_pcur_t::SAME_ALL) { btr_pcur_t::SAME_ALL) {
goto mtr_commit_exit; goto mtr_commit_exit;
} }
...@@ -504,7 +503,7 @@ row_undo_mod_del_mark_or_remove_sec_low( ...@@ -504,7 +503,7 @@ row_undo_mod_del_mark_or_remove_sec_low(
mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED; mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED;
mtr_s_lock_index(index, &mtr); mtr_s_lock_index(index, &mtr);
} else { } else {
ut_ad(mode == (BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE)); ut_ad(mode == BTR_PURGE_TREE);
mtr_sx_lock_index(index, &mtr); mtr_sx_lock_index(index, &mtr);
} }
} else { } else {
...@@ -634,7 +633,7 @@ row_undo_mod_del_mark_or_remove_sec( ...@@ -634,7 +633,7 @@ row_undo_mod_del_mark_or_remove_sec(
} }
err = row_undo_mod_del_mark_or_remove_sec_low(node, thr, index, err = row_undo_mod_del_mark_or_remove_sec_low(node, thr, index,
entry, BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE); entry, BTR_PURGE_TREE);
return(err); return(err);
} }
......
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