diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index 46a8d5b744c..de883ee26b6 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -56,6 +56,7 @@ Created 7/19/1997 Heikki Tuuri #include "log0recv.h" #include "que0que.h" #include "srv0start.h" /* srv_shutdown_state */ +#include "rem0cmp.h" /* STRUCTURE OF AN INSERT BUFFER RECORD @@ -3824,11 +3825,13 @@ skip_watch: /********************************************************************//** During merge, inserts to an index page a secondary index entry extracted -from the insert buffer. */ +from the insert buffer. +@return newly inserted record */ static -void +rec_t* ibuf_insert_to_index_page_low( /*==========================*/ + /* out: newly inserted record */ const dtuple_t* entry, /*!< in: buffered entry to insert */ buf_block_t* block, /*!< in/out: index page where the buffered entry should be placed */ @@ -3843,10 +3846,12 @@ ibuf_insert_to_index_page_low( ulint zip_size; const page_t* bitmap_page; ulint old_bits; + rec_t* rec; + DBUG_ENTER("ibuf_insert_to_index_page_low"); - if (UNIV_LIKELY - (page_cur_tuple_insert(page_cur, entry, index, 0, mtr) != NULL)) { - return; + rec = page_cur_tuple_insert(page_cur, entry, index, 0, mtr); + if (rec != NULL) { + DBUG_RETURN(rec); } /* If the record did not fit, reorganize */ @@ -3856,9 +3861,9 @@ ibuf_insert_to_index_page_low( /* This time the record must fit */ - if (UNIV_LIKELY - (page_cur_tuple_insert(page_cur, entry, index, 0, mtr) != NULL)) { - return; + rec = page_cur_tuple_insert(page_cur, entry, index, 0, mtr); + if (rec != NULL) { + DBUG_RETURN(rec); } page = buf_block_get_frame(block); @@ -3911,6 +3916,7 @@ ibuf_insert_to_index_page( ulint low_match; page_t* page = buf_block_get_frame(block); rec_t* rec; + DBUG_ENTER("ibuf_insert_to_index_page"); ut_ad(ibuf_inside(mtr)); ut_ad(dtuple_check_typed(entry)); @@ -3955,7 +3961,7 @@ dump: "InnoDB: Submit a detailed bug report to" " http://bugs.mysql.com!\n", stderr); - return; + DBUG_VOID_RETURN; } low_match = page_cur_search(block, index, entry, @@ -3990,7 +3996,7 @@ dump: rec, page_zip, FALSE, mtr); updated_in_place: mem_heap_free(heap); - return; + DBUG_VOID_RETURN; } /* Copy the info bits. Clear the delete-mark. */ @@ -4034,15 +4040,21 @@ updated_in_place: lock_rec_store_on_page_infimum(block, rec); page_cur_delete_rec(&page_cur, index, offsets, mtr); page_cur_move_to_prev(&page_cur); + + rec = ibuf_insert_to_index_page_low(entry, block, index, mtr, + &page_cur); + ut_ad(!cmp_dtuple_rec(entry, rec, + rec_get_offsets(rec, index, NULL, + ULINT_UNDEFINED, + &heap))); mem_heap_free(heap); - ibuf_insert_to_index_page_low(entry, block, index, mtr, - &page_cur); lock_rec_restore_from_page_infimum(block, rec, block); } else { ibuf_insert_to_index_page_low(entry, block, index, mtr, &page_cur); } + DBUG_VOID_RETURN; } /****************************************************************//**