Commit 05c6614d authored by Marko Mäkelä's avatar Marko Mäkelä

Merge mysql-5.1 to mysql-5.5.

parents 17c5725c bb849479
...@@ -348,44 +348,39 @@ btr_pcur_restore_position_func( ...@@ -348,44 +348,39 @@ btr_pcur_restore_position_func(
/* Restore the old search mode */ /* Restore the old search mode */
cursor->search_mode = old_mode; cursor->search_mode = old_mode;
if (btr_pcur_is_on_user_rec(cursor)) { switch (cursor->rel_pos) {
switch (cursor->rel_pos) { case BTR_PCUR_ON:
case BTR_PCUR_ON: if (btr_pcur_is_on_user_rec(cursor)
if (!cmp_dtuple_rec( && !cmp_dtuple_rec(
tuple, btr_pcur_get_rec(cursor), tuple, btr_pcur_get_rec(cursor),
rec_get_offsets(btr_pcur_get_rec(cursor), rec_get_offsets(btr_pcur_get_rec(cursor),
index, NULL, index, NULL,
ULINT_UNDEFINED, &heap))) { ULINT_UNDEFINED, &heap))) {
/* We have to store the NEW value for /* We have to store the NEW value for
the modify clock, since the cursor can the modify clock, since the cursor can
now be on a different page! But we can now be on a different page! But we can
retain the value of old_rec */ retain the value of old_rec */
cursor->block_when_stored = cursor->block_when_stored =
btr_pcur_get_block(cursor); btr_pcur_get_block(cursor);
cursor->modify_clock = cursor->modify_clock =
buf_block_get_modify_clock( buf_block_get_modify_clock(
cursor->block_when_stored); cursor->block_when_stored);
cursor->old_stored = BTR_PCUR_OLD_STORED; cursor->old_stored = BTR_PCUR_OLD_STORED;
mem_heap_free(heap); mem_heap_free(heap);
return(TRUE); return(TRUE);
} }
break;
case BTR_PCUR_BEFORE:
page_cur_move_to_next(btr_pcur_get_page_cur(cursor));
break;
case BTR_PCUR_AFTER:
page_cur_move_to_prev(btr_pcur_get_page_cur(cursor));
break;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
default: /* fall through */
ut_error; case BTR_PCUR_BEFORE:
case BTR_PCUR_AFTER:
break;
default:
ut_error;
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
}
} }
mem_heap_free(heap); mem_heap_free(heap);
......
...@@ -1235,11 +1235,25 @@ row_merge_read_clustered_index( ...@@ -1235,11 +1235,25 @@ row_merge_read_clustered_index(
goto err_exit; goto err_exit;
} }
/* Store the cursor position on the last user
record on the page. */
btr_pcur_move_to_prev_on_page(&pcur);
/* Leaf pages must never be empty, unless
this is the only page in the index tree. */
ut_ad(btr_pcur_is_on_user_rec(&pcur)
|| buf_block_get_page_no(
btr_pcur_get_block(&pcur))
== clust_index->page);
btr_pcur_store_position(&pcur, &mtr); btr_pcur_store_position(&pcur, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
mtr_start(&mtr); mtr_start(&mtr);
/* Restore position on the record, or its
predecessor if the record was purged
meanwhile. */
btr_pcur_restore_position(BTR_SEARCH_LEAF, btr_pcur_restore_position(BTR_SEARCH_LEAF,
&pcur, &mtr); &pcur, &mtr);
/* Move to the successor of the original record. */
has_next = btr_pcur_move_to_next_user_rec(&pcur, &mtr); has_next = btr_pcur_move_to_next_user_rec(&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