diff options
Diffstat (limited to 'storage/xtradb/include/ibuf0ibuf.ic')
-rw-r--r-- | storage/xtradb/include/ibuf0ibuf.ic | 64 |
1 files changed, 55 insertions, 9 deletions
diff --git a/storage/xtradb/include/ibuf0ibuf.ic b/storage/xtradb/include/ibuf0ibuf.ic index 15bbe61ab30..0a22667a260 100644 --- a/storage/xtradb/include/ibuf0ibuf.ic +++ b/storage/xtradb/include/ibuf0ibuf.ic @@ -37,6 +37,30 @@ buffer inserts to this page. If there is this much of free space, the corresponding bits are set in the ibuf bitmap. */ #define IBUF_PAGE_SIZE_PER_FREE_SPACE 32 +/***************************************************************//** +Starts an insert buffer mini-transaction. */ +UNIV_INLINE +void +ibuf_mtr_start( +/*===========*/ + mtr_t* mtr) /*!< out: mini-transaction */ +{ + mtr_start(mtr); + mtr->inside_ibuf = TRUE; +} +/***************************************************************//** +Commits an insert buffer mini-transaction. */ +UNIV_INLINE +void +ibuf_mtr_commit( +/*============*/ + mtr_t* mtr) /*!< in/out: mini-transaction */ +{ + ut_ad(mtr->inside_ibuf); + ut_d(mtr->inside_ibuf = FALSE); + mtr_commit(mtr); +} + /** Insert buffer struct */ struct ibuf_struct{ ulint size; /*!< current size of the ibuf index @@ -46,19 +70,25 @@ struct ibuf_struct{ ulint seg_size; /*!< allocated pages of the file segment containing ibuf header and tree */ - ibool empty; /*!< after an insert to the ibuf tree - is performed, this is set to FALSE, - and if a contract operation finds - the tree empty, this is set to - TRUE */ + ibool empty; /*!< Protected by the page + latch of the root page of the + insert buffer tree + (FSP_IBUF_TREE_ROOT_PAGE_NO). TRUE + if and only if the insert + buffer tree is empty. */ ulint free_list_len; /*!< length of the free list */ ulint height; /*!< tree height */ dict_index_t* index; /*!< insert buffer index */ - ulint n_inserts; /*!< number of inserts made to - the insert buffer */ ulint n_merges; /*!< number of pages merged */ - ulint n_merged_recs; /*!< number of records merged */ + ulint n_merged_ops[IBUF_OP_COUNT]; + /*!< number of operations of each type + merged to index pages */ + ulint n_discarded_ops[IBUF_OP_COUNT]; + /*!< number of operations of each type + discarded without merging due to the + tablespace being deleted or the + index being dropped */ }; /************************************************************************//** @@ -105,7 +135,7 @@ ibuf_should_try( if (ibuf_flush_count % 4 == 0) { - buf_LRU_try_free_flushed_blocks(); + buf_LRU_try_free_flushed_blocks(NULL); } return(TRUE); @@ -114,6 +144,22 @@ ibuf_should_try( return(FALSE); } +/******************************************************************//** +Returns TRUE if the current OS thread is performing an insert buffer +routine. + +For instance, a read-ahead of non-ibuf pages is forbidden by threads +that are executing an insert buffer routine. +@return TRUE if inside an insert buffer routine */ +UNIV_INLINE +ibool +ibuf_inside( +/*========*/ + const mtr_t* mtr) /*!< in: mini-transaction */ +{ + return(mtr->inside_ibuf); +} + /***********************************************************************//** Checks if a page address is an ibuf bitmap page address. @return TRUE if a bitmap page */ |