diff options
author | Mattias Jonsson <mattias.jonsson@oracle.com> | 2013-10-01 10:05:45 +0200 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@oracle.com> | 2013-10-01 10:05:45 +0200 |
commit | 261268d84c0c162b7dee1b297950fdd0d1202097 (patch) | |
tree | 0de3fbb2755f4072b0ebeb0953a7234ef326313d /storage/innobase/btr | |
parent | 39a87704d8a3f747e8a036460d3d044741db1764 (diff) | |
download | mariadb-git-261268d84c0c162b7dee1b297950fdd0d1202097.tar.gz |
Bug#14621190: HA_INNOBASE::INDEX_NEXT SKIPS A RECORD IF PREVIOUS
INDEX_READ_MAP HAD NO MATCH
If index_read_map is called for exact search and no matching records
exists it will position the cursor on the next record, but still having the
relative position to BTR_PCUR_ON.
This will make a call for index_next to read yet another next record,
instead of returning the record the cursor points to.
Fixed by setting pcur->rel_pos = BTR_PCUR_BEFORE if an exact
[prefix] search is done, but failed.
Also avoids optimistic restoration if rel_pos != BTR_PCUR_ON,
since btr_cur may be different than old_rec.
rb#3324, approved by Marko and Jimmy
Diffstat (limited to 'storage/innobase/btr')
-rw-r--r-- | storage/innobase/btr/btr0pcur.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c index 0cfdf138bad..fbedc1e7d04 100644 --- a/storage/innobase/btr/btr0pcur.c +++ b/storage/innobase/btr/btr0pcur.c @@ -273,13 +273,15 @@ btr_pcur_restore_position_func( if (UNIV_LIKELY(latch_mode == BTR_SEARCH_LEAF) || UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) { - /* Try optimistic restoration */ + /* Try optimistic restoration if cursor is expected to be + positioned on the same btr record as before (BTR_PCUR_ON). */ - if (UNIV_LIKELY(buf_page_optimistic_get( + if (cursor->rel_pos == BTR_PCUR_ON + && buf_page_optimistic_get( latch_mode, cursor->block_when_stored, cursor->modify_clock, - file, line, mtr))) { + file, line, mtr)) { cursor->pos_state = BTR_PCUR_IS_POSITIONED; buf_block_dbg_add_level( @@ -287,7 +289,7 @@ btr_pcur_restore_position_func( dict_index_is_ibuf(index) ? SYNC_IBUF_TREE_NODE : SYNC_TREE_NODE); - if (cursor->rel_pos == BTR_PCUR_ON) { + { #ifdef UNIV_DEBUG const rec_t* rec; const ulint* offsets1; @@ -312,8 +314,6 @@ btr_pcur_restore_position_func( #endif /* UNIV_DEBUG */ return(TRUE); } - - return(FALSE); } } |