Commit 8ab05ab1 authored by marko's avatar marko

branches/zip: Minor cleanup of B-tree cursor operations.

btr_pcur_get_rel_pos(): Add a const qualifier.

btr_pcur_get_btr_cur(), btr_pcur_get_page_cur(): btr_cur_get_page_cur():
Define as const-preserving macros.

btr_pcur_is_on_user_rec(), btr_pcur_is_after_last_on_page(),
btr_pcur_is_before_first_on_page(): Remove the unused parameter mtr.
Add a const qualifier.

btr_pcur_move_to_next_on_page(), btr_pcur_move_to_prev_on_page():
Remove the unused parameter mtr.

page_cur_search(): Add const qualifiers.

page_cur_get_page(), page_cur_is_before_first(), page_cur_is_after_last():
Add debug assertions.
parent a2aac2f6
......@@ -303,7 +303,7 @@ btr_pcur_restore_position(
cursor->search_mode = old_mode;
if (cursor->rel_pos == BTR_PCUR_ON
&& btr_pcur_is_on_user_rec(cursor, mtr)
&& btr_pcur_is_on_user_rec(cursor)
&& 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
rec_get_offsets(
btr_pcur_get_rec(cursor), index,
......@@ -383,7 +383,7 @@ btr_pcur_move_to_next_page(
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
ut_ad(btr_pcur_is_after_last_on_page(cursor, mtr));
ut_ad(btr_pcur_is_after_last_on_page(cursor));
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
......@@ -438,7 +438,7 @@ btr_pcur_move_backward_from_page(
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
ut_ad(btr_pcur_is_before_first_on_page(cursor, mtr));
ut_ad(btr_pcur_is_before_first_on_page(cursor));
ut_ad(!btr_pcur_is_before_first_in_tree(cursor, mtr));
latch_mode = cursor->latch_mode;
......@@ -469,7 +469,7 @@ btr_pcur_move_backward_from_page(
space = buf_block_get_space(btr_pcur_get_block(cursor));
if (prev_page_no == FIL_NULL) {
} else if (btr_pcur_is_before_first_on_page(cursor, mtr)) {
} else if (btr_pcur_is_before_first_on_page(cursor)) {
prev_block = btr_pcur_get_btr_cur(cursor)->left_block;
......@@ -512,7 +512,7 @@ btr_pcur_move_to_prev(
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
if (btr_pcur_is_before_first_on_page(cursor, mtr)) {
if (btr_pcur_is_before_first_on_page(cursor)) {
if (btr_pcur_is_before_first_in_tree(cursor, mtr)) {
......@@ -524,7 +524,7 @@ btr_pcur_move_to_prev(
return(TRUE);
}
btr_pcur_move_to_prev_on_page(cursor, mtr);
btr_pcur_move_to_prev_on_page(cursor);
return(TRUE);
}
......@@ -553,7 +553,7 @@ btr_pcur_open_on_user_rec(
if ((mode == PAGE_CUR_GE) || (mode == PAGE_CUR_G)) {
if (btr_pcur_is_after_last_on_page(cursor, mtr)) {
if (btr_pcur_is_after_last_on_page(cursor)) {
btr_pcur_move_to_next_user_rec(cursor, mtr);
}
......
......@@ -88,7 +88,7 @@ dict_get_first_table_name_in_db(
loop:
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
if (!btr_pcur_is_on_user_rec(&pcur)) {
/* Not found */
btr_pcur_close(&pcur);
......@@ -167,7 +167,7 @@ loop:
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
if (!btr_pcur_is_on_user_rec(&pcur)) {
/* end of index */
btr_pcur_close(&pcur);
......@@ -297,7 +297,7 @@ loop:
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
if (!btr_pcur_is_on_user_rec(&pcur)) {
/* end of index */
btr_pcur_close(&pcur);
......@@ -418,7 +418,7 @@ dict_load_columns(
rec = btr_pcur_get_rec(&pcur);
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
ut_a(btr_pcur_is_on_user_rec(&pcur));
ut_a(!rec_get_deleted_flag(rec, 0));
......@@ -522,7 +522,7 @@ dict_load_fields(
rec = btr_pcur_get_rec(&pcur);
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
ut_a(btr_pcur_is_on_user_rec(&pcur));
/* There could be delete marked records in SYS_FIELDS
because SYS_FIELDS.INDEX_ID can be updated
......@@ -636,7 +636,7 @@ dict_load_indexes(
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
for (;;) {
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
if (!btr_pcur_is_on_user_rec(&pcur)) {
break;
}
......@@ -791,7 +791,7 @@ dict_load_table(
BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
if (!btr_pcur_is_on_user_rec(&pcur)
|| rec_get_deleted_flag(rec, 0)) {
/* Not found */
err_exit:
......@@ -973,7 +973,7 @@ dict_load_table_on_id(
BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
if (!btr_pcur_is_on_user_rec(&pcur)
|| rec_get_deleted_flag(rec, 0)) {
/* Not found */
......@@ -1082,7 +1082,7 @@ dict_load_foreign_cols(
rec = btr_pcur_get_rec(&pcur);
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
ut_a(btr_pcur_is_on_user_rec(&pcur));
ut_a(!rec_get_deleted_flag(rec, 0));
field = rec_get_nth_field_old(rec, 0, &len);
......@@ -1153,7 +1153,7 @@ dict_load_foreign(
BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
if (!btr_pcur_is_on_user_rec(&pcur)
|| rec_get_deleted_flag(rec, 0)) {
/* Not found */
......@@ -1297,7 +1297,7 @@ start_load:
loop:
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
if (!btr_pcur_is_on_user_rec(&pcur)) {
/* End of index */
goto load_next_index;
......
......@@ -2558,7 +2558,7 @@ ibuf_update_max_tablespace_id(void)
&pcur, TRUE, &mtr);
btr_pcur_move_to_prev(&pcur, &mtr);
if (btr_pcur_is_before_first_on_page(&pcur, &mtr)) {
if (btr_pcur_is_before_first_on_page(&pcur)) {
/* The tree is empty */
max_space_id = 0;
......@@ -3333,14 +3333,14 @@ loop:
index page */
btr_pcur_open_on_user_rec(ibuf_data->index, search_tuple, PAGE_CUR_GE,
BTR_MODIFY_LEAF, &pcur, &mtr);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
if (!btr_pcur_is_on_user_rec(&pcur)) {
ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
goto reset_bit;
}
for (;;) {
ut_ad(btr_pcur_is_on_user_rec(&pcur, &mtr));
ut_ad(btr_pcur_is_on_user_rec(&pcur));
ibuf_rec = btr_pcur_get_rec(&pcur);
......@@ -3393,7 +3393,7 @@ loop:
goto loop;
}
if (btr_pcur_is_after_last_on_page(&pcur, &mtr)) {
if (btr_pcur_is_after_last_on_page(&pcur)) {
mtr_commit(&mtr);
btr_pcur_close(&pcur);
......@@ -3505,14 +3505,14 @@ loop:
space */
btr_pcur_open_on_user_rec(ibuf_data->index, search_tuple, PAGE_CUR_GE,
BTR_MODIFY_LEAF, &pcur, &mtr);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
if (!btr_pcur_is_on_user_rec(&pcur)) {
ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
goto leave_loop;
}
for (;;) {
ut_ad(btr_pcur_is_on_user_rec(&pcur, &mtr));
ut_ad(btr_pcur_is_on_user_rec(&pcur));
ibuf_rec = btr_pcur_get_rec(&pcur);
......@@ -3538,7 +3538,7 @@ loop:
goto loop;
}
if (btr_pcur_is_after_last_on_page(&pcur, &mtr)) {
if (btr_pcur_is_after_last_on_page(&pcur)) {
mtr_commit(&mtr);
btr_pcur_close(&pcur);
......
......@@ -27,14 +27,19 @@ Created 10/16/1994 Heikki Tuuri
#define BTR_CUR_ADAPT
#define BTR_CUR_HASH_ADAPT
#ifdef UNIV_DEBUG
/*************************************************************
Returns the page cursor component of a tree cursor. */
UNIV_INLINE
page_cur_t*
btr_cur_get_page_cur(
/*=================*/
/* out: pointer to page cursor component */
btr_cur_t* cursor);/* in: tree cursor */
/* out: pointer to page cursor
component */
const btr_cur_t* cursor);/* in: tree cursor */
#else /* UNIV_DEBUG */
# define btr_cur_get_page_cur(cursor) (&(cursor)->page_cur)
#endif /* UNIV_DEBUG */
/*************************************************************
Returns the buffer block on which the tree cursor is positioned. */
UNIV_INLINE
......
......@@ -8,17 +8,20 @@ Created 10/16/1994 Heikki Tuuri
#include "btr0btr.h"
#ifdef UNIV_DEBUG
/*************************************************************
Returns the page cursor component of a tree cursor. */
UNIV_INLINE
page_cur_t*
btr_cur_get_page_cur(
/*=================*/
/* out: pointer to page cursor component */
btr_cur_t* cursor) /* in: tree cursor */
/* out: pointer to page cursor
component */
const btr_cur_t* cursor) /* in: tree cursor */
{
return(&(cursor->page_cur));
return(&((btr_cur_t*) cursor)->page_cur);
}
#endif /* UNIV_DEBUG */
/*************************************************************
Returns the buffer block on which the tree cursor is positioned. */
UNIV_INLINE
......
......@@ -228,8 +228,8 @@ UNIV_INLINE
ulint
btr_pcur_get_rel_pos(
/*=================*/
/* out: BTR_PCUR_ON, ... */
btr_pcur_t* cursor);/* in: persistent cursor */
/* out: BTR_PCUR_ON, ... */
const btr_pcur_t* cursor);/* in: persistent cursor */
/*************************************************************
Sets the mtr field for a pcur. */
UNIV_INLINE
......@@ -346,22 +346,29 @@ btr_pcur_move_backward_from_page(
btr_pcur_t* cursor, /* in: persistent cursor, must be on the
first record of the current page */
mtr_t* mtr); /* in: mtr */
#ifdef UNIV_DEBUG
/*************************************************************
Returns the btr cursor component of a persistent cursor. */
UNIV_INLINE
btr_cur_t*
btr_pcur_get_btr_cur(
/*=================*/
/* out: pointer to btr cursor component */
btr_pcur_t* cursor); /* in: persistent cursor */
/* out: pointer to
btr cursor component */
const btr_pcur_t* cursor); /* in: persistent cursor */
/*************************************************************
Returns the page cursor component of a persistent cursor. */
UNIV_INLINE
page_cur_t*
btr_pcur_get_page_cur(
/*==================*/
/* out: pointer to page cursor component */
btr_pcur_t* cursor); /* in: persistent cursor */
/* out: pointer to
page cursor component */
const btr_pcur_t* cursor); /* in: persistent cursor */
#else /* UNIV_DEBUG */
# define btr_pcur_get_btr_cur(cursor) (&(cursor)->btr_cur)
# define btr_pcur_get_page_cur(cursor) (&(cursor)->btr_cur.page_cur)
#endif /* UNIV_DEBUG */
/*************************************************************
Returns the page of a persistent cursor. */
UNIV_INLINE
......@@ -392,8 +399,7 @@ UNIV_INLINE
ibool
btr_pcur_is_on_user_rec(
/*====================*/
btr_pcur_t* cursor, /* in: persistent cursor */
mtr_t* mtr); /* in: mtr */
const btr_pcur_t* cursor);/* in: persistent cursor */
/*************************************************************
Checks if the persistent cursor is after the last user record on
a page. */
......@@ -401,8 +407,7 @@ UNIV_INLINE
ibool
btr_pcur_is_after_last_on_page(
/*===========================*/
btr_pcur_t* cursor, /* in: persistent cursor */
mtr_t* mtr); /* in: mtr */
const btr_pcur_t* cursor);/* in: persistent cursor */
/*************************************************************
Checks if the persistent cursor is before the first user record on
a page. */
......@@ -410,8 +415,7 @@ UNIV_INLINE
ibool
btr_pcur_is_before_first_on_page(
/*=============================*/
btr_pcur_t* cursor, /* in: persistent cursor */
mtr_t* mtr); /* in: mtr */
const btr_pcur_t* cursor);/* in: persistent cursor */
/*************************************************************
Checks if the persistent cursor is before the first user record in
the index tree. */
......@@ -436,16 +440,14 @@ UNIV_INLINE
void
btr_pcur_move_to_next_on_page(
/*==========================*/
btr_pcur_t* cursor, /* in: persistent cursor */
mtr_t* mtr); /* in: mtr */
btr_pcur_t* cursor);/* in/out: persistent cursor */
/*************************************************************
Moves the persistent cursor to the previous record on the same page. */
UNIV_INLINE
void
btr_pcur_move_to_prev_on_page(
/*==========================*/
btr_pcur_t* cursor, /* in: persistent cursor */
mtr_t* mtr); /* in: mtr */
btr_pcur_t* cursor);/* in/out: persistent cursor */
/* The persistent B-tree cursor structure. This is used mainly for SQL
......
......@@ -13,8 +13,8 @@ UNIV_INLINE
ulint
btr_pcur_get_rel_pos(
/*=================*/
/* out: BTR_PCUR_ON, ... */
btr_pcur_t* cursor) /* in: persistent cursor */
/* out: BTR_PCUR_ON, ... */
const btr_pcur_t* cursor) /* in: persistent cursor */
{
ut_ad(cursor);
ut_ad(cursor->old_rec);
......@@ -53,16 +53,19 @@ btr_pcur_get_mtr(
return(cursor->mtr);
}
#ifdef UNIV_DEBUG
/*************************************************************
Returns the btr cursor component of a persistent cursor. */
UNIV_INLINE
btr_cur_t*
btr_pcur_get_btr_cur(
/*=================*/
/* out: pointer to btr cursor component */
btr_pcur_t* cursor) /* in: persistent cursor */
/* out: pointer to
btr cursor component */
const btr_pcur_t* cursor) /* in: persistent cursor */
{
return(&(cursor->btr_cur));
const btr_cur_t* btr_cur = &cursor->btr_cur;
return((btr_cur_t*) btr_cur);
}
/*************************************************************
......@@ -71,12 +74,13 @@ UNIV_INLINE
page_cur_t*
btr_pcur_get_page_cur(
/*==================*/
/* out: pointer to page cursor component */
btr_pcur_t* cursor) /* in: persistent cursor */
/* out: pointer to page cursor
component */
const btr_pcur_t* cursor) /* in: persistent cursor */
{
return(btr_cur_get_page_cur(&(cursor->btr_cur)));
return(btr_cur_get_page_cur(btr_pcur_get_btr_cur(cursor)));
}
#endif /* UNIV_DEBUG */
/*************************************************************
Returns the page of a persistent cursor. */
UNIV_INLINE
......@@ -172,10 +176,8 @@ UNIV_INLINE
ibool
btr_pcur_is_after_last_on_page(
/*===========================*/
btr_pcur_t* cursor, /* in: persistent cursor */
mtr_t* mtr) /* in: mtr */
const btr_pcur_t* cursor) /* in: persistent cursor */
{
UT_NOT_USED(mtr);
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
......@@ -189,10 +191,8 @@ UNIV_INLINE
ibool
btr_pcur_is_before_first_on_page(
/*=============================*/
btr_pcur_t* cursor, /* in: persistent cursor */
mtr_t* mtr) /* in: mtr */
const btr_pcur_t* cursor) /* in: persistent cursor */
{
UT_NOT_USED(mtr);
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
......@@ -205,14 +205,13 @@ UNIV_INLINE
ibool
btr_pcur_is_on_user_rec(
/*====================*/
btr_pcur_t* cursor, /* in: persistent cursor */
mtr_t* mtr) /* in: mtr */
const btr_pcur_t* cursor) /* in: persistent cursor */
{
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
if ((btr_pcur_is_before_first_on_page(cursor, mtr))
|| (btr_pcur_is_after_last_on_page(cursor, mtr))) {
if (btr_pcur_is_before_first_on_page(cursor)
|| btr_pcur_is_after_last_on_page(cursor)) {
return(FALSE);
}
......@@ -268,10 +267,8 @@ UNIV_INLINE
void
btr_pcur_move_to_next_on_page(
/*==========================*/
btr_pcur_t* cursor, /* in: persistent cursor */
mtr_t* mtr) /* in: mtr */
btr_pcur_t* cursor) /* in/out: persistent cursor */
{
UT_NOT_USED(mtr);
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
......@@ -286,10 +283,8 @@ UNIV_INLINE
void
btr_pcur_move_to_prev_on_page(
/*==========================*/
btr_pcur_t* cursor, /* in: persistent cursor */
mtr_t* mtr) /* in: mtr */
btr_pcur_t* cursor) /* in/out: persistent cursor */
{
UT_NOT_USED(mtr);
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
......@@ -333,7 +328,7 @@ btr_pcur_move_to_next_user_rec(
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
loop:
if (btr_pcur_is_after_last_on_page(cursor, mtr)) {
if (btr_pcur_is_after_last_on_page(cursor)) {
if (btr_pcur_is_after_last_in_tree(cursor, mtr)) {
......@@ -342,10 +337,10 @@ loop:
btr_pcur_move_to_next_page(cursor, mtr);
} else {
btr_pcur_move_to_next_on_page(cursor, mtr);
btr_pcur_move_to_next_on_page(cursor);
}
if (btr_pcur_is_on_user_rec(cursor, mtr)) {
if (btr_pcur_is_on_user_rec(cursor)) {
return(TRUE);
}
......@@ -371,7 +366,7 @@ btr_pcur_move_to_next(
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
if (btr_pcur_is_after_last_on_page(cursor, mtr)) {
if (btr_pcur_is_after_last_on_page(cursor)) {
if (btr_pcur_is_after_last_in_tree(cursor, mtr)) {
......@@ -383,7 +378,7 @@ btr_pcur_move_to_next(
return(TRUE);
}
btr_pcur_move_to_next_on_page(cursor, mtr);
btr_pcur_move_to_next_on_page(cursor);
return(TRUE);
}
......
......@@ -238,13 +238,15 @@ UNIV_INLINE
ulint
page_cur_search(
/*============*/
/* out: number of matched fields on the left */
buf_block_t* block, /* in: buffer block */
dict_index_t* index, /* in: record descriptor */
const dtuple_t* tuple, /* in: data tuple */
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
or PAGE_CUR_GE */
page_cur_t* cursor);/* out: page cursor */
/* out: number of matched
fields on the left */
const buf_block_t* block, /* in: buffer block */
const dict_index_t* index, /* in: record descriptor */
const dtuple_t* tuple, /* in: data tuple */
ulint mode, /* in: PAGE_CUR_L,
PAGE_CUR_LE, PAGE_CUR_G, or
PAGE_CUR_GE */
page_cur_t* cursor);/* out: page cursor */
/********************************************************************
Searches the right position for a page cursor. */
......
......@@ -20,6 +20,7 @@ page_cur_get_page(
page_cur_t* cur) /* in: page cursor */
{
ut_ad(cur);
ut_ad(page_align(cur->rec) == cur->block->frame);
return(page_align(cur->rec));
}
......@@ -103,6 +104,8 @@ page_cur_is_before_first(
/* out: TRUE if at start */
const page_cur_t* cur) /* in: cursor */
{
ut_ad(cur);
ut_ad(page_align(cur->rec) == cur->block->frame);
return(page_rec_is_infimum(cur->rec));
}
......@@ -115,6 +118,8 @@ page_cur_is_after_last(
/* out: TRUE if at end */
const page_cur_t* cur) /* in: cursor */
{
ut_ad(cur);
ut_ad(page_align(cur->rec) == cur->block->frame);
return(page_rec_is_supremum(cur->rec));
}
......@@ -182,13 +187,15 @@ UNIV_INLINE
ulint
page_cur_search(
/*============*/
/* out: number of matched fields on the left */
buf_block_t* block, /* in: buffer block */
dict_index_t* index, /* in: record descriptor */
const dtuple_t* tuple, /* in: data tuple */
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
or PAGE_CUR_GE */
page_cur_t* cursor) /* out: page cursor */
/* out: number of matched
fields on the left */
const buf_block_t* block, /* in: buffer block */
const dict_index_t* index, /* in: record descriptor */
const dtuple_t* tuple, /* in: data tuple */
ulint mode, /* in: PAGE_CUR_L,
PAGE_CUR_LE, PAGE_CUR_G, or
PAGE_CUR_GE */
page_cur_t* cursor) /* out: page cursor */
{
ulint low_matched_fields = 0;
ulint low_matched_bytes = 0;
......
......@@ -1127,12 +1127,12 @@ row_merge_read_clustered_index(
row_ext_t* ext;
ibool has_next = TRUE;
btr_pcur_move_to_next_on_page(&pcur, &mtr);
btr_pcur_move_to_next_on_page(&pcur);
/* When switching pages, commit the mini-transaction
in order to release the latch on the old page. */
if (btr_pcur_is_after_last_on_page(&pcur, &mtr)) {
if (btr_pcur_is_after_last_on_page(&pcur)) {
btr_pcur_store_position(&pcur, &mtr);
mtr_commit(&mtr);
mtr_start(&mtr);
......
......@@ -2928,7 +2928,7 @@ row_truncate_table_for_mysql(
ulint len;
ulint root_page_no;
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
if (!btr_pcur_is_on_user_rec(&pcur)) {
/* The end of SYS_INDEXES has been reached. */
break;
}
......
......@@ -1752,7 +1752,7 @@ next_rec:
}
if (leaf_contains_updates
&& btr_pcur_is_after_last_on_page(&(plan->pcur), &mtr)) {
&& btr_pcur_is_after_last_on_page(&plan->pcur)) {
/* We must commit &mtr if we are moving to a different page,
because we have done updates to the x-latched leaf page, and
......@@ -1785,7 +1785,7 @@ next_table:
/* We found a record which satisfies the conditions: we can move to
the next table or return a row in the result set */
ut_ad(btr_pcur_is_on_user_rec(&(plan->pcur), &mtr));
ut_ad(btr_pcur_is_on_user_rec(&plan->pcur));
if (plan->unique_search && !node->can_get_updated) {
......@@ -1922,8 +1922,7 @@ commit_mtr_for_a_while:
lock_wait_or_error:
/* See the note at stop_for_a_while: the same holds for this case */
ut_ad(!btr_pcur_is_before_first_on_page(&(plan->pcur), &mtr)
|| !node->asc);
ut_ad(!btr_pcur_is_before_first_on_page(&plan->pcur) || !node->asc);
ut_ad(!search_latch_locked);
plan->stored_cursor_rec_processed = FALSE;
......@@ -3065,7 +3064,7 @@ sel_restore_position_for_mysql(
return(TRUE);
}
if (btr_pcur_is_on_user_rec(pcur, mtr)) {
if (btr_pcur_is_on_user_rec(pcur)) {
btr_pcur_move_to_prev(pcur, mtr);
}
......@@ -3075,7 +3074,7 @@ sel_restore_position_for_mysql(
ut_ad(relative_position == BTR_PCUR_BEFORE
|| relative_position == BTR_PCUR_BEFORE_FIRST_IN_TREE);
if (moves_up && btr_pcur_is_on_user_rec(pcur, mtr)) {
if (moves_up && btr_pcur_is_on_user_rec(pcur)) {
btr_pcur_move_to_next(pcur, mtr);
}
......
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