summaryrefslogtreecommitdiff
path: root/storage/innobase/ibuf/ibuf0ibuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/ibuf/ibuf0ibuf.c')
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.c76
1 files changed, 64 insertions, 12 deletions
diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
index e2b5bda44fd..ae6c5f6636f 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.c
+++ b/storage/innobase/ibuf/ibuf0ibuf.c
@@ -1,3 +1,21 @@
+/*****************************************************************************
+
+Copyright (c) 1997, 2013, Oracle and/or its affiliates. All Rights Reserved.
+
+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
+Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+*****************************************************************************/
+
/******************************************************
Insert buffer
@@ -29,6 +47,7 @@ Created 7/19/1997 Heikki Tuuri
#include "lock0lock.h"
#include "log0recv.h"
#include "que0que.h"
+#include "rem0cmp.h"
/* STRUCTURE OF AN INSERT BUFFER RECORD
@@ -2837,9 +2856,10 @@ ibuf_insert(
During merge, inserts to an index page a secondary index entry extracted
from the insert buffer. */
static
-void
+rec_t*
ibuf_insert_to_index_page_low(
/*==========================*/
+ /* out: newly inserted record */
dtuple_t* entry, /* in: buffered entry to insert */
page_t* page, /* in: index page where the buffered entry
should be placed */
@@ -2852,10 +2872,13 @@ ibuf_insert_to_index_page_low(
ulint page_no;
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, mtr) != NULL)) {
- return;
+ rec = page_cur_tuple_insert(page_cur, entry, index, mtr);
+
+ if (rec != NULL) {
+ DBUG_RETURN(rec);
}
/* If the record did not fit, reorganize */
@@ -2866,9 +2889,10 @@ ibuf_insert_to_index_page_low(
/* This time the record must fit */
- if (UNIV_LIKELY
- (page_cur_tuple_insert(page_cur, entry, index, mtr) != NULL)) {
- return;
+ rec = page_cur_tuple_insert(page_cur, entry, index, mtr);
+
+ if (rec != NULL) {
+ DBUG_RETURN(rec);
}
ut_print_timestamp(stderr);
@@ -2897,6 +2921,8 @@ ibuf_insert_to_index_page_low(
fputs("InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
+
+ DBUG_RETURN(NULL);
}
/************************************************************************
@@ -2916,6 +2942,8 @@ ibuf_insert_to_index_page(
ulint low_match;
rec_t* rec;
+ DBUG_ENTER("ibuf_insert_to_index_page");
+
ut_ad(ibuf_inside());
ut_ad(dtuple_check_typed(entry));
ut_ad(!buf_block_align(page)->is_hashed);
@@ -2950,7 +2978,7 @@ dump:
"InnoDB: Submit a detailed bug report to"
" http://bugs.mysql.com!\n", stderr);
- return;
+ DBUG_VOID_RETURN;
}
low_match = page_cur_search(page, index, entry,
@@ -2981,7 +3009,7 @@ dump:
btr_cur_set_deleted_flag_for_ibuf(rec, FALSE, mtr);
updated_in_place:
mem_heap_free(heap);
- return;
+ DBUG_VOID_RETURN;
}
/* Copy the info bits. Clear the delete-mark. */
@@ -2996,6 +3024,24 @@ updated_in_place:
/* This is the easy case. Do something similar
to btr_cur_update_in_place(). */
row_upd_rec_in_place(rec, offsets, update);
+
+ /* Log the update in place operation. During recovery
+ MLOG_COMP_REC_UPDATE_IN_PLACE/MLOG_REC_UPDATE_IN_PLACE
+ expects trx_id, roll_ptr for secondary indexes. So we
+ just write dummy trx_id(0), roll_ptr(0) */
+ btr_cur_update_in_place_log(BTR_KEEP_SYS_FLAG, rec,
+ index, update,
+ NULL,
+ ut_dulint_zero, mtr);
+ DBUG_EXECUTE_IF(
+ "crash_after_log_ibuf_upd_inplace",
+ log_buffer_flush_to_disk();
+ fprintf(stderr,
+ "InnoDB: Wrote log record for ibuf "
+ "update in place operation\n");
+ DBUG_SUICIDE();
+ );
+
goto updated_in_place;
}
@@ -3021,15 +3067,21 @@ updated_in_place:
lock_rec_store_on_page_infimum(page, rec);
page_cur_delete_rec(&page_cur, index, offsets, mtr);
page_cur_move_to_prev(&page_cur);
- mem_heap_free(heap);
- ibuf_insert_to_index_page_low(entry, page, index, mtr,
- &page_cur);
+ rec = ibuf_insert_to_index_page_low(entry, page, index, mtr,
+ &page_cur);
+ ut_ad(!cmp_dtuple_rec(entry, rec,
+ rec_get_offsets(rec, index, NULL,
+ ULINT_UNDEFINED,
+ &heap)));
+ mem_heap_free(heap);
lock_rec_restore_from_page_infimum(rec, page);
} else {
ibuf_insert_to_index_page_low(entry, page, index, mtr,
&page_cur);
}
+
+ DBUG_VOID_RETURN;
}
/*************************************************************************