Merge mysql-5.1 to mysql-5.5.

This commit is contained in:
Marko Mäkelä 2012-03-08 15:03:40 +02:00
commit f9ae663833

View File

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -133,6 +133,8 @@ btr_pcur_store_position(
ut_a(btr_page_get_next(page, mtr) == FIL_NULL); ut_a(btr_page_get_next(page, mtr) == FIL_NULL);
ut_a(btr_page_get_prev(page, mtr) == FIL_NULL); ut_a(btr_page_get_prev(page, mtr) == FIL_NULL);
ut_ad(page_is_leaf(page));
ut_ad(page_get_page_no(page) == index->page);
cursor->old_stored = BTR_PCUR_OLD_STORED; cursor->old_stored = BTR_PCUR_OLD_STORED;
@ -325,13 +327,20 @@ btr_pcur_restore_position_func(
/* Save the old search mode of the cursor */ /* Save the old search mode of the cursor */
old_mode = cursor->search_mode; old_mode = cursor->search_mode;
if (UNIV_LIKELY(cursor->rel_pos == BTR_PCUR_ON)) { switch (cursor->rel_pos) {
case BTR_PCUR_ON:
mode = PAGE_CUR_LE; mode = PAGE_CUR_LE;
} else if (cursor->rel_pos == BTR_PCUR_AFTER) { break;
case BTR_PCUR_AFTER:
mode = PAGE_CUR_G; mode = PAGE_CUR_G;
} else { break;
ut_ad(cursor->rel_pos == BTR_PCUR_BEFORE); case BTR_PCUR_BEFORE:
mode = PAGE_CUR_L; mode = PAGE_CUR_L;
break;
#ifdef UNIV_DEBUG
default:
ut_error;
#endif /* UNIV_DEBUG */
} }
btr_pcur_open_with_no_init_func(index, tuple, mode, latch_mode, btr_pcur_open_with_no_init_func(index, tuple, mode, latch_mode,
@ -340,25 +349,44 @@ 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 (cursor->rel_pos == BTR_PCUR_ON if (btr_pcur_is_on_user_rec(cursor)) {
&& btr_pcur_is_on_user_rec(cursor) switch (cursor->rel_pos) {
&& 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor), case BTR_PCUR_ON:
rec_get_offsets( if (!cmp_dtuple_rec(
btr_pcur_get_rec(cursor), index, tuple, btr_pcur_get_rec(cursor),
NULL, ULINT_UNDEFINED, &heap))) { rec_get_offsets(btr_pcur_get_rec(cursor),
index, NULL,
ULINT_UNDEFINED, &heap))) {
/* We have to store the NEW value for the modify clock, since /* We have to store the NEW value for
the cursor can now be on a different page! But we can retain the modify clock, since the cursor can
the value of old_rec */ now be on a different page! But we can
retain the value of old_rec */
cursor->block_when_stored = btr_pcur_get_block(cursor); cursor->block_when_stored =
cursor->modify_clock = buf_block_get_modify_clock( btr_pcur_get_block(cursor);
cursor->block_when_stored); cursor->modify_clock =
cursor->old_stored = BTR_PCUR_OLD_STORED; buf_block_get_modify_clock(
cursor->block_when_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
default:
ut_error;
#endif /* UNIV_DEBUG */
}
} }
mem_heap_free(heap); mem_heap_free(heap);