MySQL 9.0.0
Source Code Documentation
buf0buf.cc File Reference

The database buffer buf_pool. More...

#include "my_config.h"
#include "btr0btr.h"
#include "buf0buf.h"
#include "fil0fil.h"
#include "fsp0sysspace.h"
#include "ha_prototypes.h"
#include "mem0mem.h"
#include "my_dbug.h"
#include "page0size.h"
#include "btr0sea.h"
#include "buf0buddy.h"
#include "buf0stats.h"
#include "dict0stats_bg.h"
#include "ibuf0ibuf.h"
#include "lock0lock.h"
#include "log0buf.h"
#include "log0chkp.h"
#include "page0page.h"
#include "sync0rw.h"
#include "trx0purge.h"
#include "trx0undo.h"
#include <errno.h>
#include <stdarg.h>
#include <sys/types.h>
#include <time.h>
#include <map>
#include <new>
#include <sstream>
#include "buf0checksum.h"
#include "buf0dump.h"
#include "dict0dict.h"
#include "log0recv.h"
#include "os0thread-create.h"
#include "page0zip.h"
#include "srv0mon.h"
#include "srv0srv.h"
#include "srv0start.h"
#include "sync0sync.h"
#include "ut0new.h"
#include "scope_guard.h"
#include "ut0stateful_latching_rules.h"
#include <numa.h>
#include <numaif.h>

Classes

struct  set_numa_interleave_t
 
struct  Buf_fetch< T >
 This class implements the rules for fetching the pages from the buffer pool depending on the context. More...
 
struct  Buf_fetch_normal
 
struct  Buf_fetch_other
 
class  buf_page_t::Latching_rules_helpers
 The purpose of this class is to hide the knowledge that Buf_io_fix_latching_rules even exists from users of buf_page_t class, while also avoiding having to tediously repeat yourself in each place where buf_page_t's implementation needs to pass typical arguments to Buf_io_fix_latching_rules such as owned_latches or current state, which require access to private fields of buf_page_t. More...
 

Macros

#define NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE   set_numa_interleave_t scoped_numa
 
#define MONITOR_RW_COUNTER(io_type, counter)    ((io_type == BUF_IO_READ) ? (counter##_READ) : (counter##_WRITTEN))
 Macro to determine whether the read of write counter is used depending on the io_type. More...
 

Typedefs

typedef std::map< const byte *, buf_chunk_t *, std::less< const byte * >, ut::allocator< std::pair< const byte *const, buf_chunk_t * > > > buf_pool_chunk_map_t
 Map of buffer pool chunks by its first frame address This is newly made by initialization of buffer pool and buf_resize_thread. More...
 
using Buf_io_fix_latching_rules = ut::Stateful_latching_rules< buf_io_fix, 3 >
 

Functions

static void buf_pool_register_chunk (buf_chunk_t *chunk)
 Registers a chunk to buf_pool_chunk_map. 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...
 
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...
 
buf_block_tbuf_block_alloc (buf_pool_t *buf_pool)
 Allocates a buffer block. More...
 
void buf_page_print (const byte *read_buf, const page_size_t &page_size, ulint flags)
 Prints a page to stderr. More...
 
static void buf_block_init (buf_pool_t *buf_pool, buf_block_t *block, byte *frame)
 Initializes a buffer control block when the buf_pool is created. 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...
 
static buf_chunk_tbuf_chunk_init (buf_pool_t *buf_pool, buf_chunk_t *chunk, ulonglong mem_size, std::mutex *mutex)
 Allocates a chunk of buffer frames. More...
 
static buf_block_tbuf_chunk_contains_zip (buf_chunk_t *chunk, const void *data)
 Finds a block in the given buffer chunk that points to a given compressed page. 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...
 
static void buf_assert_all_are_replaceable (buf_chunk_t *chunk)
 Checks that all file pages in the buffer chunk are in a replaceable state. More...
 
static void buf_pool_set_sizes (void)
 Set buffer pool size variables Note: It's safe without mutex protection because of startup only. More...
 
static void buf_pool_create (buf_pool_t *buf_pool, ulint buf_pool_size, ulint instance_no, std::mutex *mutex, dberr_t &err)
 Initialize a buffer pool instance. More...
 
void buf_page_free_descriptor (buf_page_t *bpage)
 Free a buf_page_t descriptor. More...
 
static void buf_pool_free_instance (buf_pool_t *buf_pool)
 Free one buffer pool instance. More...
 
static void buf_pool_free ()
 Frees the buffer pool global data structures. More...
 
dberr_t buf_pool_init (ulint total_size, ulint n_instances)
 Creates the buffer pool. More...
 
static bool buf_page_realloc (buf_pool_t *buf_pool, buf_block_t *block)
 Reallocate a control block. More...
 
static void buf_resize_status (buf_pool_resize_status_code_t status, const char *fmt,...)
 Sets the global variable that feeds MySQL's innodb_buffer_pool_resize_status to the specified string. More...
 
static void buf_resize_status_progress_reset ()
 Reset progress in current status code. More...
 
static void buf_resize_status_progress_update (uint current_step, uint total_steps)
 Update progress in current status code. More...
 
void buf_pool_resize_wait_for_test ()
 
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...
 
static bool buf_pool_withdraw_blocks (buf_pool_t *buf_pool)
 Withdraw the buffer pool blocks from end of the buffer pool instance until withdrawn by buf_pool->withdraw_target. More...
 
static void buf_pool_resize_hash (buf_pool_t *buf_pool)
 resize page_hash and zip_hash for a buffer pool instance. More...
 
static void buf_pool_resize_chunk_make_null (buf_chunk_t **new_chunks)
 This is a debug routine to inject an memory allocation failure error. More...
 
ulonglong buf_pool_adjust_chunk_unit (ulonglong size)
 Adjust the proposed chunk unit size so that it satisfies all invariants. More...
 
static void buf_pool_resize ()
 Resize the buffer pool based on srv_buf_pool_size from srv_buf_pool_old_size. More...
 
void buf_resize_thread ()
 This is the thread for resizing buffer pool. More...
 
void buf_pool_clear_hash_index (void)
 Clears the adaptive hash index on all pages in the buffer pool. More...
 
static void buf_relocate (buf_page_t *bpage, buf_page_t *dpage)
 Relocate a buffer control block. More...
 
bool 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...
 
static buf_page_tbuf_pool_watch_set (const page_id_t &page_id, rw_lock_t **hash_lock)
 Add watch for the given page to be read in. More...
 
static void buf_pool_watch_remove (buf_pool_t *buf_pool, buf_page_t *watch)
 Remove the sentinel block for the watch before replacing it with a real block. More...
 
void buf_pool_watch_unset (const page_id_t &page_id)
 Stop watching if the page has been read in. More...
 
bool buf_pool_watch_occurred (const page_id_t &page_id)
 Check if the page has been read in. More...
 
void buf_page_make_young (buf_page_t *bpage)
 Moves a page to the start of the buffer pool LRU list. More...
 
void buf_page_make_old (buf_page_t *bpage)
 Moved a page to the end of the buffer pool LRU list so that it can be flushed out at the earliest. More...
 
static void buf_page_make_young_if_needed (buf_page_t *bpage)
 Moves a page to the start of the buffer pool LRU list if it is too old. 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...
 
static void buf_block_try_discard_uncompressed (const page_id_t &page_id)
 Attempts to discard the uncompressed frame of a compressed 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...
 
static void buf_block_init_low (buf_block_t *block)
 Initialize some fields of a control block. More...
 
bool buf_zip_decompress (buf_block_t *block, bool check)
 Decompress a block. More...
 
buf_block_tbuf_block_from_ahi (const byte *ptr)
 Get a buffer block from an adaptive hash index pointer. More...
 
bool buf_is_block_in_instance (const buf_pool_t *buf_pool, const buf_block_t *ptr)
 Find out if a block pointer points into one of currently used chunks of the buffer pool. More...
 
static bool buf_debug_execute_is_force_flush ()
 Return true if probe is enabled. More...
 
static void buf_wait_for_read (buf_block_t *block)
 Wait for the block to be read in. 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, ut::Location location, mtr_t *mtr, bool dirty_with_no_latch)
 This is the general function used to get access to a database page. 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 (const page_id_t &page_id, ut::Location location, mtr_t *mtr)
 Given a tablespace id and page number tries to get that page. More...
 
static void buf_page_init_low (buf_page_t *bpage) noexcept
 Initialize some fields of a control block. More...
 
static void buf_page_init (buf_pool_t *buf_pool, const page_id_t &page_id, const page_size_t &page_size, buf_block_t *block)
 Inits a page to the buffer buf_pool. More...
 
buf_page_tbuf_page_init_for_read (ulint mode, const page_id_t &page_id, const page_size_t &page_size, bool unzip)
 Inits a page for read to the buffer buf_pool. 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...
 
static void buf_page_monitor (const buf_page_t *bpage, enum buf_io_fix io_type)
 Monitor the buffer page read/write activity, and increment corresponding counter value if MONITOR_MODULE_BUF_PAGE (module_buf_page) module is enabled. 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...
 
bool buf_page_free_stale (buf_pool_t *buf_pool, buf_page_t *bpage) noexcept
 Free a stale page. More...
 
void buf_page_force_evict (const page_id_t &page_id, const page_size_t &page_size, const bool dirty_is_ok) noexcept
 Evict a page from the buffer pool. More...
 
bool buf_page_free_stale (buf_pool_t *buf_pool, buf_page_t *bpage, rw_lock_t *hash_lock) noexcept
 Free a stale page. More...
 
void buf_page_free_stale_during_write (buf_page_t *bpage, bool owns_sx_lock) noexcept
 Free a stale page that is being written. More...
 
static std::ostream & operator<< (std::ostream &outs, const buf_io_fix io_fix)
 Helper iostream operator presenting the io_fix value as human-readable name of the enum. More...
 
static bool sync_read_page_verify_pageid (buf_page_t *bpage, IORequest *type, fil_node_t *node)
 Fetch the page from disk using synchronous read and verify if the page_id matches the page_id in the memory buffer block. More...
 
bool buf_page_io_complete (buf_page_t *bpage, bool evict, IORequest *type, fil_node_t *node)
 Completes an asynchronous read or write request of a file page to or from the buffer pool. More...
 
static void buf_assert_all_are_replaceable (buf_pool_t *buf_pool)
 Asserts that all file pages in the buffer are in a replaceable state. More...
 
static void buf_refresh_io_stats (buf_pool_t *buf_pool)
 Refreshes the statistics used to print per-second averages. More...
 
static void buf_pool_invalidate_instance (buf_pool_t *buf_pool)
 Invalidates file pages in one buffer pool instance. More...
 
void buf_pool_invalidate (void)
 Invalidates the file pages in the buffer pool when an archive recovery is completed. More...
 
static void buf_pool_validate_instance (buf_pool_t *buf_pool)
 Validates data in one buffer pool instance. More...
 
bool buf_validate (void)
 Validates the buffer buf_pool data structure. More...
 
static void buf_print_instance (buf_pool_t *buf_pool)
 Prints info of the buffer buf_pool data structure for one instance. More...
 
void buf_print (void)
 Prints info of the buffer buf_pool data structure. More...
 
static ulint buf_get_latched_pages_number_instance (buf_pool_t *buf_pool)
 Returns the number of latched pages in the buffer pool. More...
 
ulint buf_get_latched_pages_number (void)
 Returns the number of latched pages in all the buffer pools. More...
 
ulint buf_get_n_pending_read_ios (void)
 Returns the number of pending buf pool read ios. More...
 
double buf_get_modified_ratio_pct (void)
 Returns the ratio in percents of modified pages in the buffer pool / database pages in the buffer pool. More...
 
static void buf_stats_aggregate_pool_info (buf_pool_info_t *total_info, const buf_pool_info_t *pool_info)
 Aggregates a pool stats information with the total buffer pool stats
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...
 
static void buf_print_io_instance (buf_pool_info_t *pool_info, FILE *file)
 Prints info of the buffer i/o. More...
 
void buf_print_io (FILE *file)
 Prints info of the buffer i/o. More...
 
void buf_refresh_io_stats_all ()
 Refresh the statistics used to print per-second averages. More...
 
void buf_assert_all_are_replaceable ()
 Assert that all file pages in the buffer are in a replaceable state. More...
 
size_t buf_pool_pending_io_reads_count ()
 Computes number of pending I/O read operations for the buffer pool. More...
 
size_t buf_pool_pending_io_writes_count ()
 Computes number of pending I/O write operations for the buffer pool. More...
 
void buf_pool_wait_for_no_pending_io ()
 Waits until there are no pending I/O operations for the buffer pool. More...
 
std::ostream & operator<< (std::ostream &out, const buf_pool_t &buf_pool)
 Print the given buf_pool_t object. More...
 
void buf_pool_free_all ()
 Frees the buffer pool instances and the global data structures. More...
 
bool is_buffer_pool_resize_in_progress ()
 

Variables

constexpr std::chrono::microseconds WAIT_FOR_READ {100}
 
constexpr std::chrono::microseconds WAIT_FOR_WRITE {100}
 
static const ulint BUF_PAGE_READ_MAX_RETRIES = 100
 Number of attempts made to read in a page in the buffer pool. More...
 
static const ulint BUF_READ_AHEAD_PAGES = 64
 Number of pages to read ahead. More...
 
static const ulint BUF_READ_AHEAD_PORTION = 32
 The maximum portion of the buffer pool that can be used for the read-ahead buffer. More...
 
buf_pool_tbuf_pool_ptr
 The buffer pools of the database. More...
 
volatile bool buf_pool_resizing
 true when resizing buffer pool is in the critical path. More...
 
std::atomic_uint32_t buf_pool_resize_status_code = {0}
 Atomic variables to track resize status code and progress. More...
 
std::atomic_uint32_t buf_pool_resize_status_progress = {0}
 
static buf_pool_chunk_map_tbuf_chunk_map_reg
 
buf_stat_per_index_tbuf_stat_per_index
 Container for how many pages from each index are contained in the buffer pool(s). More...
 
Buf_flush_list_added_lsns_aligned_ptr buf_flush_list_added
 Tracks adding dirty pages to the flush list. More...
 
static ulint buf_dbg_counter = 0
 This is used to insert validation operations in execution in the debug version. More...
 
bool srv_buf_pool_debug
 This is used to enable multiple buffer pool instances with small buffer pool size. More...
 
static bool buf_pool_should_madvise = false
 
Buf_io_fix_latching_rules buf_io_fix_latching_rules
 

Detailed Description

The database buffer buf_pool.

Created 11/5/1995 Heikki Tuuri

Macro Definition Documentation

◆ MONITOR_RW_COUNTER

#define MONITOR_RW_COUNTER (   io_type,
  counter 
)     ((io_type == BUF_IO_READ) ? (counter##_READ) : (counter##_WRITTEN))

Macro to determine whether the read of write counter is used depending on the io_type.

◆ NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE

#define NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE   set_numa_interleave_t scoped_numa

Typedef Documentation

◆ Buf_io_fix_latching_rules

◆ buf_pool_chunk_map_t

typedef std::map<const byte *, buf_chunk_t *, std::less<const byte *>, ut::allocator<std::pair<const byte *const, buf_chunk_t *> > > buf_pool_chunk_map_t

Map of buffer pool chunks by its first frame address This is newly made by initialization of buffer pool and buf_resize_thread.

Note: mutex protection is required when creating multiple buffer pools in parallel. We don't use a mutex during resize because that is still single threaded.

Function Documentation

◆ buf_assert_all_are_replaceable() [1/3]

void buf_assert_all_are_replaceable ( )

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

◆ buf_assert_all_are_replaceable() [2/3]

static void buf_assert_all_are_replaceable ( buf_chunk_t chunk)
static

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

Parameters
[in]chunkThe chunk to be checked

◆ buf_assert_all_are_replaceable() [3/3]

static void buf_assert_all_are_replaceable ( buf_pool_t buf_pool)
static

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

Parameters
[in]buf_poolbuffer pool instance

◆ 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
Parameters
buf_poolin/out: buffer pool instance, or NULL for round-robin selection of the buffer pool

◆ 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_init()

static void buf_block_init ( buf_pool_t buf_pool,
buf_block_t block,
byte frame 
)
static

Initializes a buffer control block when the buf_pool is created.

Parameters
buf_poolin: buffer pool instance
blockin: pointer to control block
framein: pointer to buffer frame

◆ buf_block_init_low()

static void buf_block_init_low ( buf_block_t block)
inlinestatic

Initialize some fields of a control block.

Parameters
blockin: block to init

◆ buf_block_try_discard_uncompressed()

static void buf_block_try_discard_uncompressed ( const page_id_t page_id)
static

Attempts to discard the uncompressed frame of a compressed page.

The caller should not be holding any mutexes when this function is called.

Parameters
[in]page_idpage id

◆ 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.

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_chunk_contains_zip()

static buf_block_t * buf_chunk_contains_zip ( buf_chunk_t chunk,
const void *  data 
)
static

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

Returns
buffer block pointing to the compressed page, or NULL
Parameters
chunkin: chunk being checked
datain: pointer to compressed page

◆ buf_chunk_init()

static buf_chunk_t * buf_chunk_init ( buf_pool_t buf_pool,
buf_chunk_t chunk,
ulonglong  mem_size,
std::mutex *  mutex 
)
static

Allocates a chunk of buffer frames.

If called for an existing buf_pool, its free_list_mutex must be locked.

Returns
chunk, or NULL on failure
Parameters
buf_poolin: buffer pool instance
chunkout: chunk of buffers
mem_sizein: requested size in bytes
mutexin,out: Mutex protecting chunk map.

◆ buf_debug_execute_is_force_flush()

static bool buf_debug_execute_is_force_flush ( )
static

Return true if probe is enabled.

Returns
true if probe enabled.

◆ 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.

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_latched_pages_number()

ulint buf_get_latched_pages_number ( void  )

Returns the number of latched pages in all the buffer pools.

Returns the number of latched pages in the buffer pool.

Returns
number of latched pages

◆ buf_get_latched_pages_number_instance()

static ulint buf_get_latched_pages_number_instance ( buf_pool_t buf_pool)
static

Returns the number of latched pages in the buffer pool.

Parameters
[in]buf_poolbuffer pool instance
Returns
number of latched pages

◆ buf_get_modified_ratio_pct()

double buf_get_modified_ratio_pct ( void  )

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

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_total_list_len()

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

Get total buffer pool statistics.

Parameters
[out]LRU_lenLength of all lru lists
[out]free_lenLength of all free lists
[out]flush_list_lenLength 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_is_block_in_instance()

bool buf_is_block_in_instance ( const buf_pool_t buf_pool,
const buf_block_t ptr 
)

Find out if a block pointer points into one of currently used chunks of the buffer pool.

This is useful if you stored the pointer some time ago, and want to dereference it now, and are afraid that buffer pool resize could free the memory pointed by it. Thus calling this function requires holding at least one of the latches which prevent freeing memory from buffer pool for the duration of the call and until you pin the block in some other way, as otherwise the result of this function might be obsolete by the time you dereference the block (an s-latch on buf_page_hash_lock_get for any hash cell is enough).

Parameters
buf_poolThe buffer pool instance to search in.
ptrA pointer which you want to check. This function will not dereference it.
Returns
true iff block points inside one of the chunks of the buf_pool

◆ 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_force_evict()

void buf_page_force_evict ( const page_id_t page_id,
const page_size_t page_size,
const bool  dirty_is_ok = true 
)
noexcept

Evict a page from the buffer pool.

Parameters
[in]page_idpage to be evicted.
[in]page_sizepage size of the tablespace.
[in]dirty_is_okif true, it is OK for the page to be dirty.

◆ buf_page_free_descriptor()

void buf_page_free_descriptor ( buf_page_t bpage)

Free a buf_page_t descriptor.

Parameters
[in]bpagebpage descriptor to free

◆ buf_page_free_stale() [1/2]

bool buf_page_free_stale ( buf_pool_t buf_pool,
buf_page_t bpage 
)
noexcept

Free a stale page.

Caller must hold the LRU mutex. Upon successful page free the LRU mutex will be released.

Parameters
[in,out]buf_poolBuffer pool the page belongs to.
[in,out]bpagePage to free.
Returns
true if page was freed.

◆ buf_page_free_stale() [2/2]

bool buf_page_free_stale ( buf_pool_t buf_pool,
buf_page_t bpage,
rw_lock_t hash_lock 
)
noexcept

Free a stale page.

Caller must be holding the hash_lock in S mode if hash_lock parameter is not nullptr. The hash lock will be released upon return always. Caller must hold the LRU mutex if and only if the hash_lock parameter is nullptr. Upon unsuccessful page free the LRU mutex will not be released if hash_lock is nullptr.

Parameters
[in,out]buf_poolBuffer pool the page belongs to.
[in,out]bpagePage to free.
[in,out]hash_lockHash lock covering the fetch from the hash table if latched in S mode. nullptr otherwise.
Returns
true if page was freed.

◆ buf_page_free_stale_during_write()

void buf_page_free_stale_during_write ( buf_page_t bpage,
bool  owns_sx_lock = false 
)
noexcept

Free a stale page that is being written.

The caller must be within the page's write code path.

Parameters
[in,out]bpagePage to free.
[in]owns_sx_lockSX lock on block->lock is set.

◆ 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,
ut::Location  location,
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]locationLocation from where this method was 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_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_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_init()

static void buf_page_init ( buf_pool_t buf_pool,
const page_id_t page_id,
const page_size_t page_size,
buf_block_t block 
)
static

Inits a page to the buffer buf_pool.

The block pointer must be private to the calling thread at the start of this function.

Parameters
[in,out]buf_poolbuffer pool
[in]page_idpage id
[in]page_sizepage size
[in,out]blockblock to init

◆ buf_page_init_for_read()

buf_page_t * buf_page_init_for_read ( ulint  mode,
const page_id_t page_id,
const page_size_t page_size,
bool  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
[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_init_low()

static void buf_page_init_low ( buf_page_t bpage)
staticnoexcept

Initialize some fields of a control block.

Parameters
[in,out]bpageBlock to initialize.

◆ buf_page_io_complete()

bool buf_page_io_complete ( buf_page_t bpage,
bool  evict,
IORequest type = nullptr,
fil_node_t node = nullptr 
)

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
[in]typei/o request type for which this completion routine is called.
[in]nodefile node in which the disk copy of the page exists.
Returns
true if successful

◆ buf_page_make_old()

void buf_page_make_old ( buf_page_t bpage)

Moved a page to the end of the buffer pool LRU list so that it can be flushed out at the earliest.

Parameters
[in]bpagebuffer block of a file page

◆ 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_make_young_if_needed()

static void buf_page_make_young_if_needed ( buf_page_t bpage)
static

Moves a page to the start of the buffer pool LRU list if it is too old.

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

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

◆ buf_page_monitor()

static void buf_page_monitor ( const buf_page_t bpage,
enum buf_io_fix  io_type 
)
static

Monitor the buffer page read/write activity, and increment corresponding counter value if MONITOR_MODULE_BUF_PAGE (module_buf_page) module is enabled.

Parameters
bpagein: pointer to the block
io_typein: io_fix types

◆ 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_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_realloc()

static bool buf_page_realloc ( buf_pool_t buf_pool,
buf_block_t block 
)
static

Reallocate a control block.

Parameters
[in]buf_poolbuffer pool instance
[in]blockpointer to control block
Return values
trueif succeeded or if failed because the block was fixed
falseif failed because of no free blocks.

◆ 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_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_try_get()

const buf_block_t * buf_page_try_get ( const page_id_t page_id,
ut::Location  location,
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]locationLocation where called
[in]mtrMini-transaction
Returns
pointer to a page or NULL

◆ 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_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_create()

static void buf_pool_create ( buf_pool_t buf_pool,
ulint  buf_pool_size,
ulint  instance_no,
std::mutex *  mutex,
dberr_t err 
)
static

Initialize a buffer pool instance.

Parameters
[in]buf_poolbuffer pool instance
[in]buf_pool_sizesize in bytes
[in]instance_noid of the instance
[in,out]mutexMutex to protect common data structures
[out]errDB_SUCCESS if all goes well

◆ buf_pool_free()

static void buf_pool_free ( )
static

Frees the buffer pool global data structures.

◆ buf_pool_free_all()

void buf_pool_free_all ( )

Frees the buffer pool instances and the global data structures.

Frees the buffer pool at shutdown.

◆ buf_pool_free_instance()

static void buf_pool_free_instance ( buf_pool_t buf_pool)
static

Free one buffer pool instance.

Parameters
[in]buf_poolbuffer pool instance to free

◆ 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 = buf_flush_list_added->smallest_not_added_lsn();

    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_buf_flush_list_added_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_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_invalidate_instance()

static void buf_pool_invalidate_instance ( buf_pool_t buf_pool)
static

Invalidates file pages in one buffer pool instance.

Parameters
[in]buf_poolbuffer pool instance

◆ buf_pool_pending_io_reads_count()

size_t buf_pool_pending_io_reads_count ( )

Computes number of pending I/O read operations for the buffer pool.

Returns
number of pending i/o reads

◆ buf_pool_pending_io_writes_count()

size_t buf_pool_pending_io_writes_count ( )

Computes number of pending I/O write operations for the buffer pool.

Returns
number of pending i/o writes

◆ buf_pool_register_chunk()

static void buf_pool_register_chunk ( buf_chunk_t chunk)
static

Registers a chunk to buf_pool_chunk_map.

Parameters
[in]chunkchunk of buffers

◆ buf_pool_resize()

static void buf_pool_resize ( )
static

Resize the buffer pool based on srv_buf_pool_size from srv_buf_pool_old_size.

◆ buf_pool_resize_chunk_make_null()

static void buf_pool_resize_chunk_make_null ( buf_chunk_t **  new_chunks)
static

This is a debug routine to inject an memory allocation failure error.

◆ buf_pool_resize_hash()

static void buf_pool_resize_hash ( buf_pool_t buf_pool)
static

resize page_hash and zip_hash for a buffer pool instance.

Parameters
[in]buf_poolbuffer pool instance

◆ buf_pool_resize_wait_for_test()

void buf_pool_resize_wait_for_test ( )

◆ buf_pool_set_sizes()

static void buf_pool_set_sizes ( void  )
static

Set buffer pool size variables Note: It's safe without mutex protection because of startup only.

◆ 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_validate_instance()

static void buf_pool_validate_instance ( buf_pool_t buf_pool)
static

Validates data in one buffer pool instance.

Parameters
[in]buf_poolbuffer pool instance

◆ buf_pool_wait_for_no_pending_io()

void buf_pool_wait_for_no_pending_io ( )

Waits until there are no pending I/O operations for the buffer pool.

Keep waiting in loop with sleeps, emitting information every minute. This is used to avoid risk of some pending async IO (e.g. enqueued by the linear read-ahead), which would involve ibuf merge and create new redo records.

◆ buf_pool_watch_is_sentinel()

bool 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.

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

◆ buf_pool_watch_occurred()

bool 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(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_remove()

static void buf_pool_watch_remove ( buf_pool_t buf_pool,
buf_page_t watch 
)
static

Remove the sentinel block for the watch before replacing it with a real block.

buf_page_watch_unset() or buf_page_watch_occurred() will notice that the block has been replaced with the real block.

Parameters
[in,out]buf_poolbuffer pool instance
[in,out]watchsentinel for watch

◆ buf_pool_watch_set()

static buf_page_t * buf_pool_watch_set ( const page_id_t page_id,
rw_lock_t **  hash_lock 
)
static

Add watch for the given page to be read in.

Caller must have appropriate hash_lock for the bpage and hold the LRU list mutex to avoid a race condition with buf_LRU_free_page inserting the same page into the page hash. This function may release the hash_lock and reacquire it.

Parameters
[in]page_idpage id
[in,out]hash_lockhash_lock currently latched
Returns
NULL if watch set, block if the page is in the buffer pool

◆ 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(same_page_id) must have returned NULL before.

Parameters
[in]page_idpage id

◆ buf_pool_withdraw_blocks()

static bool buf_pool_withdraw_blocks ( buf_pool_t buf_pool)
static

Withdraw the buffer pool blocks from end of the buffer pool instance until withdrawn by buf_pool->withdraw_target.

Parameters
[in]buf_poolbuffer pool instance
Return values
trueif retry is needed

◆ buf_print()

void buf_print ( void  )

Prints info of the buffer buf_pool data structure.

Prints info of the buffer pool data structure.

◆ buf_print_instance()

static void buf_print_instance ( buf_pool_t buf_pool)
static

Prints info of the buffer buf_pool data structure for one instance.

Parameters
[in]buf_poolbuffer pool instance

◆ 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_print_io_instance()

static void buf_print_io_instance ( buf_pool_info_t pool_info,
FILE *  file 
)
static

Prints info of the buffer i/o.

Parameters
pool_infoin: buffer pool info
filein/out: buffer where to print

◆ 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()

static void buf_refresh_io_stats ( buf_pool_t buf_pool)
static

Refreshes the statistics used to print per-second averages.

Parameters
[in,out]buf_poolbuffer pool instance

◆ buf_refresh_io_stats_all()

void buf_refresh_io_stats_all ( )

Refresh the statistics used to print per-second averages.

◆ buf_relocate()

static void buf_relocate ( buf_page_t bpage,
buf_page_t dpage 
)
static

Relocate a buffer control block.

Relocates the block on the LRU list and in buf_pool->page_hash. Does not relocate bpage->list. The caller must take care of relocating bpage->list.

Parameters
[in,out]bpagecontrol block being relocated, buf_page_get_state() must be BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_ZIP_PAGE
[in,out]dpagedestination control block

◆ buf_resize_status()

static void buf_resize_status ( buf_pool_resize_status_code_t  status,
const char *  fmt,
  ... 
)
static

Sets the global variable that feeds MySQL's innodb_buffer_pool_resize_status to the specified string.

The format and the following parameters are the same as the ones used for printf(3).

Parameters
[in]statusstatus code
[in]fmtformat
[in]...extra parameters according to fmt

◆ buf_resize_status_progress_reset()

static void buf_resize_status_progress_reset ( )
static

Reset progress in current status code.

This indicates beginning of a new status code

◆ buf_resize_status_progress_update()

static void buf_resize_status_progress_update ( uint  current_step,
uint  total_steps 
)
static

Update progress in current status code.

Parameters
[in]current_stepcurrent step that is complete.
[in]total_stepssteps to complete before moving to next status code

◆ 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_aggregate_pool_info()

static void buf_stats_aggregate_pool_info ( buf_pool_info_t total_info,
const buf_pool_info_t pool_info 
)
static

Aggregates a pool stats information with the total buffer pool stats

Parameters
total_infoin/out: the buffer pool info to store aggregated result
pool_infoin: individual buffer pool stats info

◆ 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

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

◆ buf_validate()

bool buf_validate ( void  )

Validates the buffer buf_pool data structure.

Validates the buffer pool data structure.

Returns
true

◆ buf_wait_for_read()

static void buf_wait_for_read ( buf_block_t block)
static

Wait for the block to be read in.

Parameters
[in]blockThe block to check

◆ buf_zip_decompress()

bool buf_zip_decompress ( buf_block_t block,
bool  check 
)

Decompress a block.

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

◆ is_buffer_pool_resize_in_progress()

bool is_buffer_pool_resize_in_progress ( )
Returns
true if buffer pool resize is in progress.

◆ operator<<() [1/2]

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

◆ operator<<() [2/2]

static std::ostream & operator<< ( std::ostream &  outs,
const buf_io_fix  io_fix 
)
static

Helper iostream operator presenting the io_fix value as human-readable name of the enum.

Used in error messages of Buf_io_fix_latching_rules.

Parameters
[in]outsthe output stream to which to print
[in]io_fixthe value to be printed
Returns
always equals the stream passed as the outs argument

◆ sync_read_page_verify_pageid()

static bool sync_read_page_verify_pageid ( buf_page_t bpage,
IORequest type,
fil_node_t node 
)
static

Fetch the page from disk using synchronous read and verify if the page_id matches the page_id in the memory buffer block.

Parameters
[in]bpagethe buffer block page
[in]typei/o context object
[in]nodefile where the page is available on disk.
Returns
true if page id is wrong in the frame.
false if page id is correct in the frame.

Variable Documentation

◆ buf_chunk_map_reg

buf_pool_chunk_map_t* buf_chunk_map_reg
static

◆ buf_dbg_counter

ulint buf_dbg_counter = 0
static

This is used to insert validation operations in execution in the debug version.

◆ buf_flush_list_added

Tracks adding dirty pages to the flush list.

The life cycle of this object is constraint to the life of buffer pool

◆ buf_io_fix_latching_rules

Buf_io_fix_latching_rules buf_io_fix_latching_rules
Initial value:
{
{
{BUF_IO_NONE, {0, 1, 2}, BUF_IO_WRITE},
{BUF_IO_WRITE, {0, 1, 2}, BUF_IO_NONE},
},
}
@ BUF_IO_NONE
no pending I/O
Definition: buf0types.h:101
@ BUF_IO_WRITE
write pending
Definition: buf0types.h:107
@ BUF_IO_READ
read pending
Definition: buf0types.h:104
@ BUF_IO_PIN
disallow relocation of block and its removal from the flush_list
Definition: buf0types.h:110

◆ BUF_PAGE_READ_MAX_RETRIES

const ulint BUF_PAGE_READ_MAX_RETRIES = 100
static

Number of attempts made to read in a page in the buffer pool.

◆ buf_pool_ptr

buf_pool_t* buf_pool_ptr

The buffer pools of the database.

◆ buf_pool_resize_status_code

std::atomic_uint32_t buf_pool_resize_status_code = {0}

Atomic variables to track resize status code and progress.

Buffer pool resize status code and progress are tracked using these atomic variables to ensure thread synchronization between innodb_buffer_pool_size_update (raising srv_buf_resize_event) and buf_resize_thread (handling srv_buf_resize_event)

◆ buf_pool_resize_status_progress

std::atomic_uint32_t buf_pool_resize_status_progress = {0}

◆ buf_pool_resizing

volatile bool buf_pool_resizing

true when resizing buffer pool is in the critical path.

◆ buf_pool_should_madvise

bool buf_pool_should_madvise = false
static

◆ BUF_READ_AHEAD_PAGES

const ulint BUF_READ_AHEAD_PAGES = 64
static

Number of pages to read ahead.

◆ BUF_READ_AHEAD_PORTION

const ulint BUF_READ_AHEAD_PORTION = 32
static

The maximum portion of the buffer pool that can be used for the read-ahead buffer.

(Divide buf_pool size by this amount)

◆ buf_stat_per_index

buf_stat_per_index_t* buf_stat_per_index

Container for how many pages from each index are contained in the buffer pool(s).

◆ srv_buf_pool_debug

bool srv_buf_pool_debug

This is used to enable multiple buffer pool instances with small buffer pool size.

◆ WAIT_FOR_READ

constexpr std::chrono::microseconds WAIT_FOR_READ {100}
constexpr

◆ WAIT_FOR_WRITE

constexpr std::chrono::microseconds WAIT_FOR_WRITE {100}
constexpr