From 6d483cf3abb093546fbea512019258ffaed3aac5 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Mon, 28 Oct 2013 17:08:31 +0100 Subject: [PATCH] post-push fix for bug#17565888/bug#14621190 --- storage/innobase/btr/btr0pcur.c | 10 +++++----- storage/innobase/row/row0sel.c | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c index ea187305656..09b3715e096 100644 --- a/storage/innobase/btr/btr0pcur.c +++ b/storage/innobase/btr/btr0pcur.c @@ -124,7 +124,6 @@ btr_pcur_store_position( ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_S_FIX) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); - ut_a(cursor->latch_mode != BTR_NO_LATCHES); if (UNIV_UNLIKELY(page_get_n_recs(page) == 0)) { /* It must be an empty index tree; NOTE that in this case @@ -271,6 +270,7 @@ btr_pcur_restore_position_func( cursor->modify_clock, file, line, mtr)) { cursor->pos_state = BTR_PCUR_IS_POSITIONED; + cursor->latch_mode = latch_mode; buf_block_dbg_add_level( btr_pcur_get_block(cursor), @@ -282,9 +282,6 @@ btr_pcur_restore_position_func( const rec_t* rec; const ulint* offsets1; const ulint* offsets2; -#endif /* UNIV_DEBUG */ - cursor->latch_mode = latch_mode; -#ifdef UNIV_DEBUG rec = btr_pcur_get_rec(cursor); heap = mem_heap_create(256); @@ -305,7 +302,10 @@ btr_pcur_restore_position_func( /* This is the same record as stored, may need to be adjusted for BTR_PCUR_BEFORE/AFTER, depending on search mode and direction. */ - cursor->pos_state = BTR_PCUR_IS_POSITIONED_OPTIMISTIC; + if (btr_pcur_is_on_user_rec(cursor)) { + cursor->pos_state + = BTR_PCUR_IS_POSITIONED_OPTIMISTIC; + } return(FALSE); } } diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index c8e293080c1..b8336f88532 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -3108,6 +3108,8 @@ sel_restore_position_for_mysql( || pcur->rel_pos == BTR_PCUR_AFTER); } else { ut_ad(pcur->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad((pcur->rel_pos == BTR_PCUR_ON) + == btr_pcur_is_on_user_rec(pcur)); } #endif