diff options
author | Thirunarayanan B <thirunarayanan.balathandayuth@oracle.com> | 2014-04-01 10:46:13 +0530 |
---|---|---|
committer | Thirunarayanan B <thirunarayanan.balathandayuth@oracle.com> | 2014-04-01 10:46:13 +0530 |
commit | cacd22428cc96e9cdf60fdd6d14578c9aca50ebe (patch) | |
tree | 9e250461302fbbe6ada4546970d3f393fe38200e /storage/innobase | |
parent | c09efb0b3780c44467d7a27f66e3fb0b22083694 (diff) | |
download | mariadb-git-cacd22428cc96e9cdf60fdd6d14578c9aca50ebe.tar.gz |
Bug #17858679 TOO MANY TIMES OF MEMSET DECREASE
THE PERFORMANCE UNDER HEAVY INSERT
Problem:
There are three memset call to allocate memory for system fields
in each insert.
Solution:
Instead of calling it in 3 times, we can combine it into
one memset call. It will reduce the CPU usage under heavy insert.
Approved by Marko rb-4916
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/row/row0ins.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c index 9d5212db6e8..12c4f6dff8c 100644 --- a/storage/innobase/row/row0ins.c +++ b/storage/innobase/row/row0ins.c @@ -151,35 +151,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. */ + uint 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); } |