summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorheikki@hundin.mysql.fi <>2003-01-18 15:01:56 +0200
committerheikki@hundin.mysql.fi <>2003-01-18 15:01:56 +0200
commit8fc51bb42776e4463923413b6a4371a5812c5de0 (patch)
tree8d5283cbff706ae037c9b193df41ddaa63191387 /innobase
parentc1d614192ee6930aed50f0cf64bf60abf6c1acb0 (diff)
downloadmariadb-git-8fc51bb42776e4463923413b6a4371a5812c5de0.tar.gz
btr0sea.h, btr0sea.c:
Fix a crash in page_dir_find_owner_slot if an adaptive hash index search coincides with purge or an insert
Diffstat (limited to 'innobase')
-rw-r--r--innobase/btr/btr0sea.c28
-rw-r--r--innobase/include/btr0sea.h14
2 files changed, 37 insertions, 5 deletions
diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
index de3fe6e196e..5c5ed934a9b 100644
--- a/innobase/btr/btr0sea.c
+++ b/innobase/btr/btr0sea.c
@@ -508,6 +508,14 @@ btr_search_check_guess(
/*===================*/
/* out: TRUE if success */
btr_cur_t* cursor, /* in: guessed cursor position */
+ ibool can_only_compare_to_cursor_rec,
+ /* in: if we do not have a latch on the page
+ of cursor, but only a latch on
+ btr_search_latch, then ONLY the columns
+ of the record UNDER the cursor are
+ protected, not the next or previous record
+ in the chain: we cannot look at the next or
+ previous record to check our guess! */
dtuple_t* tuple, /* in: data tuple */
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
or PAGE_CUR_GE */
@@ -566,6 +574,13 @@ btr_search_check_guess(
}
}
+ if (can_only_compare_to_cursor_rec) {
+ /* Since we could not determine if our guess is right just by
+ looking at the record under the cursor, return FALSE */
+
+ return(FALSE);
+ }
+
match = 0;
bytes = 0;
@@ -670,6 +685,7 @@ btr_search_guess_on_hash(
ulint fold;
ulint tuple_n_fields;
dulint tree_id;
+ ibool can_only_compare_to_cursor_rec = TRUE;
#ifdef notdefined
btr_cur_t cursor2;
btr_pcur_t pcur;
@@ -744,6 +760,8 @@ btr_search_guess_on_hash(
goto failure;
}
+ can_only_compare_to_cursor_rec = FALSE;
+
buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH);
}
@@ -775,7 +793,15 @@ btr_search_guess_on_hash(
fold);
*/
} else {
- success = btr_search_check_guess(cursor, tuple, mode, mtr);
+ /* If we only have the latch on btr_search_latch, not on the
+ page, it only protects the columns of the record the cursor
+ is positioned on. We cannot look at the next of the previous
+ record to determine if our guess for the cursor position is
+ right. */
+
+ success = btr_search_check_guess(cursor,
+ can_only_compare_to_cursor_rec,
+ tuple, mode, mtr);
}
if (!success) {
diff --git a/innobase/include/btr0sea.h b/innobase/include/btr0sea.h
index 14feca5d5c5..ee762a12221 100644
--- a/innobase/include/btr0sea.h
+++ b/innobase/include/btr0sea.h
@@ -234,10 +234,16 @@ struct btr_search_sys_struct{
extern btr_search_sys_t* btr_search_sys;
/* The latch protecting the adaptive search system: this latch protects the
-(1) positions of records on those pages where a hash index has been built.
-NOTE: It does not protect values of non-ordering fields within a record from
-being updated in-place! We can use fact (1) to perform unique searches to
-indexes. */
+(1) hash index;
+(2) columns of a record to which we have a pointer in the hash index;
+
+but does NOT protect:
+
+(3) next record offset field in a record;
+(4) next or previous records on the same page.
+
+Bear in mind (3) and (4) when using the hash index.
+*/
extern rw_lock_t* btr_search_latch_temp;