summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--innobase/btr/btr0pcur.c10
-rw-r--r--innobase/include/btr0pcur.h4
-rw-r--r--innobase/include/btr0pcur.ic10
-rw-r--r--innobase/row/row0sel.c4
4 files changed, 27 insertions, 1 deletions
diff --git a/innobase/btr/btr0pcur.c b/innobase/btr/btr0pcur.c
index cf8a612ef28..0dcf6c2f3fc 100644
--- a/innobase/btr/btr0pcur.c
+++ b/innobase/btr/btr0pcur.c
@@ -14,6 +14,7 @@ Created 2/23/1996 Heikki Tuuri
#include "ut0byte.h"
#include "rem0cmp.h"
+#include "trx0trx.h"
/******************************************************************
Allocates memory for a persistent cursor object and initializes the cursor. */
@@ -203,7 +204,14 @@ btr_pcur_restore_position(
ut_a(cursor->pos_state == BTR_PCUR_WAS_POSITIONED
|| cursor->pos_state == BTR_PCUR_IS_POSITIONED);
- ut_a(cursor->old_stored == BTR_PCUR_OLD_STORED);
+ if (cursor->old_stored != BTR_PCUR_OLD_STORED) {
+ ut_print_buf(stderr, (const byte*)cursor, sizeof(btr_pcur_t));
+ if (cursor->trx_if_known) {
+ trx_print(stderr, cursor->trx_if_known);
+ }
+
+ ut_a(0);
+ }
if (cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE) {
diff --git a/innobase/include/btr0pcur.h b/innobase/include/btr0pcur.h
index 81f19af4d40..9339eb5d0ee 100644
--- a/innobase/include/btr0pcur.h
+++ b/innobase/include/btr0pcur.h
@@ -477,6 +477,10 @@ struct btr_pcur_struct{
BTR_PCUR_WAS_POSITIONED,
BTR_PCUR_NOT_POSITIONED */
ulint search_mode; /* PAGE_CUR_G, ... */
+ trx_t* trx_if_known; /* the transaction, if we know it;
+ otherwise this field is not defined;
+ can ONLY BE USED in error prints in
+ fatal assertion failures! */
/*-----------------------------*/
/* NOTE that the following fields may possess dynamically allocated
memory which should be freed if not needed anymore! */
diff --git a/innobase/include/btr0pcur.ic b/innobase/include/btr0pcur.ic
index b553a569bda..9a7d7867025 100644
--- a/innobase/include/btr0pcur.ic
+++ b/innobase/include/btr0pcur.ic
@@ -493,6 +493,8 @@ btr_pcur_open(
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
btr_cursor, 0, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
+
+ cursor->trx_if_known = NULL;
}
/******************************************************************
@@ -535,6 +537,8 @@ btr_pcur_open_with_no_init(
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
+
+ cursor->trx_if_known = NULL;
}
/*********************************************************************
@@ -568,6 +572,8 @@ btr_pcur_open_at_index_side(
pcur->pos_state = BTR_PCUR_IS_POSITIONED;
pcur->old_stored = BTR_PCUR_OLD_NOT_STORED;
+
+ pcur->trx_if_known = NULL;
}
/**************************************************************************
@@ -592,6 +598,8 @@ btr_pcur_open_at_rnd_pos(
btr_pcur_get_btr_cur(cursor), mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
+
+ cursor->trx_if_known = NULL;
}
/******************************************************************
@@ -617,4 +625,6 @@ btr_pcur_close(
cursor->latch_mode = BTR_NO_LATCHES;
cursor->pos_state = BTR_PCUR_NOT_POSITIONED;
+
+ cursor->trx_if_known = NULL;
}
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index 07140e74e54..eb88ac31ba9 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -2507,6 +2507,8 @@ row_sel_get_clust_rec_for_mysql(
clust_rec = btr_pcur_get_rec(prebuilt->clust_pcur);
+ prebuilt->clust_pcur->trx_if_known = trx;
+
/* Note: only if the search ends up on a non-infimum record is the
low_match value the real match to the search tuple */
@@ -3222,6 +3224,8 @@ shortcut_fails_too_big_rec:
btr_pcur_open_with_no_init(index, search_tuple, mode,
BTR_SEARCH_LEAF,
pcur, 0, &mtr);
+
+ pcur->trx_if_known = trx;
} else {
if (mode == PAGE_CUR_G) {
btr_pcur_open_at_index_side(TRUE, index,