Commit 3a393f8c authored by Marko Mäkelä's avatar Marko Mäkelä

Merge dict_index_copy_rec_order_prefix() to its only caller

btr_pcur_store_position(): Merge the code from
dict_index_copy_rec_order_prefix().
parent 3fe03693
...@@ -174,10 +174,25 @@ btr_pcur_store_position( ...@@ -174,10 +174,25 @@ btr_pcur_store_position(
cursor->rel_pos = BTR_PCUR_ON; cursor->rel_pos = BTR_PCUR_ON;
} }
cursor->old_rec = dict_index_copy_rec_order_prefix( if (index->is_ibuf()) {
index, rec, &cursor->old_n_fields, ut_ad(!index->table->not_redundant());
&cursor->old_rec_buf, &cursor->buf_size); cursor->old_n_fields = rec_get_n_fields_old(rec);
} else if (page_rec_is_leaf(rec)) {
cursor->old_n_fields = dict_index_get_n_unique_in_tree(index);
} else if (index->is_spatial()) {
ut_ad(dict_index_get_n_unique_in_tree_nonleaf(index)
== DICT_INDEX_SPATIAL_NODEPTR_SIZE);
/* For R-tree, we have to compare
the child page numbers as well. */
cursor->old_n_fields = DICT_INDEX_SPATIAL_NODEPTR_SIZE + 1;
} else {
cursor->old_n_fields = dict_index_get_n_unique_in_tree(index);
}
cursor->old_rec = rec_copy_prefix_to_buf(rec, index,
cursor->old_n_fields,
&cursor->old_rec_buf,
&cursor->buf_size);
cursor->block_when_stored = block; cursor->block_when_stored = block;
/* Function try to check if block is S/X latch. */ /* Function try to check if block is S/X latch. */
......
...@@ -5462,46 +5462,6 @@ dict_index_build_node_ptr( ...@@ -5462,46 +5462,6 @@ dict_index_build_node_ptr(
return(tuple); return(tuple);
} }
/**********************************************************************//**
Copies an initial segment of a physical record, long enough to specify an
index entry uniquely.
@return pointer to the prefix record */
rec_t*
dict_index_copy_rec_order_prefix(
/*=============================*/
const dict_index_t* index, /*!< in: index */
const rec_t* rec, /*!< in: record for which to
copy prefix */
ulint* n_fields,/*!< out: number of fields copied */
byte** buf, /*!< in/out: memory buffer for the
copied prefix, or NULL */
ulint* buf_size)/*!< in/out: buffer size */
{
ulint n;
UNIV_PREFETCH_R(rec);
if (dict_index_is_ibuf(index)) {
ut_ad(!dict_table_is_comp(index->table));
n = rec_get_n_fields_old(rec);
} else {
if (page_rec_is_leaf(rec)) {
n = dict_index_get_n_unique_in_tree(index);
} else if (dict_index_is_spatial(index)) {
ut_ad(dict_index_get_n_unique_in_tree_nonleaf(index)
== DICT_INDEX_SPATIAL_NODEPTR_SIZE);
/* For R-tree, we have to compare
the child page numbers as well. */
n = DICT_INDEX_SPATIAL_NODEPTR_SIZE + 1;
} else {
n = dict_index_get_n_unique_in_tree(index);
}
}
*n_fields = n;
return(rec_copy_prefix_to_buf(rec, index, n, buf, buf_size));
}
/** Convert a physical record into a search tuple. /** Convert a physical record into a search tuple.
@param[in] rec index record (not necessarily in an index page) @param[in] rec index record (not necessarily in an index page)
@param[in] index index @param[in] index index
......
...@@ -1303,21 +1303,6 @@ dict_index_build_node_ptr( ...@@ -1303,21 +1303,6 @@ dict_index_build_node_ptr(
ulint level) /*!< in: level of rec in tree: ulint level) /*!< in: level of rec in tree:
0 means leaf level */ 0 means leaf level */
MY_ATTRIBUTE((nonnull, warn_unused_result)); MY_ATTRIBUTE((nonnull, warn_unused_result));
/**********************************************************************//**
Copies an initial segment of a physical record, long enough to specify an
index entry uniquely.
@return pointer to the prefix record */
rec_t*
dict_index_copy_rec_order_prefix(
/*=============================*/
const dict_index_t* index, /*!< in: index */
const rec_t* rec, /*!< in: record for which to
copy prefix */
ulint* n_fields,/*!< out: number of fields copied */
byte** buf, /*!< in/out: memory buffer for the
copied prefix, or NULL */
ulint* buf_size)/*!< in/out: buffer size */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/** Convert a physical record into a search tuple. /** Convert a physical record into a search tuple.
@param[in] rec index record (not necessarily in an index page) @param[in] rec index record (not necessarily in an index page)
@param[in] index index @param[in] index index
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment