summaryrefslogtreecommitdiff
path: root/storage/innobase/row/row0ins.c
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/row/row0ins.c')
-rw-r--r--storage/innobase/row/row0ins.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c
index 9d5212db6e8..d9be81e461d 100644
--- a/storage/innobase/row/row0ins.c
+++ b/storage/innobase/row/row0ins.c
@@ -143,6 +143,7 @@ row_ins_alloc_sys_fields(
const dict_col_t* col;
dfield_t* dfield;
byte* ptr;
+ uint len;
row = node->row;
table = node->table;
@@ -151,35 +152,37 @@ row_ins_alloc_sys_fields(
ut_ad(row && table && heap);
ut_ad(dtuple_get_n_fields(row) == dict_table_get_n_cols(table));
- /* 1. Allocate buffer for row id */
+ /* allocate buffer to hold the needed system created hidden columns. */
+ len = DATA_ROW_ID_LEN + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN;
+ ptr = mem_heap_zalloc(heap, len);
+ /* 1. Populate row-id */
col = dict_table_get_sys_col(table, DATA_ROW_ID);
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
- ptr = mem_heap_zalloc(heap, DATA_ROW_ID_LEN);
-
dfield_set_data(dfield, ptr, DATA_ROW_ID_LEN);
node->row_id_buf = ptr;
- /* 3. Allocate buffer for trx id */
+ ptr += DATA_ROW_ID_LEN;
+ /* 2. Populate trx id */
col = dict_table_get_sys_col(table, DATA_TRX_ID);
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
- ptr = mem_heap_zalloc(heap, DATA_TRX_ID_LEN);
dfield_set_data(dfield, ptr, DATA_TRX_ID_LEN);
node->trx_id_buf = ptr;
- /* 4. Allocate buffer for roll ptr */
+ ptr += DATA_TRX_ID_LEN;
+
+ /* 3. Populate roll ptr */
col = dict_table_get_sys_col(table, DATA_ROLL_PTR);
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
- ptr = mem_heap_zalloc(heap, DATA_ROLL_PTR_LEN);
dfield_set_data(dfield, ptr, DATA_ROLL_PTR_LEN);
}