diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-09-21 13:31:34 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-09-21 13:31:34 +0300 |
commit | 7b2100f549302efdcea757059a5f97dd66b813e3 (patch) | |
tree | 00175143446dbc066f9ef376c2f30811046a04c7 | |
parent | b562d305ca92d16a1c9f6caf89ef2721ce6574d2 (diff) | |
download | mariadb-git-7b2100f549302efdcea757059a5f97dd66b813e3.tar.gz |
Remove unnecessary allocation
-rw-r--r-- | storage/innobase/include/page0size.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/row0ins.h | 12 | ||||
-rw-r--r-- | storage/innobase/page/page0zip.cc | 7 | ||||
-rw-r--r-- | storage/innobase/row/row0ins.cc | 34 |
4 files changed, 14 insertions, 41 deletions
diff --git a/storage/innobase/include/page0size.h b/storage/innobase/include/page0size.h index 7b8b7efe617..7c5d3189a97 100644 --- a/storage/innobase/include/page0size.h +++ b/storage/innobase/include/page0size.h @@ -35,7 +35,7 @@ Created Nov 14, 2013 Vasil Dimov /** A BLOB field reference full of zero, for use in assertions and tests.Initially, BLOB field references are set to zero, in dtuple_convert_big_rec(). */ -extern const byte field_ref_zero[FIELD_REF_SIZE]; +extern const byte field_ref_zero[UNIV_PAGE_SIZE_MAX]; #define PAGE_SIZE_T_SIZE_BITS 17 diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h index bce3807224b..6670cc76a74 100644 --- a/storage/innobase/include/row0ins.h +++ b/storage/innobase/include/row0ins.h @@ -127,18 +127,6 @@ row_ins_sec_index_entry_low( /*!< in: if true, just do duplicate check and return. don't execute actual insert. */ MY_ATTRIBUTE((warn_unused_result)); -/** Sets the values of the dtuple fields in entry from the values of appropriate -columns in row. -@param[in] index index handler -@param[out] entry index entry to make -@param[in] row row */ -dberr_t -row_ins_index_entry_set_vals( - const dict_index_t* index, - dtuple_t* entry, - const dtuple_t* row, - mem_heap_t* heap); - /***************************************************************//** Inserts an entry into a clustered index. Tries first optimistic, then pessimistic descent down the tree. If the entry matches enough diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 4b124df3c8b..a5c98318832 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -31,12 +31,7 @@ Created June 2005 by Marko Makela /** A BLOB field reference full of zero, for use in assertions and tests. Initially, BLOB field references are set to zero, in dtuple_convert_big_rec(). */ -const byte field_ref_zero[FIELD_REF_SIZE] = { - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, -}; +const byte field_ref_zero[UNIV_PAGE_SIZE_MAX] = { 0, }; #ifndef UNIV_INNOCHECKSUM #include "page0page.h" diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 6cfb13ea7a8..f2c97c116d0 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -3423,14 +3423,13 @@ columns in row. @param[in] index index handler @param[out] entry index entry to make @param[in] row row - @return DB_SUCCESS if the set is successful */ +static dberr_t row_ins_index_entry_set_vals( const dict_index_t* index, dtuple_t* entry, - const dtuple_t* row, - mem_heap_t* heap) + const dtuple_t* row) { ulint n_fields; ulint i; @@ -3462,31 +3461,22 @@ row_ins_index_entry_set_vals( ut_ad(dtuple_get_n_fields(row) == dict_table_get_n_cols(index->table)); row_field = dtuple_get_nth_v_field(row, v_col->v_pos); - } else if (col->is_dropped()) { - - ut_ad(dict_index_is_clust(index)); - - field->type.prtype = DATA_NOT_NULL; + ut_ad(index->is_primary()); if (!(col->prtype & DATA_NOT_NULL)) { - field->data = 0x00; + field->data = NULL; field->len = UNIV_SQL_NULL; field->type.prtype = DATA_BINARY_TYPE; - } else if (col->len > 0) { - field->data = mem_heap_zalloc(heap, col->len); - field->len = col->len; - } else { - field->data = 0x00; - field->len = 0; - } - - if (col->len > 0) { - field->type.mtype = DATA_FIXBINARY; } else { - field->type.mtype = DATA_BINARY; + ut_ad(col->len <= sizeof field_ref_zero); + dfield_set_data(field, field_ref_zero, + col->len); + field->type.prtype = DATA_NOT_NULL; } + field->type.mtype = col->len + ? DATA_FIXBINARY : DATA_BINARY; continue; } else { row_field = dtuple_get_nth_field( @@ -3551,8 +3541,8 @@ row_ins_index_entry_step( ut_ad(dtuple_check_typed(node->row)); - err = row_ins_index_entry_set_vals(node->index, node->entry, node->row, - node->entry_sys_heap); + err = row_ins_index_entry_set_vals(node->index, node->entry, + node->row); if (err != DB_SUCCESS) { DBUG_RETURN(err); |