diff options
author | Eugene Kosov <claprix@yandex.ru> | 2019-11-04 22:30:12 +0300 |
---|---|---|
committer | Eugene Kosov <claprix@yandex.ru> | 2019-12-13 00:26:50 +0700 |
commit | f0aa073f2bf3d8d85b3d028df89cdb4cdfc4002d (patch) | |
tree | 63a3e0b64a64741d2b2b0ba47b02e9d92dc1f516 /storage/innobase/page/page0cur.cc | |
parent | beec9c0e19284a0e50d3629f4cb2486007b0333b (diff) | |
download | mariadb-git-f0aa073f2bf3d8d85b3d028df89cdb4cdfc4002d.tar.gz |
MDEV-20950 Reduce size of record offsetsbb-10.2-MDEV-20950-stack-offsets
offset_t: this is a type which represents one record offset.
It's unsigned short int.
a lot of functions: replace ulint with offset_t
btr_pcur_restore_position_func(),
page_validate(),
row_ins_scan_sec_index_for_duplicate(),
row_upd_clust_rec_by_insert_inherit_func(),
row_vers_impl_x_locked_low(),
trx_undo_prev_version_build():
allocate record offsets on the stack instead of waiting for rec_get_offsets()
to allocate it from mem_heap_t. So, reducing memory allocations.
RECORD_OFFSET, INDEX_OFFSET:
now it's less convenient to store pointers in offset_t*
array. One pointer occupies now several offset_t. And those constant are start
indexes into array to places where to store pointer values
REC_OFFS_HEADER_SIZE: adjusted for the new reality
REC_OFFS_NORMAL_SIZE:
increase size from 100 to 300 which means less heap allocations.
And sizeof(offset_t[REC_OFFS_NORMAL_SIZE]) now is 600 bytes which
is smaller than previous 800 bytes.
REC_OFFS_SEC_INDEX_SIZE: adjusted for the new reality
rem0rec.h, rem0rec.ic, rem0rec.cc:
various arguments, return values and local variables types were changed to
fix numerous integer conversions issues.
enum field_type_t:
offset types concept was introduces which replaces old offset flags stuff.
Like in earlier version, 2 upper bits are used to store offset type.
And this enum represents those types.
REC_OFFS_SQL_NULL, REC_OFFS_MASK: removed
get_type(), set_type(), get_value(), combine():
these are convenience functions to work with offsets and it's types
rec_offs_base()[0]:
still uses an old scheme with flags REC_OFFS_COMPACT and REC_OFFS_EXTERNAL
rec_offs_base()[i]:
these have type offset_t now. Two upper bits contains type.
Diffstat (limited to 'storage/innobase/page/page0cur.cc')
-rw-r--r-- | storage/innobase/page/page0cur.cc | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index 21a725f845d..74a10cd67d5 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -67,8 +67,8 @@ page_cur_try_search_shortcut( ibool success = FALSE; const page_t* page = buf_block_get_frame(block); mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; + offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + offset_t* offsets = offsets_; rec_offs_init(offsets_); ut_ad(dtuple_check_typed(tuple)); @@ -151,8 +151,8 @@ page_cur_try_search_shortcut_bytes( ibool success = FALSE; const page_t* page = buf_block_get_frame(block); mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; + offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + offset_t* offsets = offsets_; rec_offs_init(offsets_); ut_ad(dtuple_check_typed(tuple)); @@ -223,7 +223,7 @@ page_cur_rec_field_extends( /*=======================*/ const dtuple_t* tuple, /*!< in: data tuple */ const rec_t* rec, /*!< in: record */ - const ulint* offsets,/*!< in: array returned by rec_get_offsets() */ + const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */ ulint n) /*!< in: compare nth field */ { const dtype_t* type; @@ -299,8 +299,8 @@ page_cur_search_with_match( const page_zip_des_t* page_zip = buf_block_get_page_zip(block); #endif /* UNIV_ZIP_DEBUG */ mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; + offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + offset_t* offsets = offsets_; rec_offs_init(offsets_); ut_ad(dtuple_validate(tuple)); @@ -562,8 +562,8 @@ page_cur_search_with_match_bytes( const page_zip_des_t* page_zip = buf_block_get_page_zip(block); #endif /* UNIV_ZIP_DEBUG */ mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; + offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + offset_t* offsets = offsets_; rec_offs_init(offsets_); ut_ad(dtuple_validate(tuple)); @@ -832,11 +832,11 @@ page_cur_insert_rec_write_log( { mem_heap_t* heap = NULL; - ulint cur_offs_[REC_OFFS_NORMAL_SIZE]; - ulint ins_offs_[REC_OFFS_NORMAL_SIZE]; + offset_t cur_offs_[REC_OFFS_NORMAL_SIZE]; + offset_t ins_offs_[REC_OFFS_NORMAL_SIZE]; - ulint* cur_offs; - ulint* ins_offs; + offset_t* cur_offs; + offset_t* ins_offs; rec_offs_init(cur_offs_); rec_offs_init(ins_offs_); @@ -1012,8 +1012,8 @@ page_cur_parse_insert_rec( ulint info_and_status_bits = 0; /* remove warning */ page_cur_t cursor; mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; + offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + offset_t* offsets = offsets_; rec_offs_init(offsets_); page = block ? buf_block_get_frame(block) : NULL; @@ -1188,7 +1188,7 @@ page_cur_insert_rec_low( which the new record is inserted */ dict_index_t* index, /*!< in: record descriptor */ const rec_t* rec, /*!< in: pointer to a physical record */ - ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */ + offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */ mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */ { byte* insert_buf; @@ -1239,8 +1239,8 @@ page_cur_insert_rec_low( free_rec = page_header_get_ptr(page, PAGE_FREE); if (UNIV_LIKELY_NULL(free_rec)) { /* Try to allocate from the head of the free list. */ - ulint foffsets_[REC_OFFS_NORMAL_SIZE]; - ulint* foffsets = foffsets_; + offset_t foffsets_[REC_OFFS_NORMAL_SIZE]; + offset_t* foffsets = foffsets_; mem_heap_t* heap = NULL; rec_offs_init(foffsets_); @@ -1433,7 +1433,7 @@ page_cur_insert_rec_zip( page_cur_t* cursor, /*!< in/out: page cursor */ dict_index_t* index, /*!< in: record descriptor */ const rec_t* rec, /*!< in: pointer to a physical record */ - ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */ + offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */ mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */ { byte* insert_buf; @@ -1670,8 +1670,8 @@ page_cur_insert_rec_zip( if (UNIV_LIKELY_NULL(free_rec)) { /* Try to allocate from the head of the free list. */ lint extra_size_diff; - ulint foffsets_[REC_OFFS_NORMAL_SIZE]; - ulint* foffsets = foffsets_; + offset_t foffsets_[REC_OFFS_NORMAL_SIZE]; + offset_t* foffsets = foffsets_; mem_heap_t* heap = NULL; rec_offs_init(foffsets_); @@ -2002,8 +2002,8 @@ page_copy_rec_list_end_to_created_page( byte* log_ptr; ulint log_data_len; mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; + offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + offset_t* offsets = offsets_; rec_offs_init(offsets_); ut_ad(page_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW); @@ -2224,7 +2224,7 @@ page_cur_parse_delete_rec( if (block) { page_t* page = buf_block_get_frame(block); mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; + offset_t offsets_[REC_OFFS_NORMAL_SIZE]; rec_t* rec = page + offset; rec_offs_init(offsets_); @@ -2252,7 +2252,7 @@ page_cur_delete_rec( /*================*/ page_cur_t* cursor, /*!< in/out: a page cursor */ const dict_index_t* index, /*!< in: record descriptor */ - const ulint* offsets,/*!< in: rec_get_offsets( + const offset_t* offsets,/*!< in: rec_get_offsets( cursor->rec, index) */ mtr_t* mtr) /*!< in: mini-transaction handle or NULL */ |