diff options
Diffstat (limited to 'storage/innobase/include/buf0buf.h')
-rw-r--r-- | storage/innobase/include/buf0buf.h | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index d56f1790ae4..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,17 +201,13 @@ 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_struct { +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 */ }; -typedef struct buf_pools_list_size_struct buf_pools_list_size_t; - #ifndef UNIV_HOTBACKUP /********************************************************************//** Acquire mutex on all buffer pool instances */ @@ -231,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 */ @@ -638,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 @@ -890,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 */ @@ -1160,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 */ @@ -1172,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 */ @@ -1401,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 @@ -1409,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. */ @@ -1543,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; @@ -1573,14 +1580,14 @@ struct buf_page_struct{ /*!< 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 */ /* @{ */ @@ -1604,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 @@ -1663,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. @@ -1723,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 @@ -1752,7 +1759,7 @@ struct buf_pool_stat_struct{ }; /** 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. */ @@ -1766,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 */ @@ -1826,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 |