Skip to content

Commit

Permalink
IB: remove alloc on update
Browse files Browse the repository at this point in the history
  • Loading branch information
midenok committed Dec 3, 2017
1 parent 70b82f6 commit 36c0bec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
9 changes: 3 additions & 6 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9171,14 +9171,11 @@ ha_innobase::update_row(
m_prebuilt->upd_node->is_delete = NO_DELETE;

{
const bool vers_set_fields
= m_prebuilt->versioned_write
const bool vers_set_fields = m_prebuilt->versioned_write
&& m_prebuilt->upd_node->update->affects_versioned();
const bool vers_ins_row
= vers_set_fields
const bool vers_ins_row = vers_set_fields
&& (table->s->vtmd
|| thd_sql_command(m_user_thd)
!= SQLCOM_ALTER_TABLE);
|| thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE);

if (vers_set_fields && !vers_ins_row)
m_prebuilt->upd_node->is_delete = VERSIONED_DELETE;
Expand Down
1 change: 1 addition & 0 deletions storage/innobase/include/row0upd.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ struct upd_t{
virtual column update now */
ulint n_fields; /*!< number of update fields */
upd_field_t* fields; /*!< array of update fields */
byte vers_sys_value[8]; /*!< buffer for updating system fields */

/** Append an update field to the end of array
@param[in] field an update field */
Expand Down
7 changes: 2 additions & 5 deletions storage/innobase/row/row0mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,6 @@ row_update_for_mysql(row_prebuilt_t* prebuilt)
ut_ad(!prebuilt->versioned_write || node->table->versioned());

bool vers_set_fields = prebuilt->versioned_write
&& node->table->versioned()
&& (node->is_delete ? node->is_delete == VERSIONED_DELETE
: node->update->affects_versioned());
run_again:
Expand Down Expand Up @@ -2038,11 +2037,9 @@ row_update_for_mysql(row_prebuilt_t* prebuilt)
ufield->orig_len = 0;
ufield->exp = NULL;

static const ulint fsize = sizeof(trx_id_t);
byte* buf = static_cast<byte*>(mem_heap_alloc(node->update->heap, fsize));
mach_write_to_8(buf, trx->id);
mach_write_to_8(node->update->vers_sys_value, trx->id);
dfield_t* dfield = &ufield->new_val;
dfield_set_data(dfield, buf, fsize);
dfield_set_data(dfield, node->update->vers_sys_value, 8);
dict_col_copy_type(col, &dfield->type);

uvect->n_fields++;
Expand Down

0 comments on commit 36c0bec

Please sign in to comment.