MySQL  8.0.21
Source Code Documentation
buf0buf.h File Reference

The database buffer pool high-level routines. More...

#include "buf0types.h"
#include "fil0fil.h"
#include "hash0hash.h"
#include "log0log.h"
#include "mtr0types.h"
#include "os0proc.h"
#include "page0types.h"
#include "srv0srv.h"
#include "univ.i"
#include "ut0byte.h"
#include "ut0rbt.h"
#include "buf/buf.h"
#include <ostream>
#include "buf0buf.ic"

Go to the source code of this file.

Classes

struct  buf_pool_info_t
 This structure defines information we will fetch from each buffer pool. More...
 
struct  buf_pools_list_size_t
 The occupied bytes of lists in all buffer pools. More...
 
class  buf_page_t
 
struct  buf_block_t
 The buffer control block structure. More...
 
class  HazardPointer
 A "Hazard Pointer" class used to iterate over page lists inside the buffer pool. More...
 
class  FlushHp
 Class implementing buf_pool->flush_list hazard pointer. More...
 
class  LRUHp
 Class implementing buf_pool->LRU hazard pointer. More...
 
class  LRUItr
 Special purpose iterators to be used when scanning the LRU list. More...
 
struct  buf_buddy_free_t
 Struct that is embedded in the free zip blocks. More...
 
struct  buf_pool_stat_t
 The buffer pool statistics structure. More...
 
struct  buf_buddy_stat_t
 Statistics of buddy blocks of a given size. More...
 
struct  buf_pool_t
 The buffer pool structure. More...
 
struct  CheckInLRUList
 Functor to validate the LRU list. More...
 
struct  CheckInFreeList
 Functor to validate the LRU list. More...
 
struct  CheckUnzipLRUAndLRUList
 

Macros

#define BUF_POOL_WATCH_SIZE   (srv_n_purge_threads + 1)
 Maximum number of concurrent buffer pool watches. More...
 
#define buf_page_get(ID, SIZE, LA, MTR)
 NOTE! The following macros should be used instead of buf_page_get_gen, to improve debugging. More...
 
#define buf_page_get_with_no_latch(ID, SIZE, MTR)
 Use these macros to bufferfix a page with no latching. More...
 
#define buf_page_try_get(page_id, mtr)   buf_page_try_get_func((page_id), __FILE__, __LINE__, mtr);
 Given a tablespace id and page number tries to get that page. More...
 
#define buf_block_buf_fix_inc(b, f, l)   buf_block_buf_fix_inc_func(f, l, b)
 Increments the bufferfix count. More...
 
#define buf_block_get_page_zip(block)   ((block)->page.zip.data ? &(block)->page.zip : NULL)
 Gets the compressed page descriptor corresponding to an uncompressed page if applicable. More...
 
#define buf_pool_is_block_mutex(m)   buf_pointer_is_block_field((const void *)(m))
 Find out if a pointer corresponds to a buf_block_t::mutex. More...
 
#define buf_pool_is_block_lock(l)   buf_pointer_is_block_field((const void *)(l))
 Find out if a pointer corresponds to a buf_block_t::lock. More...
 
#define buf_page_hash_get_s_locked(b, page_id, l)   buf_page_hash_get_locked(b, page_id, l, RW_LOCK_S)
 
#define buf_page_hash_get_x_locked(b, page_id, l)   buf_page_hash_get_locked(b, page_id, l, RW_LOCK_X)
 
#define buf_page_hash_get(b, page_id)   buf_page_hash_get_locked(b, page_id, NULL, 0)
 
#define buf_page_get_also_watch(b, page_id)   buf_page_hash_get_locked(b, page_id, NULL, 0, true)
 
#define buf_block_hash_get_s_locked(b, page_id, l)   buf_block_hash_get_locked(b, page_id, l, RW_LOCK_S)
 
#define buf_block_hash_get_x_locked(b, page_id, l)   buf_block_hash_get_locked(b, page_id, l, RW_LOCK_X)
 
#define buf_block_hash_get(b, page_id)   buf_block_hash_get_locked(b, page_id, NULL, 0)
 
#define BUF_PAGE_STATE_BITS   3
 The common buffer control block structure for compressed and uncompressed frames. More...
 
#define buf_block_state_valid(block)
 Check if a buf_block_t object is in a valid state. More...
 
Hash search fields

These 5 fields may only be modified when: we are holding the appropriate x-latch in btr_search_latches[], and one of the following holds: (1) the block state is BUF_BLOCK_FILE_PAGE, and we are holding an s-latch or x-latch on buf_block_t::lock, or (2) buf_block_t::buf_fix_count == 0, or (3) the block state is BUF_BLOCK_REMOVE_HASH.

An exception to this is when we init or create a page in the buffer pool in buf0buf.cc.

Another exception for buf_pool_clear_hash_index() is that assigning block->index = NULL (and block->n_pointers = 0) is allowed whenever btr_search_own_all(RW_LOCK_X).

Another exception is that ha_insert_for_fold_func() may decrement n_pointers without holding the appropriate latch in btr_search_latches[]. Thus, n_pointers must be protected by atomic memory access.

This implies that the fields may be read without race condition whenever any of the following hold:

  • the btr_search_latches[] s-latch or x-latch is being held, or
  • the block state is not BUF_BLOCK_FILE_PAGE or BUF_BLOCK_REMOVE_HASH, and holding some latch prevents the state from changing to that.

Some use of assert_block_ahi_empty() or assert_block_ahi_valid() is prone to race conditions while buf_pool_clear_hash_index() is executing (the adaptive hash index is being disabled). Such use is explicitly commented.

#define assert_block_ahi_empty(block)   ut_a(os_atomic_increment_ulint(&(block)->n_pointers, 0) == 0)
 
#define assert_block_ahi_empty_on_init(block)
 
#define assert_block_ahi_valid(block)
 
#define BUF_POOL_ZIP_FOLD_PTR(ptr)   ((ulint)(ptr) / UNIV_PAGE_SIZE)
 Compute the hash fold value for blocks in buf_pool->zip_hash. More...
 
#define BUF_POOL_ZIP_FOLD(b)   BUF_POOL_ZIP_FOLD_PTR((b)->frame)
 
#define BUF_POOL_ZIP_FOLD_BPAGE(b)   BUF_POOL_ZIP_FOLD((buf_block_t *)(b))
 
Accessors for buffer pool mutexes

Use these instead of accessing buffer pool mutexes directly.

#define buf_flush_list_mutex_own(b)   mutex_own(&(b)->flush_list_mutex)
 Test if flush list mutex is owned. More...
 
#define buf_flush_list_mutex_enter(b)
 Acquire the flush list mutex. More...
 
#define buf_flush_list_mutex_exit(b)
 Release the flush list mutex. More...
 
#define buf_page_mutex_own(b)   (b)->mutex.is_owned()
 Test if block->mutex is owned. More...
 
#define buf_page_mutex_enter(b)
 Acquire the block->mutex. More...
 
#define buf_page_mutex_exit(b)
 Release the block->mutex. More...
 
#define buf_page_hash_lock_get(buf_pool, page_id)   hash_get_lock((buf_pool)->page_hash, (page_id).fold())
 Get appropriate page_hash_lock. More...
 
#define buf_page_hash_lock_s_confirm(hash_lock, buf_pool, page_id)   hash_lock_s_confirm(hash_lock, (buf_pool)->page_hash, (page_id).fold())
 If not appropriate page_hash_lock, relock until appropriate. More...
 
#define buf_page_hash_lock_x_confirm(hash_lock, buf_pool, page_id)   hash_lock_x_confirm(hash_lock, (buf_pool)->page_hash, (page_id).fold())
 
#define buf_page_hash_lock_held_s(buf_pool, bpage)   rw_lock_own(buf_page_hash_lock_get((buf_pool), (bpage)->id), RW_LOCK_S)
 Test if page_hash lock is held in s-mode. More...
 
#define buf_page_hash_lock_held_x(buf_pool, bpage)   rw_lock_own(buf_page_hash_lock_get((buf_pool), (bpage)->id), RW_LOCK_X)
 Test if page_hash lock is held in x-mode. More...
 
#define buf_page_hash_lock_held_s_or_x(buf_pool, bpage)
 Test if page_hash lock is held in x or s-mode. More...
 
#define buf_block_hash_lock_held_s(buf_pool, block)   buf_page_hash_lock_held_s((buf_pool), &(block)->page)
 
#define buf_block_hash_lock_held_x(buf_pool, block)   buf_page_hash_lock_held_x((buf_pool), &(block)->page)
 
#define buf_block_hash_lock_held_s_or_x(buf_pool, block)   buf_page_hash_lock_held_s_or_x((buf_pool), &(block)->page)
 

Enumerations

enum  buf_page_state {
  BUF_BLOCK_POOL_WATCH, BUF_BLOCK_ZIP_PAGE, BUF_BLOCK_ZIP_DIRTY, BUF_BLOCK_NOT_USED,
  BUF_BLOCK_READY_FOR_USE, BUF_BLOCK_FILE_PAGE, BUF_BLOCK_MEMORY, BUF_BLOCK_REMOVE_HASH
}
 States of a control block. More...
 
enum  buf_page_print_flags { BUF_PAGE_PRINT_NO_CRASH = 1, BUF_PAGE_PRINT_NO_FULL = 2 }
 
Modes for buf_page_get_gen
enum  Page_fetch {
  Page_fetch::NORMAL, Page_fetch::SCAN, Page_fetch::IF_IN_POOL, Page_fetch::PEEK_IF_IN_POOL,
  Page_fetch::NO_LATCH, Page_fetch::IF_IN_POOL_OR_WATCH, Page_fetch::POSSIBLY_FREED
}
 
Modes for buf_page_get_known_nowait
enum  Cache_hint { Cache_hint::MAKE_YOUNG = 51, Cache_hint::KEEP_OLD = 52 }
 

Functions

dberr_t buf_pool_init (ulint total_size, ulint n_instances)
 Creates the buffer pool. More...
 
void buf_pool_free_all ()
 Frees the buffer pool at shutdown. More...
 
bool buf_block_will_withdrawn (buf_pool_t *buf_pool, const buf_block_t *block)
 Determines if a block is intended to be withdrawn. More...
 
bool buf_frame_will_withdrawn (buf_pool_t *buf_pool, const byte *ptr)
 Determines if a frame is intended to be withdrawn. More...
 
void buf_resize_thread ()
 This is the thread for resizing buffer pool. More...
 
void buf_pool_update_madvise ()
 Checks if innobase_should_madvise_buf_pool() value has changed since we've last check and if so, then updates buf_pool_should_madvise and calls madvise for all chunks in all srv_buf_pool_instances. More...
 
void buf_pool_clear_hash_index (void)
 Clears the adaptive hash index on all pages in the buffer pool. More...
 
UNIV_INLINE ulint buf_pool_get_curr_size (void)
 Gets the current size of buffer buf_pool in bytes. More...
 
UNIV_INLINE ulint buf_pool_get_n_pages (void)
 Gets the current size of buffer buf_pool in frames. More...
 
lsn_t buf_pool_get_oldest_modification_approx (void)
 Gets the smallest oldest_modification lsn among all of the earliest added pages in flush lists. More...
 
lsn_t buf_pool_get_oldest_modification_lwm (void)
 Gets a safe low watermark for oldest_modification. More...
 
UNIV_INLINE buf_page_tbuf_page_alloc_descriptor (void)
 Allocates a buf_page_t descriptor. More...
 
UNIV_INLINE void buf_page_free_descriptor (buf_page_t *bpage)
 Free a buf_page_t descriptor. More...
 
buf_block_tbuf_block_alloc (buf_pool_t *buf_pool)
 Allocates a buffer block. More...
 
UNIV_INLINE void buf_block_free (buf_block_t *block)
 Frees a buffer block which does not contain a file page. More...
 
UNIV_INLINE bytebuf_frame_copy (byte *buf, const buf_frame_t *frame)
 Copies contents of a buffer frame to a given buffer. More...
 
bool buf_page_optimistic_get (ulint rw_latch, buf_block_t *block, uint64_t modify_clock, Page_fetch fetch_mode, const char *file, ulint line, mtr_t *mtr)
 This is the general function used to get optimistic access to a database page. More...
 
bool buf_page_get_known_nowait (ulint rw_latch, buf_block_t *block, Cache_hint hint, const char *file, ulint line, mtr_t *mtr)
 This is used to get access to a known database page, when no waiting can be done. More...
 
const buf_block_tbuf_page_try_get_func (const page_id_t &page_id, const char *file, ulint line, mtr_t *mtr)
 Given a tablespace id and page number tries to get that page. More...
 
buf_page_tbuf_page_get_zip (const page_id_t &page_id, const page_size_t &page_size)
 Get read access to a compressed page (usually of type FIL_PAGE_TYPE_ZBLOB or FIL_PAGE_TYPE_ZBLOB2). More...
 
buf_block_tbuf_page_get_gen (const page_id_t &page_id, const page_size_t &page_size, ulint rw_latch, buf_block_t *guess, Page_fetch mode, const char *file, ulint line, mtr_t *mtr, bool dirty_with_no_latch=false)
 This is the general function used to get access to a database page. More...
 
buf_block_tbuf_page_create (const page_id_t &page_id, const page_size_t &page_size, rw_lock_type_t rw_latch, mtr_t *mtr)
 Initializes a page to the buffer buf_pool. More...
 
UNIV_INLINE void buf_page_release_zip (buf_page_t *bpage)
 Releases a compressed-only page acquired with buf_page_get_zip(). More...
 
UNIV_INLINE void buf_page_release_latch (buf_block_t *block, ulint rw_latch)
 Releases a latch, if specified. More...
 
void buf_page_make_young (buf_page_t *bpage)
 Moves a page to the start of the buffer pool LRU list. More...
 
UNIV_INLINE ibool buf_page_peek (const page_id_t &page_id)
 Returns TRUE if the page can be found in the buffer pool hash table. More...
 
buf_page_tbuf_page_set_file_page_was_freed (const page_id_t &page_id)
 Sets file_page_was_freed TRUE if the page is found in the buffer pool. More...
 
buf_page_tbuf_page_reset_file_page_was_freed (const page_id_t &page_id)
 Sets file_page_was_freed FALSE if the page is found in the buffer pool. More...
 
UNIV_INLINE ulint buf_page_get_freed_page_clock (const buf_page_t *bpage)
 Reads the freed_page_clock of a buffer block. More...
 
UNIV_INLINE ulint buf_block_get_freed_page_clock (const buf_block_t *block)
 Reads the freed_page_clock of a buffer block. More...
 
UNIV_INLINE ibool buf_page_peek_if_young (const buf_page_t *bpage)
 Tells, for heuristics, if a block is still close enough to the MRU end of the LRU list meaning that it is not in danger of getting evicted and also implying that it has been accessed recently. More...
 
UNIV_INLINE ibool buf_page_peek_if_too_old (const buf_page_t *bpage)
 Recommends a move of a block to the start of the LRU list if there is danger of dropping from the buffer pool. More...
 
UNIV_INLINE lsn_t buf_page_get_newest_modification (const buf_page_t *bpage)
 Gets the youngest modification log sequence number for a frame. More...
 
UNIV_INLINE void buf_block_modify_clock_inc (buf_block_t *block)
 Increment the modify clock. More...
 
UNIV_INLINE uint64_t buf_block_get_modify_clock (const buf_block_t *block)
 Read the modify clock. More...
 
UNIV_INLINE void buf_block_buf_fix_inc_func (const char *file, ulint line, buf_block_t *block)
 Increments the bufferfix count. More...
 
UNIV_INLINE ulint buf_block_fix (buf_page_t *bpage)
 Increments the bufferfix count. More...
 
UNIV_INLINE ulint buf_block_fix (buf_block_t *block)
 Increments the bufferfix count. More...
 
UNIV_INLINE ulint buf_block_unfix (buf_page_t *bpage)
 Decrements the bufferfix count. More...
 
UNIV_INLINE ulint buf_block_unfix (buf_block_t *block)
 Decrements the bufferfix count. More...
 
void buf_read_page_handle_error (buf_page_t *bpage)
 Unfixes the page, unlatches the page, removes it from page_hash and removes it from LRU. More...
 
UNIV_INLINE void buf_ptr_get_fsp_addr (const void *ptr, space_id_t *space, fil_addr_t *addr)
 Gets the space id, page offset, and byte offset within page of a pointer pointing to a buffer frame containing a file page. More...
 
UNIV_INLINE ulint buf_block_get_lock_hash_val (const buf_block_t *block)
 Gets the hash value of a block. More...
 
buf_block_tbuf_pool_contains_zip (buf_pool_t *buf_pool, const void *data)
 Finds a block in the buffer pool that points to a given compressed page. More...
 
UNIV_INLINE buf_frame_tbuf_frame_align (byte *ptr)
 
ibool buf_validate (void)
 Validates the buffer pool data structure. More...
 
void buf_print (void)
 Prints info of the buffer pool data structure. More...
 
void buf_page_print (const byte *read_buf, const page_size_t &page_size, ulint flags)
 Prints a page to stderr. More...
 
ibool buf_zip_decompress (buf_block_t *block, ibool check)
 Decompress a block. More...
 
ulint buf_get_latched_pages_number (void)
 Returns the number of latched pages in the buffer pool. More...
 
ulint buf_get_n_pending_read_ios (void)
 Returns the number of pending buf pool read ios. More...
 
void buf_print_io (FILE *file)
 Prints info of the buffer i/o. More...
 
void buf_stats_get_pool_info (buf_pool_t *buf_pool, ulint pool_id, buf_pool_info_t *all_pool_info)
 Collect buffer pool stats information for a buffer pool. More...
 
double buf_get_modified_ratio_pct (void)
 Return the ratio in percents of modified pages in the buffer pool / database pages in the buffer pool. More...
 
void buf_refresh_io_stats_all ()
 Refresh the statistics used to print per-second averages. More...
 
void buf_must_be_all_freed (void)
 Assert that all file pages in the buffer are in a replaceable state. More...
 
ulint buf_pool_check_no_pending_io (void)
 Checks that there currently are no pending i/o-operations for the buffer pool. More...
 
void buf_pool_invalidate (void)
 Invalidates the file pages in the buffer pool when an archive recovery is completed. More...
 
UNIV_INLINE void buf_block_dbg_add_level (buf_block_t *block, latch_level_t level)
 Adds latch level info for the rw-lock protecting the buffer frame. More...
 
UNIV_INLINE enum buf_page_state buf_page_get_state (const buf_page_t *bpage)
 Gets the state of a block. More...
 
UNIV_INLINE enum buf_page_state buf_block_get_state (const buf_block_t *block)
 Gets the state of a block. More...
 
UNIV_INLINE void buf_page_set_state (buf_page_t *bpage, enum buf_page_state state)
 Sets the state of a block. More...
 
UNIV_INLINE void buf_block_set_state (buf_block_t *block, enum buf_page_state state)
 Sets the state of a block. More...
 
UNIV_INLINE ibool buf_page_in_file (const buf_page_t *bpage)
 Determines if a block is mapped to a tablespace. More...
 
UNIV_INLINE bool buf_page_belongs_to_unzip_LRU (const buf_page_t *bpage)
 Determines if a block should be on unzip_LRU list. More...
 
UNIV_INLINE BPageMutexbuf_page_get_mutex (const buf_page_t *bpage)
 Gets the mutex of a block. More...
 
UNIV_INLINE buf_flush_t buf_page_get_flush_type (const buf_page_t *bpage)
 Get the flush type of a page. More...
 
UNIV_INLINE void buf_page_set_flush_type (buf_page_t *bpage, buf_flush_t flush_type)
 Set the flush type of a page. More...
 
UNIV_INLINE void buf_block_set_file_page (buf_block_t *block, const page_id_t &page_id)
 Map a block to a file page. More...
 
UNIV_INLINE enum buf_io_fix buf_page_get_io_fix (const buf_page_t *bpage)
 Gets the io_fix state of a block. More...
 
UNIV_INLINE enum buf_io_fix buf_block_get_io_fix (const buf_block_t *block)
 Gets the io_fix state of a block. More...
 
UNIV_INLINE void buf_page_set_io_fix (buf_page_t *bpage, enum buf_io_fix io_fix)
 Sets the io_fix state of a block. More...
 
UNIV_INLINE void buf_block_set_io_fix (buf_block_t *block, enum buf_io_fix io_fix)
 Sets the io_fix state of a block. More...
 
UNIV_INLINE void buf_page_set_sticky (buf_page_t *bpage)
 Makes a block sticky. More...
 
UNIV_INLINE void buf_page_unset_sticky (buf_page_t *bpage)
 Removes stickiness of a block. More...
 
UNIV_INLINE ibool buf_page_can_relocate (const buf_page_t *bpage)
 Determine if a buffer block can be relocated in memory. More...
 
UNIV_INLINE ibool buf_page_is_old (const buf_page_t *bpage)
 Determine if a block has been flagged old. More...
 
UNIV_INLINE void buf_page_set_old (buf_page_t *bpage, ibool old)
 Flag a block old. More...
 
UNIV_INLINE unsigned buf_page_is_accessed (const buf_page_t *bpage)
 Determine the time of first access of a block in the buffer pool. More...
 
UNIV_INLINE void buf_page_set_accessed (buf_page_t *bpage)
 Flag a block accessed. More...
 
UNIV_INLINE buf_block_tbuf_page_get_block (buf_page_t *bpage)
 Gets the buf_block_t handle of a buffered file block if an uncompressed page frame exists, or NULL. More...
 
UNIV_INLINE buf_frame_tbuf_block_get_frame (const buf_block_t *block)
 Gets a pointer to the memory frame of a block. More...
 
buf_block_tbuf_block_from_ahi (const byte *ptr)
 Get a buffer block from an adaptive hash index pointer. More...
 
ibool buf_pointer_is_block_field (const void *ptr)
 Find out if a pointer belongs to a buf_block_t. More...
 
buf_page_tbuf_page_init_for_read (dberr_t *err, ulint mode, const page_id_t &page_id, const page_size_t &page_size, ibool unzip)
 Inits a page for read to the buffer buf_pool. More...
 
bool buf_page_io_complete (buf_page_t *bpage, bool evict)
 Completes an asynchronous read or write request of a file page to or from the buffer pool. More...
 
UNIV_INLINE ulint buf_pool_index (const buf_pool_t *buf_pool)
 Calculates the index of a buffer pool to the buf_pool[] array. More...
 
UNIV_INLINE buf_pool_tbuf_pool_from_bpage (const buf_page_t *bpage)
 Returns the buffer pool instance given a page instance. More...
 
UNIV_INLINE buf_pool_tbuf_pool_from_block (const buf_block_t *block)
 Returns the buffer pool instance given a block instance. More...
 
UNIV_INLINE buf_pool_tbuf_pool_get (const page_id_t &page_id)
 Returns the buffer pool instance given a page id. More...
 
UNIV_INLINE buf_pool_tbuf_pool_from_array (ulint index)
 Returns the buffer pool instance given its array index. More...
 
UNIV_INLINE buf_page_tbuf_page_hash_get_low (buf_pool_t *buf_pool, const page_id_t &page_id)
 Returns the control block of a file page, NULL if not found. More...
 
UNIV_INLINE buf_page_tbuf_page_hash_get_locked (buf_pool_t *buf_pool, const page_id_t &page_id, rw_lock_t **lock, ulint lock_mode, bool watch=false)
 Returns the control block of a file page, NULL if not found. More...
 
UNIV_INLINE buf_block_tbuf_block_hash_get_locked (buf_pool_t *buf_pool, const page_id_t &page_id, rw_lock_t **lock, ulint lock_mode)
 Returns the control block of a file page, NULL if not found. More...
 
ulint buf_get_free_list_len (void)
 Gets the current length of the free list of buffer blocks. More...
 
ibool buf_pool_watch_is_sentinel (const buf_pool_t *buf_pool, const buf_page_t *bpage)
 Determine if a block is a sentinel for a buffer pool watch. More...
 
void buf_pool_watch_unset (const page_id_t &page_id)
 Stop watching if the page has been read in. More...
 
ibool buf_pool_watch_occurred (const page_id_t &page_id)
 Check if the page has been read in. More...
 
void buf_get_total_list_len (ulint *LRU_len, ulint *free_len, ulint *flush_list_len)
 Get total buffer pool statistics. More...
 
void buf_get_total_list_size_in_bytes (buf_pools_list_size_t *buf_pools_list_size)
 Get total list size in bytes from all buffer pools. More...
 
void buf_get_total_stat (buf_pool_stat_t *tot_stat)
 Get total buffer pool statistics. More...
 
UNIV_INLINE buf_block_tbuf_get_nth_chunk_block (const buf_pool_t *buf_pool, ulint n, ulint *chunk_size)
 Get the nth chunk's buffer block in the specified buffer pool. More...
 
UNIV_INLINE bool buf_pool_is_obsolete (ulint withdraw_clock)
 Verify the possibility that a stored page is not in buffer pool. More...
 
UNIV_INLINE ulint buf_pool_size_align (ulint size)
 Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit, if needed. More...
 
ulonglong buf_pool_adjust_chunk_unit (ulonglong size)
 Adjust the proposed chunk unit size so that it satisfies all invariants. More...
 
void buf_flush_update_zip_checksum (buf_frame_t *page, ulint size, lsn_t lsn, bool skip_lsn_check)
 Calculate the checksum of a page from compressed table and update the page. More...
 
UNIV_INLINE ulint buf_get_withdraw_depth (buf_pool_t *buf_pool)
 Return how many more pages must be added to the withdraw list to reach the withdraw target of the currently ongoing buffer pool resize. More...
 
UNIV_INLINE buf_io_fix buf_block_get_io_fix_unlocked (const buf_block_t *block)
 Gets the io_fix state of a buffer block. More...
 
UNIV_INLINE enum buf_io_fix buf_page_get_io_fix_unlocked (const buf_page_t *bpage)
 Gets the io_fix state of a buffer page. More...
 
std::ostream & operator<< (std::ostream &out, const buf_pool_t &buf_pool)
 Print the given buf_pool_t object. More...
 

Variables

constexpr ulint MAX_BUFFER_POOLS_BITS = 6
 Number of bits to representing a buffer pool ID. More...
 
constexpr ulint MAX_BUFFER_POOLS = (1 << MAX_BUFFER_POOLS_BITS)
 The maximum number of buffer pools that can be defined. More...
 
constexpr ulint MAX_PAGE_HASH_LOCKS = 1024
 The maximum number of page_hash locks. More...
 
buf_pool_tbuf_pool_ptr
 The buffer pools of the database. More...
 
volatile bool buf_pool_withdrawing
 true when withdrawing buffer pool pages might cause page relocation More...
 
volatile ulint buf_withdraw_clock
 the clock is incremented every time a pointer to a page may become obsolete More...
 

Detailed Description

The database buffer pool high-level routines.

Created 11/5/1995 Heikki Tuuri

Macro Definition Documentation

◆ assert_block_ahi_empty

#define assert_block_ahi_empty (   block)    ut_a(os_atomic_increment_ulint(&(block)->n_pointers, 0) == 0)

◆ assert_block_ahi_empty_on_init

#define assert_block_ahi_empty_on_init (   block)
Value:
do { \
UNIV_MEM_VALID(&(block)->n_pointers, sizeof(block)->n_pointers); \
assert_block_ahi_empty(block); \
} while (0)

◆ assert_block_ahi_valid

#define assert_block_ahi_valid (   block)
Value:
ut_a((block)->index || \
os_atomic_increment_ulint(&(block)->n_pointers, 0) == 0)
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:53
#define os_atomic_increment_ulint(ptr, amount)
Definition: os0atomic.h:277

◆ buf_block_buf_fix_inc

#define buf_block_buf_fix_inc (   b,
  f,
 
)    buf_block_buf_fix_inc_func(f, l, b)

Increments the bufferfix count.

Parameters
[in,out]bblock to bufferfix
[in]ffile name where requested
[in]lline number where requested

◆ buf_block_get_page_zip

#define buf_block_get_page_zip (   block)    ((block)->page.zip.data ? &(block)->page.zip : NULL)

Gets the compressed page descriptor corresponding to an uncompressed page if applicable.

◆ buf_block_hash_get

#define buf_block_hash_get (   b,
  page_id 
)    buf_block_hash_get_locked(b, page_id, NULL, 0)

◆ buf_block_hash_get_s_locked

#define buf_block_hash_get_s_locked (   b,
  page_id,
 
)    buf_block_hash_get_locked(b, page_id, l, RW_LOCK_S)

◆ buf_block_hash_get_x_locked

#define buf_block_hash_get_x_locked (   b,
  page_id,
 
)    buf_block_hash_get_locked(b, page_id, l, RW_LOCK_X)

◆ buf_block_hash_lock_held_s

#define buf_block_hash_lock_held_s (   buf_pool,
  block 
)    buf_page_hash_lock_held_s((buf_pool), &(block)->page)

◆ buf_block_hash_lock_held_s_or_x

#define buf_block_hash_lock_held_s_or_x (   buf_pool,
  block 
)    buf_page_hash_lock_held_s_or_x((buf_pool), &(block)->page)

◆ buf_block_hash_lock_held_x

#define buf_block_hash_lock_held_x (   buf_pool,
  block 
)    buf_page_hash_lock_held_x((buf_pool), &(block)->page)

◆ buf_block_state_valid

#define buf_block_state_valid (   block)
Value:
UNIV_INLINE enum buf_page_state buf_block_get_state(const buf_block_t *block)
Gets the state of a block.
hash index should be removed before putting to the free list
Definition: buf0buf.h:152
is in the free list; must be after the BUF_BLOCK_ZIP_ constants for compressed-only pages ...
Definition: buf0buf.h:143

Check if a buf_block_t object is in a valid state.

Parameters
blockbuffer block
Returns
true if valid

◆ buf_flush_list_mutex_enter

#define buf_flush_list_mutex_enter (   b)
Value:
do { \
mutex_enter(&(b)->flush_list_mutex); \
} while (0)

Acquire the flush list mutex.

◆ buf_flush_list_mutex_exit

#define buf_flush_list_mutex_exit (   b)
Value:
do { \
mutex_exit(&(b)->flush_list_mutex); \
} while (0)

Release the flush list mutex.

◆ buf_flush_list_mutex_own

#define buf_flush_list_mutex_own (   b)    mutex_own(&(b)->flush_list_mutex)

Test if flush list mutex is owned.

◆ buf_page_get

#define buf_page_get (   ID,
  SIZE,
  LA,
  MTR 
)
Value:
buf_page_get_gen(ID, SIZE, LA, NULL, Page_fetch::NORMAL, __FILE__, __LINE__, \
MTR)
buf_block_t * buf_page_get_gen(const page_id_t &page_id, const page_size_t &page_size, ulint rw_latch, buf_block_t *guess, Page_fetch mode, const char *file, ulint line, mtr_t *mtr, bool dirty_with_no_latch=false)
This is the general function used to get access to a database page.
Definition: buf0buf.cc:4155
#define NULL
Definition: types.h:54
Get always.

NOTE! The following macros should be used instead of buf_page_get_gen, to improve debugging.

Only values RW_S_LATCH and RW_X_LATCH are allowed in LA!

◆ buf_page_get_also_watch

#define buf_page_get_also_watch (   b,
  page_id 
)    buf_page_hash_get_locked(b, page_id, NULL, 0, true)

◆ buf_page_get_with_no_latch

#define buf_page_get_with_no_latch (   ID,
  SIZE,
  MTR 
)
Value:
__FILE__, __LINE__, MTR)
buf_block_t * buf_page_get_gen(const page_id_t &page_id, const page_size_t &page_size, ulint rw_latch, buf_block_t *guess, Page_fetch mode, const char *file, ulint line, mtr_t *mtr, bool dirty_with_no_latch=false)
This is the general function used to get access to a database page.
Definition: buf0buf.cc:4155
Definition: sync0rw.h:139
#define NULL
Definition: types.h:54
get and bufferfix, but set no latch; we have separated this case, because it is error-prone programmi...

Use these macros to bufferfix a page with no latching.

Remember not to read the contents of the page unless you know it is safe. Do not modify the contents of the page! We have separated this case, because it is error-prone programming not to set a latch, and it should be used with care.

◆ buf_page_hash_get

#define buf_page_hash_get (   b,
  page_id 
)    buf_page_hash_get_locked(b, page_id, NULL, 0)

◆ buf_page_hash_get_s_locked

#define buf_page_hash_get_s_locked (   b,
  page_id,
 
)    buf_page_hash_get_locked(b, page_id, l, RW_LOCK_S)

◆ buf_page_hash_get_x_locked

#define buf_page_hash_get_x_locked (   b,
  page_id,
 
)    buf_page_hash_get_locked(b, page_id, l, RW_LOCK_X)

◆ buf_page_hash_lock_get

#define buf_page_hash_lock_get (   buf_pool,
  page_id 
)    hash_get_lock((buf_pool)->page_hash, (page_id).fold())

Get appropriate page_hash_lock.

◆ buf_page_hash_lock_held_s

#define buf_page_hash_lock_held_s (   buf_pool,
  bpage 
)    rw_lock_own(buf_page_hash_lock_get((buf_pool), (bpage)->id), RW_LOCK_S)

Test if page_hash lock is held in s-mode.

◆ buf_page_hash_lock_held_s_or_x

#define buf_page_hash_lock_held_s_or_x (   buf_pool,
  bpage 
)
Value:
(buf_page_hash_lock_held_s((buf_pool), (bpage)) || \
buf_page_hash_lock_held_x((buf_pool), (bpage)))
#define buf_page_hash_lock_held_s(buf_pool, bpage)
Test if page_hash lock is held in s-mode.
Definition: buf0buf.h:2082

Test if page_hash lock is held in x or s-mode.

◆ buf_page_hash_lock_held_x

#define buf_page_hash_lock_held_x (   buf_pool,
  bpage 
)    rw_lock_own(buf_page_hash_lock_get((buf_pool), (bpage)->id), RW_LOCK_X)

Test if page_hash lock is held in x-mode.

◆ buf_page_hash_lock_s_confirm

#define buf_page_hash_lock_s_confirm (   hash_lock,
  buf_pool,
  page_id 
)    hash_lock_s_confirm(hash_lock, (buf_pool)->page_hash, (page_id).fold())

If not appropriate page_hash_lock, relock until appropriate.

◆ buf_page_hash_lock_x_confirm

#define buf_page_hash_lock_x_confirm (   hash_lock,
  buf_pool,
  page_id 
)    hash_lock_x_confirm(hash_lock, (buf_pool)->page_hash, (page_id).fold())

◆ buf_page_mutex_enter

#define buf_page_mutex_enter (   b)
Value:
do { \
mutex_enter(&(b)->mutex); \
} while (0)
pthread_mutex_t mutex
Definition: memcached.c:384

Acquire the block->mutex.

◆ buf_page_mutex_exit

#define buf_page_mutex_exit (   b)
Value:
do { \
(b)->mutex.exit(); \
} while (0)
pthread_mutex_t mutex
Definition: memcached.c:384

Release the block->mutex.

◆ buf_page_mutex_own

#define buf_page_mutex_own (   b)    (b)->mutex.is_owned()

Test if block->mutex is owned.

◆ BUF_PAGE_STATE_BITS

#define BUF_PAGE_STATE_BITS   3

The common buffer control block structure for compressed and uncompressed frames.

Number of bits used for buffer page states.

◆ buf_page_try_get

#define buf_page_try_get (   page_id,
  mtr 
)    buf_page_try_get_func((page_id), __FILE__, __LINE__, mtr);

Given a tablespace id and page number tries to get that page.

If the page is not in the buffer pool it is not loaded and NULL is returned. Suitable for using when holding the lock_sys latches (as it avoids deadlock).

Parameters
[in]page_idpage identifier
[in]mtrmini-transaction
Returns
the page if in buffer pool, NULL if not

◆ buf_pool_is_block_lock

#define buf_pool_is_block_lock (   l)    buf_pointer_is_block_field((const void *)(l))

Find out if a pointer corresponds to a buf_block_t::lock.

Parameters
lin: rw-lock candidate
Returns
true if l is a buf_block_t::lock

◆ buf_pool_is_block_mutex

#define buf_pool_is_block_mutex (   m)    buf_pointer_is_block_field((const void *)(m))

Find out if a pointer corresponds to a buf_block_t::mutex.

Parameters
min: mutex candidate
Returns
true if m is a buf_block_t::mutex

◆ BUF_POOL_WATCH_SIZE

#define BUF_POOL_WATCH_SIZE   (srv_n_purge_threads + 1)

Maximum number of concurrent buffer pool watches.

◆ BUF_POOL_ZIP_FOLD

#define BUF_POOL_ZIP_FOLD (   b)    BUF_POOL_ZIP_FOLD_PTR((b)->frame)

◆ BUF_POOL_ZIP_FOLD_BPAGE

#define BUF_POOL_ZIP_FOLD_BPAGE (   b)    BUF_POOL_ZIP_FOLD((buf_block_t *)(b))

◆ BUF_POOL_ZIP_FOLD_PTR

#define BUF_POOL_ZIP_FOLD_PTR (   ptr)    ((ulint)(ptr) / UNIV_PAGE_SIZE)

Compute the hash fold value for blocks in buf_pool->zip_hash.

Enumeration Type Documentation

◆ buf_page_print_flags

Enumerator
BUF_PAGE_PRINT_NO_CRASH 

Do not crash at the end of buf_page_print().

BUF_PAGE_PRINT_NO_FULL 

Do not print the full page dump.

◆ buf_page_state

States of a control block.

See also
buf_page_t

The enumeration values must be 0..7.

Enumerator
BUF_BLOCK_POOL_WATCH 

a sentinel for the buffer pool watch, element of buf_pool->watch[]

BUF_BLOCK_ZIP_PAGE 

contains a clean compressed page

BUF_BLOCK_ZIP_DIRTY 

contains a compressed page that is in the buf_pool->flush_list

BUF_BLOCK_NOT_USED 

is in the free list; must be after the BUF_BLOCK_ZIP_ constants for compressed-only pages

See also
buf_block_state_valid()
BUF_BLOCK_READY_FOR_USE 

when buf_LRU_get_free_block returns a block, it is in this state

BUF_BLOCK_FILE_PAGE 

contains a buffered file page

BUF_BLOCK_MEMORY 

contains some main memory object

BUF_BLOCK_REMOVE_HASH 

hash index should be removed before putting to the free list

◆ Cache_hint

enum Cache_hint
strong
Enumerator
MAKE_YOUNG 

Move the block to the start of the LRU list if there is a danger that the block would drift out of the buffer pool.

KEEP_OLD 

Preserve the current LRU position of the block.

◆ Page_fetch

enum Page_fetch
strong
Enumerator
NORMAL 

Get always.

SCAN 

Same as NORMAL, but hint that the fetch is part of a large scan.

Try not to flood the buffer pool with pages that may not be accessed again any time soon.

IF_IN_POOL 

get if in pool

PEEK_IF_IN_POOL 

get if in pool, do not make the block young in the LRU list

NO_LATCH 

get and bufferfix, but set no latch; we have separated this case, because it is error-prone programming not to set a latch, and it should be used with care

IF_IN_POOL_OR_WATCH 

Get the page only if it's in the buffer pool, if not then set a watch on the page.

POSSIBLY_FREED 

Like Page_fetch::NORMAL, but do not mind if the file page has been freed.

Function Documentation

◆ buf_block_alloc()

buf_block_t* buf_block_alloc ( buf_pool_t buf_pool)

Allocates a buffer block.

Returns
own: the allocated block, in state BUF_BLOCK_MEMORY in: buffer pool instance, or NULL for round-robin selection of the buffer pool
own: the allocated block, in state BUF_BLOCK_MEMORY
Parameters
buf_poolin/out: buffer pool instance, or NULL for round-robin selection of the buffer pool

◆ buf_block_buf_fix_inc_func()

UNIV_INLINE void buf_block_buf_fix_inc_func ( const char *  file,
ulint  line,
buf_block_t block 
)

Increments the bufferfix count.

Parameters
[in]filefile name
[in]lineline
[in,out]blockblock to bufferfix

◆ buf_block_dbg_add_level()

UNIV_INLINE void buf_block_dbg_add_level ( buf_block_t block,
latch_level_t  level 
)

Adds latch level info for the rw-lock protecting the buffer frame.

This should be called in the debug version after a successful latching of a page if we know the latching order level of the acquired latch.

Parameters
[in]blockbuffer page where we have acquired latch
[in]levellatching order level

◆ buf_block_fix() [1/2]

UNIV_INLINE ulint buf_block_fix ( buf_page_t bpage)

Increments the bufferfix count.

Parameters
[in,out]bpageblock to bufferfix
Returns
the count

◆ buf_block_fix() [2/2]

UNIV_INLINE ulint buf_block_fix ( buf_block_t block)

Increments the bufferfix count.

Parameters
[in,out]blockblock to bufferfix
Returns
the count

◆ buf_block_free()

UNIV_INLINE void buf_block_free ( buf_block_t block)

Frees a buffer block which does not contain a file page.

in, own: block to be freed

◆ buf_block_from_ahi()

buf_block_t* buf_block_from_ahi ( const byte ptr)

Get a buffer block from an adaptive hash index pointer.

This function does not return if the block is not identified.

Parameters
[in]ptrpointer to within a page frame
Returns
pointer to block, never NULL

◆ buf_block_get_frame()

UNIV_INLINE buf_frame_t* buf_block_get_frame ( const buf_block_t block)

Gets a pointer to the memory frame of a block.

Returns
pointer to the frame
Parameters
blockin: pointer to the control block

◆ buf_block_get_freed_page_clock()

UNIV_INLINE ulint buf_block_get_freed_page_clock ( const buf_block_t block)

Reads the freed_page_clock of a buffer block.

Returns
freed_page_clock
Parameters
blockin: block

◆ buf_block_get_io_fix()

UNIV_INLINE enum buf_io_fix buf_block_get_io_fix ( const buf_block_t block)

Gets the io_fix state of a block.

Returns
io_fix state
Parameters
blockin: pointer to the control block

◆ buf_block_get_io_fix_unlocked()

UNIV_INLINE buf_io_fix buf_block_get_io_fix_unlocked ( const buf_block_t block)

Gets the io_fix state of a buffer block.

Does not assert that the buf_page_get_mutex() mutex is held, to be used in the cases where it is safe not to hold it.

Parameters
[in]blockpointer to the buffer block
Returns
page io_fix state

◆ buf_block_get_lock_hash_val()

UNIV_INLINE ulint buf_block_get_lock_hash_val ( const buf_block_t block)

Gets the hash value of a block.

This can be used in searches in the lock hash table.

Returns
lock hash value
Parameters
blockin: block

◆ buf_block_get_modify_clock()

UNIV_INLINE uint64_t buf_block_get_modify_clock ( const buf_block_t block)

Read the modify clock.

Parameters
[in]blockbuffer block
Returns
modify_clock value

◆ buf_block_get_state()

UNIV_INLINE enum buf_page_state buf_block_get_state ( const buf_block_t block)

Gets the state of a block.

Returns
state
Parameters
blockin: pointer to the control block

◆ buf_block_hash_get_locked()

UNIV_INLINE buf_block_t* buf_block_hash_get_locked ( buf_pool_t buf_pool,
const page_id_t page_id,
rw_lock_t **  lock,
ulint  lock_mode 
)

Returns the control block of a file page, NULL if not found.

If the block is found and lock is not NULL then the appropriate page_hash lock is acquired in the specified lock mode. Otherwise, mode value is ignored. It is up to the caller to release the lock. If the block is found and the lock is NULL then the page_hash lock is released by this function.

Parameters
[in]buf_poolbuffer pool instance
[in]page_idpage id
[in,out]locklock of the page hash acquired if bpage is found, NULL otherwise. If NULL is passed then the hash_lock is released by this function.
[in]lock_modeRW_LOCK_X or RW_LOCK_S. Ignored if lock == NULL
Returns
pointer to the block or NULL; if NULL, lock is also NULL.

◆ buf_block_modify_clock_inc()

UNIV_INLINE void buf_block_modify_clock_inc ( buf_block_t block)

Increment the modify clock.

The caller must (1) own the buf_pool->mutex and block bufferfix count has to be zero, (2) own X or SX latch on the block->lock, or (3) operate on a thread-private temporary table

Parameters
[in,out]blockbuffer block

◆ buf_block_set_file_page()

UNIV_INLINE void buf_block_set_file_page ( buf_block_t block,
const page_id_t page_id 
)

Map a block to a file page.

Parameters
[in,out]blockpointer to control block
[in]page_idpage id

◆ buf_block_set_io_fix()

UNIV_INLINE void buf_block_set_io_fix ( buf_block_t block,
enum buf_io_fix  io_fix 
)

Sets the io_fix state of a block.

Parameters
[in,out]blockcontrol block
[in]io_fixio_fix state

◆ buf_block_set_state()

UNIV_INLINE void buf_block_set_state ( buf_block_t block,
enum buf_page_state  state 
)

Sets the state of a block.

Parameters
[in,out]blockpointer to control block
[in]statestate

◆ buf_block_unfix() [1/2]

UNIV_INLINE ulint buf_block_unfix ( buf_page_t bpage)

Decrements the bufferfix count.

Parameters
[in,out]bpageblock to bufferunfix
Returns
the remaining buffer-fix count

◆ buf_block_unfix() [2/2]

UNIV_INLINE ulint buf_block_unfix ( buf_block_t block)

Decrements the bufferfix count.

Parameters
[in,out]blockblock to bufferunfix
Returns
the remaining buffer-fix count

◆ buf_block_will_withdrawn()

bool buf_block_will_withdrawn ( buf_pool_t buf_pool,
const buf_block_t block 
)

Determines if a block is intended to be withdrawn.

Parameters
[in]buf_poolbuffer pool instance
[in]blockpointer to control block
Return values
trueif will be withdrawn

The caller must ensure that there was a sufficient memory barrier to read curr_size and old_size.

Parameters
[in]buf_poolbuffer pool instance
[in]blockpointer to control block
Return values
trueif will be withdrawn

◆ buf_flush_update_zip_checksum()

void buf_flush_update_zip_checksum ( buf_frame_t page,
ulint  size,
lsn_t  lsn,
bool  skip_lsn_check 
)

Calculate the checksum of a page from compressed table and update the page.

Parameters
[in,out]pagepage to update
[in]sizecompressed page size
[in]lsnLSN to stamp on the page
[in]skip_lsn_checktrue to skip check for lsn (in DEBUG)

◆ buf_frame_align()

UNIV_INLINE buf_frame_t* buf_frame_align ( byte ptr)

◆ buf_frame_copy()

UNIV_INLINE byte* buf_frame_copy ( byte buf,
const buf_frame_t frame 
)

Copies contents of a buffer frame to a given buffer.

Parameters
[in]bufbuffer to copy to
[in]framebuffer frame
Returns
buf

◆ buf_frame_will_withdrawn()

bool buf_frame_will_withdrawn ( buf_pool_t buf_pool,
const byte ptr 
)

Determines if a frame is intended to be withdrawn.

Parameters
[in]buf_poolbuffer pool instance
[in]ptrpointer to a frame
Return values
trueif will be withdrawn

The caller must ensure that there was a sufficient memory barrier to read curr_size and old_size.

Parameters
[in]buf_poolbuffer pool instance
[in]ptrpointer to a frame
Return values
trueif will be withdrawn

◆ buf_get_free_list_len()

ulint buf_get_free_list_len ( void  )

Gets the current length of the free list of buffer blocks.

Returns
length of the free list

◆ buf_get_latched_pages_number()

ulint buf_get_latched_pages_number ( void  )

Returns the number of latched pages in the buffer pool.

Returns
number of latched pages

Returns the number of latched pages in the buffer pool.

Returns
number of latched pages

◆ buf_get_modified_ratio_pct()

double buf_get_modified_ratio_pct ( void  )

Return the ratio in percents of modified pages in the buffer pool / database pages in the buffer pool.

Returns
modified page percentage ratio

Return the ratio in percents of modified pages in the buffer pool / database pages in the buffer pool.

Returns
modified page percentage ratio

◆ buf_get_n_pending_read_ios()

ulint buf_get_n_pending_read_ios ( void  )

Returns the number of pending buf pool read ios.

Returns
number of pending read I/O operations

◆ buf_get_nth_chunk_block()

UNIV_INLINE buf_block_t* buf_get_nth_chunk_block ( const buf_pool_t buf_pool,
ulint  n,
ulint *  chunk_size 
)

Get the nth chunk's buffer block in the specified buffer pool.

Parameters
[in]buf_poolbuffer pool instance
[in]nnth chunk in the buffer pool
[in]chunk_sizechunk_size
Returns
the nth chunk's buffer block.

◆ buf_get_total_list_len()

void buf_get_total_list_len ( ulint *  LRU_len,
ulint *  free_len,
ulint *  flush_list_len 
)

Get total buffer pool statistics.

out: length of all flush lists

Parameters
LRU_lenout: length of all LRU lists
free_lenout: length of all free lists
flush_list_lenout: length of all flush lists

◆ buf_get_total_list_size_in_bytes()

void buf_get_total_list_size_in_bytes ( buf_pools_list_size_t buf_pools_list_size)

Get total list size in bytes from all buffer pools.

out: list sizes in all buffer pools

Parameters
buf_pools_list_sizeout: list sizes in all buffer pools

◆ buf_get_total_stat()

void buf_get_total_stat ( buf_pool_stat_t tot_stat)

Get total buffer pool statistics.

out: buffer pool stats

Parameters
tot_statout: buffer pool stats

◆ buf_get_withdraw_depth()

UNIV_INLINE ulint buf_get_withdraw_depth ( buf_pool_t buf_pool)

Return how many more pages must be added to the withdraw list to reach the withdraw target of the currently ongoing buffer pool resize.

Parameters
[in]buf_poolbuffer pool instance
Returns
page count to be withdrawn or zero if the target is already achieved or if the buffer pool is not currently being resized.

◆ buf_must_be_all_freed()

void buf_must_be_all_freed ( void  )

Assert that all file pages in the buffer are in a replaceable state.

Assert that all file pages in the buffer are in a replaceable state.

◆ buf_page_alloc_descriptor()

UNIV_INLINE buf_page_t* buf_page_alloc_descriptor ( void  )

Allocates a buf_page_t descriptor.

This function must succeed. In case of failure we assert in this function.

◆ buf_page_belongs_to_unzip_LRU()

UNIV_INLINE bool buf_page_belongs_to_unzip_LRU ( const buf_page_t bpage)

Determines if a block should be on unzip_LRU list.

Returns
true if block belongs to unzip_LRU
Parameters
bpagein: pointer to control block

◆ buf_page_can_relocate()

UNIV_INLINE ibool buf_page_can_relocate ( const buf_page_t bpage)

Determine if a buffer block can be relocated in memory.

The block can be dirty, but it must not be I/O-fixed or bufferfixed.

Parameters
bpagecontrol block being relocated

◆ buf_page_create()

buf_block_t* buf_page_create ( const page_id_t page_id,
const page_size_t page_size,
rw_lock_type_t  rw_latch,
mtr_t mtr 
)

Initializes a page to the buffer buf_pool.

The page is usually not read from a file even if it cannot be found in the buffer buf_pool. This is one of the functions which perform to a block a state transition NOT_USED => FILE_PAGE (the other is buf_page_get_gen). The page is latched by passed mtr.

Parameters
[in]page_idpage id
[in]page_sizepage size
[in]rw_latchRW_SX_LATCH, RW_X_LATCH
[in]mtrmini-transaction
Returns
pointer to the block, page bufferfixed

◆ buf_page_free_descriptor()

UNIV_INLINE void buf_page_free_descriptor ( buf_page_t bpage)

Free a buf_page_t descriptor.

in: bpage descriptor to free.

◆ buf_page_get_block()

UNIV_INLINE buf_block_t* buf_page_get_block ( buf_page_t bpage)

Gets the buf_block_t handle of a buffered file block if an uncompressed page frame exists, or NULL.

page frame exists, or NULL. The caller must hold either the appropriate hash lock in any mode, either the LRU list mutex. Note: even though bpage is not declared a const we don't update its value. It is safe to make this pure.

Parameters
[in]bpagecontrol block, or NULL
Returns
control block, or NULL

◆ buf_page_get_flush_type()

UNIV_INLINE buf_flush_t buf_page_get_flush_type ( const buf_page_t bpage)

Get the flush type of a page.

Returns
flush type
Parameters
bpagein: buffer page

◆ buf_page_get_freed_page_clock()

UNIV_INLINE ulint buf_page_get_freed_page_clock ( const buf_page_t bpage)

Reads the freed_page_clock of a buffer block.

Returns
freed_page_clock
Parameters
bpagein: block

◆ buf_page_get_gen()

buf_block_t* buf_page_get_gen ( const page_id_t page_id,
const page_size_t page_size,
ulint  rw_latch,
buf_block_t guess,
Page_fetch  mode,
const char *  file,
ulint  line,
mtr_t mtr,
bool  dirty_with_no_latch = false 
)

This is the general function used to get access to a database page.

Parameters
[in]page_idpage id
[in]page_sizepage size
[in]rw_latchRW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
[in]guessguessed block or NULL
[in]modeFetch mode.
[in]filefile name
[in]lineline where called
[in]mtrmini-transaction
[in]dirty_with_no_latchmark page as dirty even if page is being pinned without any latch
Returns
pointer to the block or NULL

◆ buf_page_get_io_fix()

UNIV_INLINE enum buf_io_fix buf_page_get_io_fix ( const buf_page_t bpage)

Gets the io_fix state of a block.

Returns
io_fix state
Parameters
bpagein: pointer to the control block

◆ buf_page_get_io_fix_unlocked()

UNIV_INLINE enum buf_io_fix buf_page_get_io_fix_unlocked ( const buf_page_t bpage)

Gets the io_fix state of a buffer page.

Does not assert that the buf_page_get_mutex() mutex is held, to be used in the cases where it is safe not to hold it.

Parameters
[in]bpagepointer to the buffer page
Returns
page io_fix state

◆ buf_page_get_known_nowait()

bool buf_page_get_known_nowait ( ulint  rw_latch,
buf_block_t block,
Cache_hint  hint,
const char *  file,
ulint  line,
mtr_t mtr 
)

This is used to get access to a known database page, when no waiting can be done.

Parameters
[in]rw_latchRW_S_LATCH or RW_X_LATCH.
[in]blockThe known page.
[in]hintCache_hint::MAKE_YOUNG or Cache_hint::KEEP_OLD
[in]fileFile name from where it was called.
[in]lineLine from where it was called.
[in,out]mtrMini-transaction covering the fetch
Returns
true if success

◆ buf_page_get_mutex()

UNIV_INLINE BPageMutex* buf_page_get_mutex ( const buf_page_t bpage)

Gets the mutex of a block.

Returns
pointer to mutex protecting bpage
Parameters
bpagein: pointer to control block

◆ buf_page_get_newest_modification()

UNIV_INLINE lsn_t buf_page_get_newest_modification ( const buf_page_t bpage)

Gets the youngest modification log sequence number for a frame.

Returns zero if not file page or no modification occurred yet.

Returns
newest modification to page in: block containing the page frame

◆ buf_page_get_state()

UNIV_INLINE enum buf_page_state buf_page_get_state ( const buf_page_t bpage)

Gets the state of a block.

Returns
state in: pointer to the control block

◆ buf_page_get_zip()

buf_page_t* buf_page_get_zip ( const page_id_t page_id,
const page_size_t page_size 
)

Get read access to a compressed page (usually of type FIL_PAGE_TYPE_ZBLOB or FIL_PAGE_TYPE_ZBLOB2).

The page must be released with buf_page_release_zip(). NOTE: the page is not protected by any latch. Mutual exclusion has to be implemented at a higher level. In other words, all possible accesses to a given page through this function must be protected by the same set of mutexes or latches.

Parameters
[in]page_idpage id
[in]page_sizepage size
Returns
pointer to the block

◆ buf_page_hash_get_locked()

UNIV_INLINE buf_page_t* buf_page_hash_get_locked ( buf_pool_t buf_pool,
const page_id_t page_id,
rw_lock_t **  lock,
ulint  lock_mode,
bool  watch = false 
)

Returns the control block of a file page, NULL if not found.

If the block is found and lock is not NULL then the appropriate page_hash lock is acquired in the specified lock mode. Otherwise, mode value is ignored. It is up to the caller to release the lock. If the block is found and the lock is NULL then the page_hash lock is released by this function.

Parameters
[in]buf_poolbuffer pool instance
[in]page_idpage id
[in,out]locklock of the page hash acquired if bpage is found, NULL otherwise. If NULL is passed then the hash_lock is released by this function.
[in]lock_modeRW_LOCK_X or RW_LOCK_S. Ignored if lock == NULL
[in]watchif true, return watch sentinel also.
Returns
pointer to the bpage or NULL; if NULL, lock is also NULL or a watch sentinel.

◆ buf_page_hash_get_low()

UNIV_INLINE buf_page_t* buf_page_hash_get_low ( buf_pool_t buf_pool,
const page_id_t page_id 
)

Returns the control block of a file page, NULL if not found.

Parameters
[in]buf_poolbuffer pool instance
[in]page_idpage id
Returns
block, NULL if not found

◆ buf_page_in_file()

UNIV_INLINE ibool buf_page_in_file ( const buf_page_t bpage)

Determines if a block is mapped to a tablespace.

Returns
true if mapped
Parameters
bpagein: pointer to control block

◆ buf_page_init_for_read()

buf_page_t* buf_page_init_for_read ( dberr_t err,
ulint  mode,
const page_id_t page_id,
const page_size_t page_size,
ibool  unzip 
)

Inits a page for read to the buffer buf_pool.

If the page is (1) already in buf_pool, or (2) if we specify to read only ibuf pages and the page is not an ibuf page, or (3) if the space is deleted or being deleted, then this function does nothing. Sets the io_fix flag to BUF_IO_READ and sets a non-recursive exclusive lock on the buffer frame. The io-handler must take care that the flag is cleared and the lock released later.

Parameters
[out]errDB_SUCCESS or DB_TABLESPACE_DELETED
[in]modeBUF_READ_IBUF_PAGES_ONLY, ...
[in]page_idpage id
[in]page_sizepage size
[in]unzipTRUE=request uncompressed page
Returns
pointer to the block or NULL

◆ buf_page_io_complete()

bool buf_page_io_complete ( buf_page_t bpage,
bool  evict 
)

Completes an asynchronous read or write request of a file page to or from the buffer pool.

Parameters
[in]bpagepointer to the block in question
[in]evictwhether or not to evict the page from LRU list
Returns
true if successful

◆ buf_page_is_accessed()

UNIV_INLINE unsigned buf_page_is_accessed ( const buf_page_t bpage)

Determine the time of first access of a block in the buffer pool.

Returns
ut_time_monotonic_ms() at the time of first access, 0 if not accessed
Parameters
bpagein: control block

◆ buf_page_is_old()

UNIV_INLINE ibool buf_page_is_old ( const buf_page_t bpage)

Determine if a block has been flagged old.

Parameters
[in]bpagecontrol block
Returns
true if old

◆ buf_page_make_young()

void buf_page_make_young ( buf_page_t bpage)

Moves a page to the start of the buffer pool LRU list.

This high-level function can be used to prevent an important page from slipping out of the buffer pool.

Parameters
[in,out]bpagebuffer block of a file page

◆ buf_page_optimistic_get()

bool buf_page_optimistic_get ( ulint  rw_latch,
buf_block_t block,
uint64_t  modify_clock,
Page_fetch  fetch_mode,
const char *  file,
ulint  line,
mtr_t mtr 
)

This is the general function used to get optimistic access to a database page.

Parameters
[in]rw_latchRW_S_LATCH, RW_X_LATCH
[in,out]blockguessed block
[in]modify_clockmodify clock value
[in]fetch_modeFetch mode
[in]filefile name
[in]lineline where called
[in,out]mtrmini-transaction
Returns
true if success

◆ buf_page_peek()

UNIV_INLINE ibool buf_page_peek ( const page_id_t page_id)

Returns TRUE if the page can be found in the buffer pool hash table.

NOTE that it is possible that the page is not yet read from disk, though.

Parameters
[in]page_idpage id
Returns
true if found in the page hash table

◆ buf_page_peek_if_too_old()

UNIV_INLINE ibool buf_page_peek_if_too_old ( const buf_page_t bpage)

Recommends a move of a block to the start of the LRU list if there is danger of dropping from the buffer pool.

NOTE: does not reserve the LRU list mutex.

Parameters
[in]bpageblock to make younger
Returns
true if should be made younger

◆ buf_page_peek_if_young()

UNIV_INLINE ibool buf_page_peek_if_young ( const buf_page_t bpage)

Tells, for heuristics, if a block is still close enough to the MRU end of the LRU list meaning that it is not in danger of getting evicted and also implying that it has been accessed recently.

The page must be either buffer-fixed, either its page hash must be locked.

Parameters
[in]bpageblock
Returns
true if block is close to MRU end of LRU

◆ buf_page_print()

void buf_page_print ( const byte read_buf,
const page_size_t page_size,
ulint  flags 
)

Prints a page to stderr.

Parameters
[in]read_bufa database page
[in]page_sizepage size
[in]flags0 or BUF_PAGE_PRINT_NO_CRASH or BUF_PAGE_PRINT_NO_FULL

◆ buf_page_release_latch()

UNIV_INLINE void buf_page_release_latch ( buf_block_t block,
ulint  rw_latch 
)

Releases a latch, if specified.

Parameters
[in]blockbuffer block
[in]rw_latchRW_S_LATCH, RW_X_LATCH, RW_NO_LATCH

◆ buf_page_release_zip()

UNIV_INLINE void buf_page_release_zip ( buf_page_t bpage)

Releases a compressed-only page acquired with buf_page_get_zip().

in: buffer block

◆ buf_page_reset_file_page_was_freed()

buf_page_t* buf_page_reset_file_page_was_freed ( const page_id_t page_id)

Sets file_page_was_freed FALSE if the page is found in the buffer pool.

This function should be called when we free a file page and want the debug version to check that it is not accessed any more unless reallocated.

Parameters
[in]page_idpage id
Returns
control block if found in page hash table, otherwise NULL

◆ buf_page_set_accessed()

UNIV_INLINE void buf_page_set_accessed ( buf_page_t bpage)

Flag a block accessed.

in/out: control block

◆ buf_page_set_file_page_was_freed()

buf_page_t* buf_page_set_file_page_was_freed ( const page_id_t page_id)

Sets file_page_was_freed TRUE if the page is found in the buffer pool.

This function should be called when we free a file page and want the debug version to check that it is not accessed any more unless reallocated.

Parameters
[in]page_idpage id
Returns
control block if found in page hash table, otherwise NULL

◆ buf_page_set_flush_type()

UNIV_INLINE void buf_page_set_flush_type ( buf_page_t bpage,
buf_flush_t  flush_type 
)

Set the flush type of a page.

Parameters
[in]bpagebuffer page
[in]flush_typeflush type

◆ buf_page_set_io_fix()

UNIV_INLINE void buf_page_set_io_fix ( buf_page_t bpage,
enum buf_io_fix  io_fix 
)

Sets the io_fix state of a block.

Parameters
[in,out]bpagecontrol block
[in]io_fixio_fix state

◆ buf_page_set_old()

UNIV_INLINE void buf_page_set_old ( buf_page_t bpage,
ibool  old 
)

Flag a block old.

Parameters
[in,out]bpagecontrol block
[in]oldold

◆ buf_page_set_state()

UNIV_INLINE void buf_page_set_state ( buf_page_t bpage,
enum buf_page_state  state 
)

Sets the state of a block.

Parameters
[in,out]bpagepointer to control block
[in]statestate

◆ buf_page_set_sticky()

UNIV_INLINE void buf_page_set_sticky ( buf_page_t bpage)

Makes a block sticky.

A sticky block implies that even after we release the buf_pool->LRU_list_mutex and the block->mutex: it cannot be removed from the flush_list the block descriptor cannot be relocated it cannot be removed from the LRU list Note that: the block can still change its position in the LRU list the next and previous pointers can change.

Parameters
[in,out]bpagecontrol block

◆ buf_page_try_get_func()

const buf_block_t* buf_page_try_get_func ( const page_id_t page_id,
const char *  file,
ulint  line,
mtr_t mtr 
)

Given a tablespace id and page number tries to get that page.

If the page is not in the buffer pool it is not loaded and NULL is returned. Suitable for using when holding the lock_sys latches (as it avoids deadlock).

Parameters
[in]page_idpage id
[in]filefile name
[in]lineline where called
[in]mtrmini-transaction
Returns
pointer to a page or NULL

◆ buf_page_unset_sticky()

UNIV_INLINE void buf_page_unset_sticky ( buf_page_t bpage)

Removes stickiness of a block.

in/out: control block

◆ buf_pointer_is_block_field()

ibool buf_pointer_is_block_field ( const void *  ptr)

Find out if a pointer belongs to a buf_block_t.

It can be a pointer to the buf_block_t itself or a member of it

Returns
true if ptr belongs to a buf_block_t struct in: pointer not dereferenced

◆ buf_pool_adjust_chunk_unit()

ulonglong buf_pool_adjust_chunk_unit ( ulonglong  size)

Adjust the proposed chunk unit size so that it satisfies all invariants.

Parameters
[in]sizeproposed size of buffer pool chunk unit in bytes
Returns
adjusted size which meets invariants

◆ buf_pool_check_no_pending_io()

ulint buf_pool_check_no_pending_io ( void  )

Checks that there currently are no pending i/o-operations for the buffer pool.

Returns
number of pending i/o

◆ buf_pool_clear_hash_index()

void buf_pool_clear_hash_index ( void  )

Clears the adaptive hash index on all pages in the buffer pool.

◆ buf_pool_contains_zip()

buf_block_t* buf_pool_contains_zip ( buf_pool_t buf_pool,
const void *  data 
)

Finds a block in the buffer pool that points to a given compressed page.

Used only to confirm that buffer pool does not contain a given pointer, thus protected by zip_free_mutex.

Parameters
[in]buf_poolbuffer pool instance
[in]datapointer to compressed page
Returns
buffer block pointing to the compressed page, or NULL

◆ buf_pool_free_all()

void buf_pool_free_all ( )

Frees the buffer pool at shutdown.

This must not be invoked before freeing all mutexes.

Frees the buffer pool at shutdown.

◆ buf_pool_from_array()

UNIV_INLINE buf_pool_t* buf_pool_from_array ( ulint  index)

Returns the buffer pool instance given its array index.

Returns
buffer pool in: array index to get buffer pool instance from

◆ buf_pool_from_block()

UNIV_INLINE buf_pool_t* buf_pool_from_block ( const buf_block_t block)

Returns the buffer pool instance given a block instance.

Returns
buf_pool in: block

◆ buf_pool_from_bpage()

UNIV_INLINE buf_pool_t* buf_pool_from_bpage ( const buf_page_t bpage)

Returns the buffer pool instance given a page instance.

Returns
buf_pool in: buffer pool page

◆ buf_pool_get()

UNIV_INLINE buf_pool_t* buf_pool_get ( const page_id_t page_id)

Returns the buffer pool instance given a page id.

Parameters
[in]page_idpage id
Returns
buffer pool

◆ buf_pool_get_curr_size()

UNIV_INLINE ulint buf_pool_get_curr_size ( void  )

Gets the current size of buffer buf_pool in bytes.

Returns
size in bytes

◆ buf_pool_get_n_pages()

UNIV_INLINE ulint buf_pool_get_n_pages ( void  )

Gets the current size of buffer buf_pool in frames.

Returns
size in pages

◆ buf_pool_get_oldest_modification_approx()

lsn_t buf_pool_get_oldest_modification_approx ( void  )

Gets the smallest oldest_modification lsn among all of the earliest added pages in flush lists.

In other words - takes the last dirty page from each flush list, and calculates minimum oldest_modification among all of them. Does not acquire global lock for the whole process, so the result might come from inconsistent view on flush lists.

Note
Note that because of the relaxed order in each flush list, this functions no longer returns the smallest oldest_modification among all of the dirty pages. If you wanted to have a safe lsn, which is smaller than every oldest_modification, you would need to use another function: buf_pool_get_oldest_modification_lwm().

Returns zero if there were no dirty pages (flush lists were empty).

Returns
minimum oldest_modification of last pages from flush lists, zero if flush lists were empty

◆ buf_pool_get_oldest_modification_lwm()

lsn_t buf_pool_get_oldest_modification_lwm ( void  )

Gets a safe low watermark for oldest_modification.

It's guaranteed that there were no dirty pages with smaller oldest_modification in the whole flush lists.

Returns zero if flush lists were empty, be careful in such case, because taking the newest lsn is probably not a good idea. If you wanted to rely on some lsn in such case, you would need to follow pattern:

    dpa_lsn = log_buffer_dirty_pages_added_up_to_lsn(*log_sys);

    lwm_lsn = buf_pool_get_oldest_modification_lwm();

    if (lwm_lsn == 0) lwm_lsn = dpa_lsn;

The order is important to avoid race conditions.

Remarks
It's guaranteed that the returned value will not be smaller than the last checkpoint lsn. It's not guaranteed that the returned value is the maximum possible. It's just the best effort for the low cost. It basically takes result of buf_pool_get_oldest_modification_approx() and subtracts maximum possible lag introduced by relaxed order in flush lists (srv_log_recent_closed_size).
Returns
safe low watermark for oldest_modification of dirty pages, or zero if flush lists were empty; if non-zero, it is then guaranteed not to be at block boundary (and it points to lsn inside data fragment of block)

◆ buf_pool_index()

UNIV_INLINE ulint buf_pool_index ( const buf_pool_t buf_pool)

Calculates the index of a buffer pool to the buf_pool[] array.

Returns
the position of the buffer pool in buf_pool[]
Parameters
buf_poolin: buffer pool

◆ buf_pool_init()

dberr_t buf_pool_init ( ulint  total_size,
ulint  n_instances 
)

Creates the buffer pool.

Parameters
[in]total_sizeSize of the total pool in bytes.
[in]n_instancesNumber of buffer pool instances to create.
Returns
DB_SUCCESS if success, DB_ERROR if not enough memory or error

◆ buf_pool_invalidate()

void buf_pool_invalidate ( void  )

Invalidates the file pages in the buffer pool when an archive recovery is completed.

All the file pages buffered must be in a replaceable state when this function is called: not latched and not modified.

◆ buf_pool_is_obsolete()

UNIV_INLINE bool buf_pool_is_obsolete ( ulint  withdraw_clock)

Verify the possibility that a stored page is not in buffer pool.

Parameters
[in]withdraw_clockwithdraw clock when stored the page
Return values
trueif the page might be relocated

◆ buf_pool_size_align()

UNIV_INLINE ulint buf_pool_size_align ( ulint  size)

Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit, if needed.

Parameters
[in]sizesize in bytes
Returns
aligned size

◆ buf_pool_update_madvise()

void buf_pool_update_madvise ( )

Checks if innobase_should_madvise_buf_pool() value has changed since we've last check and if so, then updates buf_pool_should_madvise and calls madvise for all chunks in all srv_buf_pool_instances.

See also
buf_pool_should_madvise comment for a longer explanation.

◆ buf_pool_watch_is_sentinel()

ibool buf_pool_watch_is_sentinel ( const buf_pool_t buf_pool,
const buf_page_t bpage 
)

Determine if a block is a sentinel for a buffer pool watch.

Returns
true if a sentinel for a buffer pool watch, false if not
Parameters
[in]buf_poolbuffer pool instance
[in]bpageblock
Returns
true if a sentinel for a buffer pool watch, false if not
Parameters
buf_poolbuffer pool instance
bpagein: block

◆ buf_pool_watch_occurred()

ibool buf_pool_watch_occurred ( const page_id_t page_id)

Check if the page has been read in.

This may only be called after buf_pool_watch_set(space,offset) has returned NULL and before invoking buf_pool_watch_unset(space,offset).

Parameters
[in]page_idpage id
Returns
false if the given page was not read in, true if it was

This may only be called after buf_pool_watch_set(same_page_id) has returned NULL and before invoking buf_pool_watch_unset(same_page_id).

Parameters
[in]page_idpage id
Returns
false if the given page was not read in, true if it was

◆ buf_pool_watch_unset()

void buf_pool_watch_unset ( const page_id_t page_id)

Stop watching if the page has been read in.

buf_pool_watch_set(space,offset) must have returned NULL before.

Parameters
[in]page_idpage id

buf_pool_watch_set(same_page_id) must have returned NULL before.

Parameters
[in]page_idpage id

◆ buf_print()

void buf_print ( void  )

Prints info of the buffer pool data structure.

Prints info of the buffer pool data structure.

◆ buf_print_io()

void buf_print_io ( FILE *  file)

Prints info of the buffer i/o.

in: file where to print

Parameters
filein/out: buffer where to print

◆ buf_ptr_get_fsp_addr()

UNIV_INLINE void buf_ptr_get_fsp_addr ( const void *  ptr,
space_id_t space,
fil_addr_t addr 
)

Gets the space id, page offset, and byte offset within page of a pointer pointing to a buffer frame containing a file page.

Parameters
[in]ptrpointer to a buffer frame
[out]spacespace id
[out]addrpage offset and byte offset

◆ buf_read_page_handle_error()

void buf_read_page_handle_error ( buf_page_t bpage)

Unfixes the page, unlatches the page, removes it from page_hash and removes it from LRU.

Parameters
[in,out]bpagepointer to the block

◆ buf_refresh_io_stats_all()

void buf_refresh_io_stats_all ( void  )

Refresh the statistics used to print per-second averages.

Refresh the statistics used to print per-second averages.

◆ buf_resize_thread()

void buf_resize_thread ( )

This is the thread for resizing buffer pool.

It waits for an event and when waked up either performs a resizing and sleeps again.

◆ buf_stats_get_pool_info()

void buf_stats_get_pool_info ( buf_pool_t buf_pool,
ulint  pool_id,
buf_pool_info_t all_pool_info 
)

Collect buffer pool stats information for a buffer pool.

Also record aggregated stats if there are more than one buffer pool in the server in/out: buffer pool info to fill

Also record aggregated stats if there are more than one buffer pool in the server

Parameters
buf_poolin: buffer pool
pool_idin: buffer pool ID
all_pool_infoin/out: buffer pool info to fill

◆ buf_validate()

ibool buf_validate ( void  )

Validates the buffer pool data structure.

Returns
true

Validates the buffer pool data structure.

Returns
true

◆ buf_zip_decompress()

ibool buf_zip_decompress ( buf_block_t block,
ibool  check 
)

Decompress a block.

Returns
true if successful in: TRUE=verify the page checksum
true if successful
Parameters
blockin/out: block
checkin: TRUE=verify the page checksum

◆ operator<<()

std::ostream& operator<< ( std::ostream &  out,
const buf_pool_t buf_pool 
)

Print the given buf_pool_t object.

Parameters
[in,out]outthe output stream
[in]buf_poolthe buf_pool_t object to be printed
Returns
the output stream

Variable Documentation

◆ buf_pool_ptr

buf_pool_t* buf_pool_ptr

The buffer pools of the database.

◆ buf_pool_withdrawing

volatile bool buf_pool_withdrawing

true when withdrawing buffer pool pages might cause page relocation

◆ buf_withdraw_clock

volatile ulint buf_withdraw_clock

the clock is incremented every time a pointer to a page may become obsolete

the clock is incremented every time a pointer to a page may become obsolete

if changed, the pointer might not be in buffer pool any more.

◆ MAX_BUFFER_POOLS

constexpr ulint MAX_BUFFER_POOLS = (1 << MAX_BUFFER_POOLS_BITS)

The maximum number of buffer pools that can be defined.

◆ MAX_BUFFER_POOLS_BITS

constexpr ulint MAX_BUFFER_POOLS_BITS = 6

Number of bits to representing a buffer pool ID.

◆ MAX_PAGE_HASH_LOCKS

constexpr ulint MAX_PAGE_HASH_LOCKS = 1024

The maximum number of page_hash locks.