summaryrefslogtreecommitdiff
path: root/storage/innobase/row/row0sel.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/row/row0sel.cc')
-rw-r--r--storage/innobase/row/row0sel.cc28
1 files changed, 20 insertions, 8 deletions
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index d11b29d995f..0061ada7d1e 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -1803,7 +1803,11 @@ rec_loop:
search result set, resulting in the phantom problem. */
if (!node->read_view) {
- rec_t* next_rec = page_rec_get_next(rec);
+ const rec_t* next_rec = page_rec_get_next_const(rec);
+ if (UNIV_UNLIKELY(!next_rec)) {
+ err = DB_CORRUPTION;
+ goto lock_wait_or_error;
+ }
unsigned lock_type;
offsets = rec_get_offsets(next_rec, index, offsets,
@@ -3424,11 +3428,13 @@ Row_sel_get_clust_rec_for_mysql::operator()(
rec, sec_index, true,
sec_index->n_fields, heap);
page_cur_t page_cursor;
-
- ulint low_match = page_cur_search(
- block, sec_index, tuple,
- PAGE_CUR_LE, &page_cursor);
-
+ ulint up_match = 0, low_match = 0;
+ ut_ad(!page_cur_search_with_match(block, sec_index,
+ tuple, PAGE_CUR_LE,
+ &up_match,
+ &low_match,
+ &page_cursor,
+ nullptr));
ut_ad(low_match < dtuple_get_n_fields_cmp(tuple));
mem_heap_free(heap);
clust_rec = NULL;
@@ -4769,6 +4775,7 @@ wait_table_again:
pcur, 0, &mtr);
if (err != DB_SUCCESS) {
+page_corrupted:
rec = NULL;
goto page_read_error;
}
@@ -4786,6 +4793,10 @@ wait_table_again:
/* Try to place a gap lock on the next index record
to prevent phantoms in ORDER BY ... DESC queries */
const rec_t* next_rec = page_rec_get_next_const(rec);
+ if (UNIV_UNLIKELY(!next_rec)) {
+ err = DB_CORRUPTION;
+ goto page_corrupted;
+ }
offsets = rec_get_offsets(next_rec, index, offsets,
index->n_core_fields,
@@ -5792,8 +5803,8 @@ next_rec_after_check:
if (err != DB_SUCCESS) {
goto lock_wait_or_error;
}
- } else {
- btr_pcur_move_to_next_on_page(pcur);
+ } else if (!btr_pcur_move_to_next_on_page(pcur)) {
+ goto corrupted;
}
goto rec_loop;
@@ -5803,6 +5814,7 @@ next_rec_after_check:
goto rec_loop;
}
if (UNIV_UNLIKELY(!btr_pcur_get_rec(pcur))) {
+corrupted:
err = DB_CORRUPTION;
goto normal_return;
}