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/lock | |
parent | beec9c0e19284a0e50d3629f4cb2486007b0333b (diff) | |
download | mariadb-git-bb-10.2-MDEV-20950-stack-offsets.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/lock')
-rw-r--r-- | storage/innobase/lock/lock0lock.cc | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 9fdc8feee90..006ecc28276 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -326,7 +326,7 @@ lock_report_trx_id_insanity( trx_id_t trx_id, /*!< in: trx id */ const rec_t* rec, /*!< in: user record */ dict_index_t* index, /*!< in: index */ - const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */ + const offset_t* offsets, /*!< in: rec_get_offsets(rec, index) */ trx_id_t max_trx_id) /*!< in: trx_sys_get_max_trx_id() */ { ib::error() @@ -352,7 +352,7 @@ lock_check_trx_id_sanity( trx_id_t trx_id, /*!< in: trx id */ const rec_t* rec, /*!< in: user record */ dict_index_t* index, /*!< in: index */ - const ulint* offsets) /*!< in: rec_get_offsets(rec, index) */ + const offset_t* offsets) /*!< in: rec_get_offsets(rec, index) */ { ut_ad(rec_offs_validate(rec, index, offsets)); @@ -377,7 +377,7 @@ lock_clust_rec_cons_read_sees( const rec_t* rec, /*!< in: user record which should be read or passed over by a read cursor */ dict_index_t* index, /*!< in: clustered index */ - const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ + const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ ReadView* view) /*!< in: consistent read view */ { ut_ad(dict_index_is_clust(index)); @@ -1214,7 +1214,7 @@ lock_sec_rec_some_has_impl( /*=======================*/ const rec_t* rec, /*!< in: user record */ dict_index_t* index, /*!< in: secondary index */ - const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */ + const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */ { trx_t* trx; trx_id_t max_trx_id; @@ -4793,8 +4793,8 @@ static void lock_rec_print(FILE* file, const lock_t* lock, mtr_t& mtr) putc('\n', file); 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_); mtr.start(); @@ -5187,7 +5187,7 @@ lock_rec_queue_validate( const buf_block_t* block, /*!< in: buffer block containing rec */ const rec_t* rec, /*!< in: record to look at */ const dict_index_t* index, /*!< in: index, or NULL if not known */ - const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */ + const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */ { const lock_t* lock; ulint heap_no; @@ -5352,8 +5352,8 @@ lock_rec_validate_page( ulint nth_bit = 0; ulint i; 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(!lock_mutex_own()); @@ -5738,8 +5738,8 @@ lock_rec_insert_check_and_lock( #ifdef UNIV_DEBUG { mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - const ulint* offsets; + offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + const offset_t* offsets; rec_offs_init(offsets_); offsets = rec_get_offsets(next_rec, index, offsets_, true, @@ -5804,7 +5804,7 @@ lock_rec_convert_impl_to_expl( const buf_block_t* block, /*!< in: buffer block of rec */ const rec_t* rec, /*!< in: user record on page */ dict_index_t* index, /*!< in: index of record */ - const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */ + const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */ { trx_t* trx; @@ -5859,7 +5859,7 @@ lock_clust_rec_modify_check_and_lock( const rec_t* rec, /*!< in: record which should be modified */ dict_index_t* index, /*!< in: clustered index */ - const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ + const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ que_thr_t* thr) /*!< in: query thread */ { dberr_t err; @@ -5959,8 +5959,8 @@ lock_sec_rec_modify_check_and_lock( #ifdef UNIV_DEBUG { mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - const ulint* offsets; + offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + const offset_t* offsets; rec_offs_init(offsets_); offsets = rec_get_offsets(rec, index, offsets_, true, @@ -6004,7 +6004,7 @@ lock_sec_rec_read_check_and_lock( be read or passed over by a read cursor */ dict_index_t* index, /*!< in: secondary index */ - const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ + const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ lock_mode mode, /*!< in: mode of the lock which the read cursor should set on records: LOCK_S or LOCK_X; the @@ -6082,7 +6082,7 @@ lock_clust_rec_read_check_and_lock( be read or passed over by a read cursor */ dict_index_t* index, /*!< in: clustered index */ - const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ + const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ lock_mode mode, /*!< in: mode of the lock which the read cursor should set on records: LOCK_S or LOCK_X; the @@ -6166,8 +6166,8 @@ lock_clust_rec_read_check_and_lock_alt( que_thr_t* thr) /*!< in: query thread */ { mem_heap_t* tmp_heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; + offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + offset_t* offsets = offsets_; dberr_t err; rec_offs_init(offsets_); |