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,15 +165,19 @@ search the clustered index record. */ ...@@ -165,15 +165,19 @@ 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 will point NOTE: the data fields in ref
directly into this record, therefore, will point directly into this
the buffer page of this record must be record, therefore, the buffer
at least s-latched and the latch held page of this record must be at
as long as the row reference is used! */ least s-latched and the latch
held as long as the row
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 */ 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
......
...@@ -481,18 +481,22 @@ search the clustered index record. */ ...@@ -481,18 +481,22 @@ 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 will point NOTE: the data fields in ref
directly into this record, therefore, will point directly into this
the buffer page of this record must be record, therefore, the buffer
at least s-latched and the latch held page of this record must be at
as long as the row reference is used! */ least s-latched and the latch
held as long as the row
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 */ 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;
...@@ -502,12 +506,12 @@ row_build_row_ref_in_tuple( ...@@ -502,12 +506,12 @@ row_build_row_ref_in_tuple(
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 @@ notfound: ...@@ -521,12 +525,17 @@ notfound:
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