diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-03-18 21:48:00 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-03-18 22:32:40 +0200 |
commit | a786f50de5ce17748d851cf4264399c277d61925 (patch) | |
tree | 8a107091cec37ee88a58ebbffb2bcd0fa4ceb241 /storage/innobase/btr/btr0cur.cc | |
parent | e0eacbee77fd56255d1073d7cb3e738b7de0285c (diff) | |
download | mariadb-git-a786f50de5ce17748d851cf4264399c277d61925.tar.gz |
MDEV-21962 Allocate buf_pool statically
Thanks to MDEV-15058, there is only one InnoDB buffer pool.
Allocating buf_pool statically removes one level of pointer indirection
and makes code more readable, and removes the awkward initialization of
some buf_pool members.
While doing this, we will also declare some buf_pool_t data members
private and replace some functions with member functions. This is
mostly affecting buffer pool resizing.
This is not aiming to be a complete rewrite of buf_pool_t to
a proper class. Most of the buffer pool interface, such as
buf_page_get_gen(), will remain in the C programming style
for now.
buf_pool_t::withdrawing: Replaces buf_pool_withdrawing.
buf_pool_t::withdraw_clock_: Replaces buf_withdraw_clock.
buf_pool_t::create(): Repalces buf_pool_init().
buf_pool_t::close(): Replaces buf_pool_free().
buf_bool_t::will_be_withdrawn(): Replaces buf_block_will_be_withdrawn(),
buf_frame_will_be_withdrawn().
buf_pool_t::clear_hash_index(): Replaces buf_pool_clear_hash_index().
buf_pool_t::get_n_pages(): Replaces buf_pool_get_n_pages().
buf_pool_t::validate(): Replaces buf_validate().
buf_pool_t::print(): Replaces buf_print().
buf_pool_t::block_from_ahi(): Replaces buf_block_from_ahi().
buf_pool_t::is_block_field(): Replaces buf_pointer_is_block_field().
buf_pool_t::is_block_mutex(): Replaces buf_pool_is_block_mutex().
buf_pool_t::is_block_lock(): Replaces buf_pool_is_block_lock().
buf_pool_t::is_obsolete(): Replaces buf_pool_is_obsolete().
buf_pool_t::io_buf: Make default-constructible.
buf_pool_t::io_buf::create(): Delayed 'constructor'
buf_pool_t::io_buf::close(): Early 'destructor'
HazardPointer: Make default-constructible. Define all member functions
inline, also for derived classes.
Diffstat (limited to 'storage/innobase/btr/btr0cur.cc')
-rw-r--r-- | storage/innobase/btr/btr0cur.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 55ddbdc14ee..23e5d477d9c 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1389,7 +1389,7 @@ btr_cur_search_to_nth_level_func( #else info = btr_search_get_info(index); - if (!buf_pool_is_obsolete(info->withdraw_clock)) { + if (!buf_pool.is_obsolete(info->withdraw_clock)) { guess = info->root_guess; } else { guess = NULL; @@ -1461,7 +1461,7 @@ btr_cur_search_to_nth_level_func( for them, when the history list is glowing huge. */ if (lock_intention == BTR_INTENTION_DELETE && trx_sys.rseg_history_len > BTR_CUR_FINE_HISTORY_LENGTH - && buf_pool->n_pend_reads) { + && buf_pool.n_pend_reads) { x_latch_index: mtr_x_lock_index(index, mtr); } else if (index->is_spatial() @@ -1837,7 +1837,7 @@ retry_page_get: #ifdef BTR_CUR_ADAPT if (block != guess) { info->root_guess = block; - info->withdraw_clock = buf_withdraw_clock; + info->withdraw_clock = buf_pool.withdraw_clock(); } #endif } @@ -2590,7 +2590,7 @@ btr_cur_open_at_index_side_func( for them, when the history list is glowing huge. */ if (lock_intention == BTR_INTENTION_DELETE && trx_sys.rseg_history_len > BTR_CUR_FINE_HISTORY_LENGTH - && buf_pool->n_pend_reads) { + && buf_pool.n_pend_reads) { mtr_x_lock_index(index, mtr); } else { mtr_sx_lock_index(index, mtr); @@ -2917,7 +2917,7 @@ btr_cur_open_at_rnd_pos_func( for them, when the history list is glowing huge. */ if (lock_intention == BTR_INTENTION_DELETE && trx_sys.rseg_history_len > BTR_CUR_FINE_HISTORY_LENGTH - && buf_pool->n_pend_reads) { + && buf_pool.n_pend_reads) { mtr_x_lock_index(index, mtr); } else { mtr_sx_lock_index(index, mtr); @@ -7062,7 +7062,7 @@ btr_blob_free( mtr_commit(mtr); - mutex_enter(&buf_pool->mutex); + mutex_enter(&buf_pool.mutex); /* Only free the block if it is still allocated to the same file page. */ @@ -7081,7 +7081,7 @@ btr_blob_free( } } - mutex_exit(&buf_pool->mutex); + mutex_exit(&buf_pool.mutex); } /** Helper class used while writing blob pages, during insert or update. */ |