summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/btr/btr0pcur.cc2
-rw-r--r--storage/innobase/dict/dict0dict.cc24
-rw-r--r--storage/innobase/gis/gis0sea.cc2
-rw-r--r--storage/innobase/include/dict0dict.h30
-rw-r--r--storage/innobase/include/rem0rec.h11
-rw-r--r--storage/innobase/rem/rem0rec.cc4
-rw-r--r--storage/innobase/row/row0sel.cc19
7 files changed, 56 insertions, 36 deletions
diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc
index ee33d9c296a..2b85c764a3b 100644
--- a/storage/innobase/btr/btr0pcur.cc
+++ b/storage/innobase/btr/btr0pcur.cc
@@ -331,7 +331,7 @@ btr_pcur_restore_position_func(
heap = mem_heap_create(256);
- tuple = dict_index_build_data_tuple(index, cursor->old_rec,
+ tuple = dict_index_build_data_tuple(cursor->old_rec, index, true,
cursor->old_n_fields, heap);
/* Save the old search mode of the cursor */
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 789c3c4d398..fbc7c117b9d 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -5702,16 +5702,22 @@ dict_index_copy_rec_order_prefix(
return(rec_copy_prefix_to_buf(rec, index, n, buf, buf_size));
}
-/**********************************************************************//**
-Builds a typed data tuple out of a physical record.
+/** Convert a physical record into a search tuple.
+@param[in] rec index record (not necessarily in an index page)
+@param[in] index index
+@param[in] leaf whether rec is in a leaf page
+@param[in] n_fields number of data fields
+@param[in,out] heap memory heap for allocation
@return own: data tuple */
dtuple_t*
-dict_index_build_data_tuple(
-/*========================*/
- dict_index_t* index, /*!< in: index tree */
- rec_t* rec, /*!< in: record for which to build data tuple */
- ulint n_fields,/*!< in: number of data fields */
- mem_heap_t* heap) /*!< in: memory heap where tuple created */
+dict_index_build_data_tuple_func(
+ const rec_t* rec,
+ const dict_index_t* index,
+#ifdef UNIV_DEBUG
+ bool leaf,
+#endif /* UNIV_DEBUG */
+ ulint n_fields,
+ mem_heap_t* heap)
{
dtuple_t* tuple;
@@ -5722,7 +5728,7 @@ dict_index_build_data_tuple(
dict_index_copy_types(tuple, index, n_fields);
- rec_copy_prefix_to_dtuple(tuple, rec, index, true, n_fields, heap);
+ rec_copy_prefix_to_dtuple(tuple, rec, index, leaf, n_fields, heap);
ut_ad(dtuple_check_typed(tuple));
diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc
index 5e5986594e9..87ebd9ad34a 100644
--- a/storage/innobase/gis/gis0sea.cc
+++ b/storage/innobase/gis/gis0sea.cc
@@ -1352,7 +1352,7 @@ rtr_cur_restore_position(
heap = mem_heap_create(256);
- tuple = dict_index_build_data_tuple(index, r_cursor->old_rec,
+ tuple = dict_index_build_data_tuple(r_cursor->old_rec, index, !level,
r_cursor->old_n_fields, heap);
page_cursor = btr_pcur_get_page_cur(r_cursor);
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 04baf032ded..6617cf8d73b 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -1460,17 +1460,31 @@ dict_index_copy_rec_order_prefix(
copied prefix, or NULL */
ulint* buf_size)/*!< in/out: buffer size */
MY_ATTRIBUTE((nonnull, warn_unused_result));
-/**********************************************************************//**
-Builds a typed data tuple out of a physical record.
+/** Convert a physical record into a search tuple.
+@param[in] rec index record (not necessarily in an index page)
+@param[in] index index
+@param[in] leaf whether rec is in a leaf page
+@param[in] n_fields number of data fields
+@param[in,out] heap memory heap for allocation
@return own: data tuple */
dtuple_t*
-dict_index_build_data_tuple(
-/*========================*/
- dict_index_t* index, /*!< in: index */
- rec_t* rec, /*!< in: record for which to build data tuple */
- ulint n_fields,/*!< in: number of data fields */
- mem_heap_t* heap) /*!< in: memory heap where tuple created */
+dict_index_build_data_tuple_func(
+ const rec_t* rec,
+ const dict_index_t* index,
+#ifdef UNIV_DEBUG
+ bool leaf,
+#endif /* UNIV_DEBUG */
+ ulint n_fields,
+ mem_heap_t* heap)
MY_ATTRIBUTE((nonnull, warn_unused_result));
+#ifdef UNIV_DEBUG
+# define dict_index_build_data_tuple(rec, index, leaf, n_fields, heap) \
+ dict_index_build_data_tuple_func(rec, index, leaf, n_fields, heap)
+#else /* UNIV_DEBUG */
+# define dict_index_build_data_tuple(rec, index, leaf, n_fields, heap) \
+ dict_index_build_data_tuple_func(rec, index, n_fields, heap)
+#endif /* UNIV_DEBUG */
+
/*********************************************************************//**
Gets the space id of the root of the index tree.
@return space id */
diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h
index 7076352d1c2..6e927da9bd9 100644
--- a/storage/innobase/include/rem0rec.h
+++ b/storage/innobase/include/rem0rec.h
@@ -944,14 +944,23 @@ The fields are copied into the memory heap.
@param[in] n_fields number of fields to copy
@param[in,out] heap memory heap */
void
-rec_copy_prefix_to_dtuple(
+rec_copy_prefix_to_dtuple_func(
dtuple_t* tuple,
const rec_t* rec,
const dict_index_t* index,
+#ifdef UNIV_DEBUG
bool is_leaf,
+#endif /* UNIV_DEBUG */
ulint n_fields,
mem_heap_t* heap)
MY_ATTRIBUTE((nonnull));
+#ifdef UNIV_DEBUG
+# define rec_copy_prefix_to_dtuple(tuple,rec,index,leaf,n_fields,heap) \
+ rec_copy_prefix_to_dtuple_func(tuple,rec,index,leaf,n_fields,heap)
+#else /* UNIV_DEBUG */
+# define rec_copy_prefix_to_dtuple(tuple,rec,index,leaf,n_fields,heap) \
+ rec_copy_prefix_to_dtuple_func(tuple,rec,index,n_fields,heap)
+#endif /* UNIV_DEBUG */
/***************************************************************//**
Validates the consistency of a physical record.
@return TRUE if ok */
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc
index 0e029b34821..d4d1a2bab14 100644
--- a/storage/innobase/rem/rem0rec.cc
+++ b/storage/innobase/rem/rem0rec.cc
@@ -1556,11 +1556,13 @@ The fields are copied into the memory heap.
@param[in] n_fields number of fields to copy
@param[in,out] heap memory heap */
void
-rec_copy_prefix_to_dtuple(
+rec_copy_prefix_to_dtuple_func(
dtuple_t* tuple,
const rec_t* rec,
const dict_index_t* index,
+#ifdef UNIV_DEBUG
bool is_leaf,
+#endif /* UNIV_DEBUG */
ulint n_fields,
mem_heap_t* heap)
{
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 247b853a7df..eaf9a8b77aa 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -3393,23 +3393,12 @@ row_sel_get_clust_rec_for_mysql(
goto func_exit;
}
- ulint page_no = page_get_page_no(
- btr_pcur_get_page(
- prebuilt->pcur));
-
- page_id_t page_id(dict_index_get_space(sec_index),
- page_no);
-
- buf_block_t* block = buf_page_get_gen(
- page_id,
- dict_table_page_size(sec_index->table),
- RW_NO_LATCH, NULL, BUF_GET,
- __FILE__, __LINE__, mtr, &err);
-
+ buf_block_t* block = btr_pcur_get_block(
+ prebuilt->pcur);
mem_heap_t* heap = mem_heap_create(256);
dtuple_t* tuple = dict_index_build_data_tuple(
- sec_index, const_cast<rec_t*>(rec),
- dict_index_get_n_fields(sec_index), heap);;
+ rec, sec_index, true,
+ sec_index->n_fields, heap);
page_cur_t page_cursor;
ulint low_match = page_cur_search(