summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-08-31 17:20:03 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-08-31 17:20:03 +0300
commit80e6d07aeeb225ffb416ff4753518865eaa54651 (patch)
treeafb5e3f1b3c751e7b3dd9107c5339c4589f6a71b /storage/innobase
parent507f76b4d3fa82b0fc5b3033fa79a083eae284db (diff)
downloadmariadb-git-80e6d07aeeb225ffb416ff4753518865eaa54651.tar.gz
Cleanup: Avoid repeated calls to dict_col_t::is_virtual()
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/handler/ha_innodb.cc9
-rw-r--r--storage/innobase/row/row0merge.cc30
2 files changed, 16 insertions, 23 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 3ab1e9c7cc2..44fdb7d8a86 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -5774,14 +5774,13 @@ innobase_vcol_build_templ(
mysql_row_templ_t* templ,
ulint col_no)
{
- if (dict_col_is_virtual(col)) {
- templ->is_virtual = true;
- templ->col_no = col_no;
+ templ->col_no = col_no;
+ templ->is_virtual = col->is_virtual();
+
+ if (templ->is_virtual) {
templ->clust_rec_field_no = ULINT_UNDEFINED;
templ->rec_field_no = col->ind;
} else {
- templ->is_virtual = false;
- templ->col_no = col_no;
templ->clust_rec_field_no = dict_col_get_clust_pos(
col, clust_index);
ut_a(templ->clust_rec_field_no != ULINT_UNDEFINED);
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 3a6d8cea4a8..a2df1b90f5d 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -555,23 +555,16 @@ row_merge_buf_add(
for (i = 0; i < n_fields; i++, field++, ifield++) {
ulint len;
- const dict_col_t* col;
- ulint col_no;
ulint fixed_len;
const dfield_t* row_field;
-
- col = ifield->col;
- const dict_v_col_t* v_col = NULL;
- if (dict_col_is_virtual(col)) {
- v_col = reinterpret_cast<const dict_v_col_t*>(col);
- }
-
- col_no = dict_col_get_no(col);
+ const dict_col_t* const col = ifield->col;
+ const dict_v_col_t* const v_col = col->is_virtual()
+ ? reinterpret_cast<const dict_v_col_t*>(col)
+ : NULL;
/* Process the Doc ID column */
- if (*doc_id > 0
- && col_no == index->table->fts->doc_col
- && !dict_col_is_virtual(col)) {
+ if (!v_col && *doc_id
+ && col->ind == index->table->fts->doc_col) {
fts_write_doc_id((byte*) &write_doc_id, *doc_id);
/* Note: field->data now points to a value on the
@@ -590,7 +583,7 @@ row_merge_buf_add(
field->type.len = ifield->col->len;
} else {
/* Use callback to get the virtual column value */
- if (dict_col_is_virtual(col)) {
+ if (v_col) {
dict_index_t* clust_index
= dict_table_get_first_index(new_table);
@@ -612,7 +605,8 @@ row_merge_buf_add(
}
dfield_copy(field, row_field);
} else {
- row_field = dtuple_get_nth_field(row, col_no);
+ row_field = dtuple_get_nth_field(row,
+ col->ind);
dfield_copy(field, row_field);
}
@@ -718,7 +712,7 @@ row_merge_buf_add(
} else if (!ext) {
} else if (dict_index_is_clust(index)) {
/* Flag externally stored fields. */
- const byte* buf = row_ext_lookup(ext, col_no,
+ const byte* buf = row_ext_lookup(ext, col->ind,
&len);
if (UNIV_LIKELY_NULL(buf)) {
ut_a(buf != field_ref_zero);
@@ -729,9 +723,9 @@ row_merge_buf_add(
len = dfield_get_len(field);
}
}
- } else if (!dict_col_is_virtual(col)) {
+ } else if (!v_col) {
/* Only non-virtual column are stored externally */
- const byte* buf = row_ext_lookup(ext, col_no,
+ const byte* buf = row_ext_lookup(ext, col->ind,
&len);
if (UNIV_LIKELY_NULL(buf)) {
ut_a(buf != field_ref_zero);