diff options
author | Michael Widenius <monty@askmonty.org> | 2013-03-26 00:03:13 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2013-03-26 00:03:13 +0200 |
commit | 068c61978e3a81836d52b8caf11e044290159ad1 (patch) | |
tree | 2cbca861ab2cebe3bd99379ca9668bb483ca0d2a /storage/innobase/include/buf0buf.h | |
parent | 35bc8f9f4353b64da215e52ff6f1612a8ce66f43 (diff) | |
download | mariadb-git-068c61978e3a81836d52b8caf11e044290159ad1.tar.gz |
Temporary commit of 10.0-merge
Diffstat (limited to 'storage/innobase/include/buf0buf.h')
-rw-r--r-- | storage/innobase/include/buf0buf.h | 88 |
1 files changed, 57 insertions, 31 deletions
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 2284f21e3ab..74a6e203808 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -89,8 +89,6 @@ extern ibool buf_debug_prints;/*!< If this is set TRUE, the program prints info whenever read or flush occurs */ #endif /* UNIV_DEBUG */ -extern ulint srv_buf_pool_write_requests; /*!< variable to count write request - issued */ extern ulint srv_buf_pool_instances; extern ulint srv_buf_pool_curr_size; #else /* !UNIV_HOTBACKUP */ @@ -102,7 +100,7 @@ extern buf_block_t* back_block2; /*!< second block, for page reorganize */ #define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL /** @brief States of a control block -@see buf_page_struct +@see buf_page_t The enumeration values must be 0..7. */ enum buf_page_state { @@ -132,7 +130,7 @@ enum buf_page_state { /** This structure defines information we will fetch from each buffer pool. It will be used to print table IO stats */ -struct buf_pool_info_struct{ +struct buf_pool_info_t{ /* General buffer pool info */ ulint pool_unique_id; /*!< Buffer Pool ID */ ulint pool_size; /*!< Buffer Pool size in pages */ @@ -203,7 +201,12 @@ struct buf_pool_info_struct{ interval */ }; -typedef struct buf_pool_info_struct buf_pool_info_t; +/** The occupied bytes of lists in all buffer pools */ +struct buf_pools_list_size_t { + ulint LRU_bytes; /*!< LRU size in bytes */ + ulint unzip_LRU_bytes; /*!< unzip_LRU size in bytes */ + ulint flush_list_bytes; /*!< flush_list size in bytes */ +}; #ifndef UNIV_HOTBACKUP /********************************************************************//** @@ -222,9 +225,9 @@ buf_pool_mutex_exit_all(void); /********************************************************************//** Creates the buffer pool. -@return own: buf_pool object, NULL if not enough memory or error */ +@return DB_SUCCESS if success, DB_ERROR if not enough memory or error */ UNIV_INTERN -ulint +dberr_t buf_pool_init( /*=========*/ ulint size, /*!< in: Size of the total pool in bytes */ @@ -629,9 +632,12 @@ UNIV_INTERN ibool buf_page_is_corrupted( /*==================*/ + bool check_lsn, /*!< in: true if we need to check the + and complain about the LSN */ const byte* read_buf, /*!< in: a database page */ - ulint zip_size); /*!< in: size of compressed page; + ulint zip_size) /*!< in: size of compressed page; 0 for uncompressed pages */ + __attribute__((nonnull, warn_unused_result)); #ifndef UNIV_HOTBACKUP /**********************************************************************//** Gets the space id, page offset, and byte offset within page of a @@ -881,7 +887,7 @@ buf_page_belongs_to_unzip_LRU( Gets the mutex of a block. @return pointer to mutex protecting bpage */ UNIV_INLINE -mutex_t* +ib_mutex_t* buf_page_get_mutex( /*===============*/ const buf_page_t* bpage) /*!< in: pointer to control block */ @@ -1010,8 +1016,7 @@ UNIV_INLINE void buf_page_set_accessed( /*==================*/ - buf_page_t* bpage, /*!< in/out: control block */ - ulint time_ms) /*!< in: ut_time_ms() */ + buf_page_t* bpage) /*!< in/out: control block */ __attribute__((nonnull)); /*********************************************************************//** Gets the buf_block_t handle of a buffered file block if an uncompressed @@ -1152,7 +1157,7 @@ UNIV_INTERN buf_page_t* buf_page_init_for_read( /*===================*/ - ulint* err, /*!< out: DB_SUCCESS or DB_TABLESPACE_DELETED */ + dberr_t* err, /*!< out: DB_SUCCESS or DB_TABLESPACE_DELETED */ ulint mode, /*!< in: BUF_READ_IBUF_PAGES_ONLY, ... */ ulint space, /*!< in: space id */ ulint zip_size,/*!< in: compressed page size, or 0 */ @@ -1164,9 +1169,9 @@ buf_page_init_for_read( /********************************************************************//** Completes an asynchronous read or write request of a file page to or from the buffer pool. -@return TRUE if successful */ +@return true if successful */ UNIV_INTERN -ibool +bool buf_page_io_complete( /*=================*/ buf_page_t* bpage); /*!< in: pointer to the block in question */ @@ -1368,6 +1373,14 @@ buf_get_total_list_len( ulint* free_len, /*!< out: length of all free lists */ ulint* flush_list_len);/*!< out: length of all flush lists */ /********************************************************************//** +Get total list size in bytes from all buffer pools. */ +UNIV_INTERN +void +buf_get_total_list_size_in_bytes( +/*=============================*/ + buf_pools_list_size_t* buf_pools_list_size); /*!< out: list sizes + in all buffer pools */ +/********************************************************************//** Get total buffer pool statistics. */ UNIV_INTERN void @@ -1385,6 +1398,16 @@ buf_get_nth_chunk_block( ulint n, /*!< in: nth chunk in the buffer pool */ ulint* chunk_size); /*!< in: chunk size */ +/********************************************************************//** +Calculate the checksum of a page from compressed table and update the page. */ +UNIV_INTERN +void +buf_flush_update_zip_checksum( +/*==========================*/ + buf_frame_t* page, /*!< in/out: Page to update */ + ulint zip_size, /*!< in: Compressed page size */ + lsn_t lsn); /*!< in: Lsn to stamp on the page */ + #endif /* !UNIV_HOTBACKUP */ /** The common buffer control block structure @@ -1393,10 +1416,10 @@ for compressed and uncompressed frames */ /** Number of bits used for buffer page states. */ #define BUF_PAGE_STATE_BITS 3 -struct buf_page_struct{ +struct buf_page_t{ /** @name General fields None of these bit-fields must be modified without holding - buf_page_get_mutex() [buf_block_struct::mutex or + buf_page_get_mutex() [buf_block_t::mutex or buf_pool->zip_mutex], since they can be stored in the same machine word. Some of these fields are additionally protected by buf_pool->mutex. */ @@ -1527,7 +1550,7 @@ struct buf_page_struct{ /* @} */ /** @name LRU replacement algorithm fields These fields are protected by buf_pool->mutex only (not - buf_pool->zip_mutex or buf_block_struct::mutex). */ + buf_pool->zip_mutex or buf_block_t::mutex). */ /* @{ */ UT_LIST_NODE_T(buf_page_t) LRU; @@ -1547,23 +1570,24 @@ struct buf_page_struct{ to read this for heuristic purposes without holding any mutex or latch */ - unsigned access_time:32; /*!< time of first access, or - 0 if the block was never accessed - in the buffer pool */ /* @} */ + unsigned access_time; /*!< time of first access, or + 0 if the block was never accessed + in the buffer pool. Protected by + block mutex */ # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG ibool file_page_was_freed; /*!< this is set to TRUE when fsp frees a page in buffer pool; protected by buf_pool->zip_mutex - or buf_block_struct::mutex. */ + or buf_block_t::mutex. */ # endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */ #endif /* !UNIV_HOTBACKUP */ }; /** The buffer control block structure */ -struct buf_block_struct{ +struct buf_block_t{ /** @name General fields */ /* @{ */ @@ -1587,7 +1611,7 @@ struct buf_block_struct{ decompressed LRU list; used in debugging */ #endif /* UNIV_DEBUG */ - mutex_t mutex; /*!< mutex protecting this block: + ib_mutex_t mutex; /*!< mutex protecting this block: state (also protected by the buffer pool mutex), io_fix, buf_fix_count, and accessed; we introduce this new @@ -1646,8 +1670,8 @@ struct buf_block_struct{ /** @name Hash search fields These 5 fields may only be modified when we have an x-latch on btr_search_latch AND - - we are holding an s-latch or x-latch on buf_block_struct::lock or - - we know that buf_block_struct::buf_fix_count == 0. + - we are holding an s-latch or x-latch on buf_block_t::lock or + - we know that buf_block_t::buf_fix_count == 0. An exception to this is when we init or create a page in the buffer pool in buf0buf.cc. @@ -1706,7 +1730,7 @@ Compute the hash fold value for blocks in buf_pool->zip_hash. */ /* @} */ /** @brief The buffer pool statistics structure. */ -struct buf_pool_stat_struct{ +struct buf_pool_stat_t{ ulint n_page_gets; /*!< number of page gets performed; also successful searches through the adaptive hash index are @@ -1730,10 +1754,12 @@ struct buf_pool_stat_struct{ young because the first access was not long enough ago, in buf_page_peek_if_too_old() */ + ulint LRU_bytes; /*!< LRU size in bytes */ + ulint flush_list_bytes;/*!< flush_list size in bytes */ }; /** Statistics of buddy blocks of a given size. */ -struct buf_buddy_stat_struct { +struct buf_buddy_stat_t { /** Number of blocks allocated from the buddy system. */ ulint used; /** Number of blocks relocated by the buddy system. */ @@ -1747,13 +1773,13 @@ struct buf_buddy_stat_struct { NOTE! The definition appears here only for other modules of this directory (buf) to see it. Do not use from outside! */ -struct buf_pool_struct{ +struct buf_pool_t{ /** @name General fields */ /* @{ */ - mutex_t mutex; /*!< Buffer pool mutex of this + ib_mutex_t mutex; /*!< Buffer pool mutex of this instance */ - mutex_t zip_mutex; /*!< Zip mutex of this buffer + ib_mutex_t zip_mutex; /*!< Zip mutex of this buffer pool instance, protects compressed only pages (of type buf_page_t, not buf_block_t */ @@ -1807,7 +1833,7 @@ struct buf_pool_struct{ /* @{ */ - mutex_t flush_list_mutex;/*!< mutex protecting the + ib_mutex_t flush_list_mutex;/*!< mutex protecting the flush list access. This mutex protects flush_list, flush_rbt and bpage::list pointers when |