1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-30 05:23:50 +03:00

IB: removed alloc from row_ins_set_tuple_col_8()

This commit is contained in:
Aleksey Midenkov
2017-11-20 15:22:07 +03:00
parent 4ecb38d7c9
commit 00b98264a8
2 changed files with 7 additions and 24 deletions

View File

@@ -202,6 +202,8 @@ struct ins_node_t{
trx_id_t trx_id; /*!< trx id or the last trx which executed the trx_id_t trx_id; /*!< trx id or the last trx which executed the
node */ node */
byte* trx_id_buf;/* buffer for the trx id sys field in row */ byte* trx_id_buf;/* buffer for the trx id sys field in row */
byte vers_start_buf[8]; /* Buffers for System Versioning */
byte vers_end_buf[8]; /* system fields. */
mem_heap_t* entry_sys_heap; mem_heap_t* entry_sys_heap;
/* memory heap used as auxiliary storage; /* memory heap used as auxiliary storage;
entry_list and sys fields are stored here; entry_list and sys fields are stored here;
@@ -233,13 +235,12 @@ void row_ins_set_tuple_col_8(
dtuple_t* tuple, dtuple_t* tuple,
int col, int col,
ib_uint64_t data, ib_uint64_t data,
mem_heap_t* heap) byte* buf)
{ {
static const ulint fsize = sizeof(data); static const ulint fsize = sizeof(data);
dfield_t* dfield = dtuple_get_nth_field(tuple, col); dfield_t* dfield = dtuple_get_nth_field(tuple, col);
ut_ad(dfield->type.len == fsize); ut_ad(dfield->type.len == fsize);
if (dfield->len == UNIV_SQL_NULL) { if (dfield->len == UNIV_SQL_NULL) {
byte* buf = reinterpret_cast<byte*>(mem_heap_alloc(heap, fsize));
dfield_set_data(dfield, buf, fsize); dfield_set_data(dfield, buf, fsize);
} }
ut_ad(dfield->len == dfield->type.len && dfield->data); ut_ad(dfield->len == dfield->type.len && dfield->data);
@@ -251,12 +252,11 @@ void row_ins_set_tuple_col_8(
dtuple_t* tuple, dtuple_t* tuple,
int col, int col,
timeval& data, timeval& data,
mem_heap_t* heap) byte* buf)
{ {
dfield_t* dfield = dtuple_get_nth_field(tuple, col); dfield_t* dfield = dtuple_get_nth_field(tuple, col);
ut_ad(dfield->type.len == 8); ut_ad(dfield->type.len == 8);
if (dfield->len == UNIV_SQL_NULL) { if (dfield->len == UNIV_SQL_NULL) {
byte* buf = reinterpret_cast<byte*>(mem_heap_alloc(heap, 8));
dfield_set_data(dfield, buf, 8); dfield_set_data(dfield, buf, 8);
} }
ut_ad(dfield->len == dfield->type.len && dfield->data); ut_ad(dfield->len == dfield->type.len && dfield->data);
@@ -264,21 +264,4 @@ void row_ins_set_tuple_col_8(
mach_write_to_4(reinterpret_cast<byte*>(dfield->data) + 4, (ulint) data.tv_usec); mach_write_to_4(reinterpret_cast<byte*>(dfield->data) + 4, (ulint) data.tv_usec);
} }
UNIV_INLINE
void row_ins_set_tuple_col_1(
dtuple_t* tuple,
int col,
byte data,
mem_heap_t* heap)
{
dfield_t* dfield = dtuple_get_nth_field(tuple, col);
ut_ad(dfield->type.len == 1);
if (dfield->len == UNIV_SQL_NULL) {
byte* buf = reinterpret_cast<byte*>(mem_heap_alloc(heap, 1));
dfield_set_data(dfield, buf, 1);
}
ut_ad(dfield->len == dfield->type.len && dfield->data);
*(byte*)(dfield->data) = data;
}
#endif #endif

View File

@@ -1504,14 +1504,14 @@ row_insert_for_mysql(
ut_ad(t->mysql_col_len == 8); ut_ad(t->mysql_col_len == 8);
if (ins_mode == ROW_INS_HISTORICAL) { if (ins_mode == ROW_INS_HISTORICAL) {
row_ins_set_tuple_col_8(node->row, table->vers_end, trx->id, node->entry_sys_heap); row_ins_set_tuple_col_8(node->row, table->vers_end, trx->id, node->vers_end_buf);
} }
else /* ROW_INS_VERSIONED */ { else /* ROW_INS_VERSIONED */ {
row_ins_set_tuple_col_8(node->row, table->vers_end, IB_UINT64_MAX, node->entry_sys_heap); row_ins_set_tuple_col_8(node->row, table->vers_end, IB_UINT64_MAX, node->vers_end_buf);
int8store(&mysql_rec[t->mysql_col_offset], IB_UINT64_MAX); int8store(&mysql_rec[t->mysql_col_offset], IB_UINT64_MAX);
t = &prebuilt->mysql_template[table->vers_start]; t = &prebuilt->mysql_template[table->vers_start];
ut_ad(t->mysql_col_len == 8); ut_ad(t->mysql_col_len == 8);
row_ins_set_tuple_col_8(node->row, table->vers_start, trx->id, node->entry_sys_heap); row_ins_set_tuple_col_8(node->row, table->vers_start, trx->id, node->vers_start_buf);
int8store(&mysql_rec[t->mysql_col_offset], trx->id); int8store(&mysql_rec[t->mysql_col_offset], trx->id);
} }
} }