Commit 47313207 authored by Marko Mäkelä's avatar Marko Mäkelä

Add instrumentation for Bug#13721257 RACE CONDITION IN UPDATES OR INSERTS

OF WIDE RECORDS

row_ins_index_entry_low(), row_upd_clust_rec(): Make a redo log
checkpoint if a DEBUG flag is set. Add DEBUG_SYNC around
btr_store_big_rec_extern_fields().

rb:946 approved by Jimmy Yang
parent 0fa088c9
...@@ -6,6 +6,9 @@ Insert into a table ...@@ -6,6 +6,9 @@ Insert into a table
Created 4/20/1996 Heikki Tuuri Created 4/20/1996 Heikki Tuuri
*******************************************************/ *******************************************************/
#include "my_global.h" /* HAVE_* */
#include "m_string.h" /* for my_sys.h */
#include "my_sys.h" /* DEBUG_SYNC_C */
#include "row0ins.h" #include "row0ins.h"
#ifdef UNIV_NONINL #ifdef UNIV_NONINL
...@@ -2121,16 +2124,24 @@ row_ins_index_entry_low( ...@@ -2121,16 +2124,24 @@ row_ins_index_entry_low(
if (big_rec) { if (big_rec) {
rec_t* rec; rec_t* rec;
DBUG_EXECUTE_IF(
"row_ins_extern_checkpoint",
log_make_checkpoint_at(ut_dulint_max, TRUE););
mtr_start(&mtr); mtr_start(&mtr);
DEBUG_SYNC_C("before_row_ins_extern_latch");
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
BTR_MODIFY_TREE, &cursor, 0, &mtr); BTR_MODIFY_TREE, &cursor, 0, &mtr);
rec = btr_cur_get_rec(&cursor); rec = btr_cur_get_rec(&cursor);
offsets = rec_get_offsets(rec, index, offsets, offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
DEBUG_SYNC_C("before_row_ins_upd_extern");
err = btr_store_big_rec_extern_fields(index, rec, err = btr_store_big_rec_extern_fields(index, rec,
offsets, big_rec, &mtr); offsets, big_rec, &mtr);
DEBUG_SYNC_C("after_row_ins_upd_extern");
if (modify) { if (modify) {
dtuple_big_rec_free(big_rec); dtuple_big_rec_free(big_rec);
......
...@@ -6,6 +6,9 @@ Update of a row ...@@ -6,6 +6,9 @@ Update of a row
Created 12/27/1996 Heikki Tuuri Created 12/27/1996 Heikki Tuuri
*******************************************************/ *******************************************************/
#include "my_global.h" /* HAVE_* */
#include "m_string.h" /* for my_sys.h */
#include "my_sys.h" /* DEBUG_SYNC_C */
#include "row0upd.h" #include "row0upd.h"
#ifdef UNIV_NONINL #ifdef UNIV_NONINL
...@@ -1591,15 +1594,20 @@ row_upd_clust_rec( ...@@ -1591,15 +1594,20 @@ row_upd_clust_rec(
rec_t* rec; rec_t* rec;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; *offsets_ = (sizeof offsets_) / sizeof *offsets_;
mtr_start(mtr); DBUG_EXECUTE_IF(
"row_upd_extern_checkpoint",
log_make_checkpoint_at(ut_dulint_max, TRUE););
mtr_start(mtr);
ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr)); ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
rec = btr_cur_get_rec(btr_cur); rec = btr_cur_get_rec(btr_cur);
DEBUG_SYNC_C("before_row_upd_extern");
err = btr_store_big_rec_extern_fields( err = btr_store_big_rec_extern_fields(
index, rec, index, rec,
rec_get_offsets(rec, index, offsets_, rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap), ULINT_UNDEFINED, &heap),
big_rec, mtr); big_rec, mtr);
DEBUG_SYNC_C("after_row_upd_extern");
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap); mem_heap_free(heap);
} }
......
...@@ -23,6 +23,9 @@ Insert into a table ...@@ -23,6 +23,9 @@ Insert into a table
Created 4/20/1996 Heikki Tuuri Created 4/20/1996 Heikki Tuuri
*******************************************************/ *******************************************************/
#include "my_global.h" /* HAVE_* */
#include "m_string.h" /* for my_sys.h */
#include "my_sys.h" /* DEBUG_SYNC_C */
#include "row0ins.h" #include "row0ins.h"
#ifdef UNIV_NONINL #ifdef UNIV_NONINL
...@@ -2122,8 +2125,14 @@ row_ins_index_entry_low( ...@@ -2122,8 +2125,14 @@ row_ins_index_entry_low(
if (UNIV_LIKELY_NULL(big_rec)) { if (UNIV_LIKELY_NULL(big_rec)) {
rec_t* rec; rec_t* rec;
ulint* offsets; ulint* offsets;
DBUG_EXECUTE_IF(
"row_ins_extern_checkpoint",
log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE););
mtr_start(&mtr); mtr_start(&mtr);
DEBUG_SYNC_C("before_row_ins_extern_latch");
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
BTR_MODIFY_TREE, &cursor, 0, BTR_MODIFY_TREE, &cursor, 0,
__FILE__, __LINE__, &mtr); __FILE__, __LINE__, &mtr);
...@@ -2131,9 +2140,11 @@ row_ins_index_entry_low( ...@@ -2131,9 +2140,11 @@ row_ins_index_entry_low(
offsets = rec_get_offsets(rec, index, NULL, offsets = rec_get_offsets(rec, index, NULL,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
DEBUG_SYNC_C("before_row_ins_upd_extern");
err = btr_store_big_rec_extern_fields( err = btr_store_big_rec_extern_fields(
index, btr_cur_get_block(&cursor), index, btr_cur_get_block(&cursor),
rec, offsets, &mtr, FALSE, big_rec); rec, offsets, &mtr, FALSE, big_rec);
DEBUG_SYNC_C("after_row_ins_upd_extern");
if (modify) { if (modify) {
dtuple_big_rec_free(big_rec); dtuple_big_rec_free(big_rec);
......
...@@ -23,6 +23,9 @@ Update of a row ...@@ -23,6 +23,9 @@ Update of a row
Created 12/27/1996 Heikki Tuuri Created 12/27/1996 Heikki Tuuri
*******************************************************/ *******************************************************/
#include "my_global.h" /* HAVE_* */
#include "m_string.h" /* for my_sys.h */
#include "my_sys.h" /* DEBUG_SYNC_C */
#include "row0upd.h" #include "row0upd.h"
#ifdef UNIV_NONINL #ifdef UNIV_NONINL
...@@ -1979,15 +1982,20 @@ row_upd_clust_rec( ...@@ -1979,15 +1982,20 @@ row_upd_clust_rec(
rec_t* rec; rec_t* rec;
rec_offs_init(offsets_); rec_offs_init(offsets_);
mtr_start(mtr); DBUG_EXECUTE_IF(
"row_upd_extern_checkpoint",
log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE););
mtr_start(mtr);
ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr)); ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
rec = btr_cur_get_rec(btr_cur); rec = btr_cur_get_rec(btr_cur);
DEBUG_SYNC_C("before_row_upd_extern");
err = btr_store_big_rec_extern_fields( err = btr_store_big_rec_extern_fields(
index, btr_cur_get_block(btr_cur), rec, index, btr_cur_get_block(btr_cur), rec,
rec_get_offsets(rec, index, offsets_, rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap), ULINT_UNDEFINED, &heap),
mtr, TRUE, big_rec); mtr, TRUE, big_rec);
DEBUG_SYNC_C("after_row_upd_extern");
mtr_commit(mtr); mtr_commit(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