Commit 051545ad authored by marko's avatar marko

branches/zip: row_build_row_ref_in_tuple(): Add the parameter "offsets",

to avoid a rec_get_offsets() call.  Add some const qualifiers.

row_sel_get_clust_rec_for_mysql(): Note that "offsets" will also be
an input parameter.
parent 1595953a
...@@ -165,16 +165,20 @@ search the clustered index record. */ ...@@ -165,16 +165,20 @@ search the clustered index record. */
void void
row_build_row_ref_in_tuple( row_build_row_ref_in_tuple(
/*=======================*/ /*=======================*/
dtuple_t* ref, /* in/out: row reference built; see the dtuple_t* ref, /* in/out: row reference built;
NOTE below! */ see the NOTE below! */
dict_index_t* index, /* in: index */ const rec_t* rec, /* in: record in the index;
const rec_t* rec, /* in: record in the index; NOTE: the data fields in ref
NOTE: the data fields in ref will point will point directly into this
directly into this record, therefore, record, therefore, the buffer
the buffer page of this record must be page of this record must be at
at least s-latched and the latch held least s-latched and the latch
as long as the row reference is used! */ held as long as the row
trx_t* trx); /* in: transaction */ reference is used! */
const dict_index_t* index, /* in: secondary index */
ulint* offsets,/* in: rec_get_offsets(rec, index)
or NULL */
trx_t* trx); /* in: transaction */
/*********************************************************************** /***********************************************************************
From a row build a row reference with which we can search the clustered From a row build a row reference with which we can search the clustered
index record. */ index record. */
......
...@@ -481,33 +481,37 @@ search the clustered index record. */ ...@@ -481,33 +481,37 @@ search the clustered index record. */
void void
row_build_row_ref_in_tuple( row_build_row_ref_in_tuple(
/*=======================*/ /*=======================*/
dtuple_t* ref, /* in/out: row reference built; see the dtuple_t* ref, /* in/out: row reference built;
NOTE below! */ see the NOTE below! */
dict_index_t* index, /* in: index */ const rec_t* rec, /* in: record in the index;
const rec_t* rec, /* in: record in the index; NOTE: the data fields in ref
NOTE: the data fields in ref will point will point directly into this
directly into this record, therefore, record, therefore, the buffer
the buffer page of this record must be page of this record must be at
at least s-latched and the latch held least s-latched and the latch
as long as the row reference is used! */ held as long as the row
trx_t* trx) /* in: transaction */ reference is used! */
const dict_index_t* index, /* in: secondary index */
ulint* offsets,/* in: rec_get_offsets(rec, index)
or NULL */
trx_t* trx) /* in: transaction */
{ {
dict_index_t* clust_index; const dict_index_t* clust_index;
dfield_t* dfield; dfield_t* dfield;
const byte* field; const byte* field;
ulint len; ulint len;
ulint ref_len; ulint ref_len;
ulint pos; ulint pos;
ulint clust_col_prefix_len; ulint clust_col_prefix_len;
ulint i; ulint i;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; *offsets_ = (sizeof offsets_) / sizeof *offsets_;
ut_a(ref); ut_a(ref);
ut_a(index); ut_a(index);
ut_a(rec); ut_a(rec);
ut_ad(!dict_index_is_clust(index));
if (UNIV_UNLIKELY(!index->table)) { if (UNIV_UNLIKELY(!index->table)) {
fputs("InnoDB: table ", stderr); fputs("InnoDB: table ", stderr);
...@@ -521,12 +525,17 @@ row_build_row_ref_in_tuple( ...@@ -521,12 +525,17 @@ row_build_row_ref_in_tuple(
clust_index = dict_table_get_first_index(index->table); clust_index = dict_table_get_first_index(index->table);
if (!clust_index) { if (UNIV_UNLIKELY(!clust_index)) {
fputs("InnoDB: clust index for table ", stderr); fputs("InnoDB: clust index for table ", stderr);
goto notfound; goto notfound;
} }
offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); if (!offsets) {
offsets = rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap);
} else {
ut_ad(rec_offs_validate(rec, index, offsets));
}
ref_len = dict_index_get_n_unique(clust_index); ref_len = dict_index_get_n_unique(clust_index);
......
...@@ -2836,7 +2836,9 @@ row_sel_get_clust_rec_for_mysql( ...@@ -2836,7 +2836,9 @@ row_sel_get_clust_rec_for_mysql(
it, NULL if the old version did not exist it, NULL if the old version did not exist
in the read view, i.e., it was a fresh in the read view, i.e., it was a fresh
inserted version */ inserted version */
ulint** offsets,/* out: offsets returned by ulint** offsets,/* in: offsets returned by
rec_get_offsets(rec, sec_index);
out: offsets returned by
rec_get_offsets(out_rec, clust_index) */ rec_get_offsets(out_rec, clust_index) */
mem_heap_t** offset_heap,/* in/out: memory heap from which mem_heap_t** offset_heap,/* in/out: memory heap from which
the offsets are allocated */ the offsets are allocated */
...@@ -2853,7 +2855,8 @@ row_sel_get_clust_rec_for_mysql( ...@@ -2853,7 +2855,8 @@ row_sel_get_clust_rec_for_mysql(
*out_rec = NULL; *out_rec = NULL;
trx = thr_get_trx(thr); trx = thr_get_trx(thr);
row_build_row_ref_in_tuple(prebuilt->clust_ref, sec_index, rec, trx); row_build_row_ref_in_tuple(prebuilt->clust_ref, rec,
sec_index, *offsets, trx);
clust_index = dict_table_get_first_index(sec_index->table); clust_index = dict_table_get_first_index(sec_index->table);
......
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