112#define BUF_POOL_WATCH_SIZE (srv_n_purge_threads + 1)
256#ifndef UNIV_HOTBACKUP
354#ifndef UNIV_HOTBACKUP
382#ifndef UNIV_HOTBACKUP
448 bool dirty_with_no_latch =
false);
495#ifndef UNIV_HOTBACKUP
623#ifndef UNIV_HOTBACKUP
649#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
654#if defined UNIV_DEBUG_PRINT || defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
678#ifndef UNIV_HOTBACKUP
740#define buf_block_dbg_add_level(block, level)
770#ifndef UNIV_HOTBACKUP
851[[nodiscard]]
static inline std::chrono::steady_clock::time_point
871#define buf_block_get_frame(block) (block)->frame
874#define buf_block_get_frame(block) (block)->frame
899#ifndef UNIV_HOTBACKUP
942 const bool dirty_is_ok =
true) noexcept;
959 bool owns_sx_lock = false) noexcept;
1012 bool watch = false);
1101 ulint *flush_list_len);
1137 bool skip_lsn_check);
1154template <
typename T>
1158 :
std::atomic<T>(other.
load(
std::memory_order_relaxed)) {}
1174#ifndef UNIV_HOTBACKUP
1182#ifndef UNIV_HOTBACKUP
1202#ifndef UNIV_HOTBACKUP
1212 [[nodiscard]]
static bool is_memory(
const page_t *
const ptr)
noexcept;
1220#ifndef UNIV_HOTBACKUP
1244 ut_a(m_version <= m_space->get_current_version());
1267 ut_a(was_not_deleted);
1505 return io_fix.load(std::memory_order_relaxed);
1607 "MAX_BUFFER_POOLS > 64; redefine buf_pool_index");
1610#ifndef UNIV_HOTBACKUP
1667#ifndef UNIV_HOTBACKUP
1757 return !(*
this == other);
1770#ifndef UNIV_HOTBACKUP
1819 static_assert(
decltype(
prefix_info)::is_always_lock_free);
1836#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
1860 ut_a(this->index.load() !=
nullptr || this->n_pointers.load() == 0 ||
1861 this->index.load() !=
nullptr);
1895#ifndef UNIV_HOTBACKUP
1929#if defined(UNIV_DEBUG) && !defined(UNIV_LIBRARY) && !defined(UNIV_HOTBACKUP)
1965#ifndef UNIV_HOTBACKUP
2150 :
LRUHp(buf_pool, mutex) {}
2227 dst.n_pages_read.store(src.n_pages_read.load());
2229 dst.n_pages_written.store(src.n_pages_written.load());
2231 dst.n_pages_created.store(src.n_pages_created.load());
2233 dst.n_ra_pages_read_rnd.store(src.n_ra_pages_read_rnd.load());
2235 dst.n_ra_pages_read.store(src.n_ra_pages_read.load());
2237 dst.n_ra_pages_evicted = src.n_ra_pages_evicted;
2239 dst.n_pages_made_young = src.n_pages_made_young;
2241 dst.n_pages_not_made_young = src.n_pages_not_made_young;
2243 dst.LRU_bytes = src.LRU_bytes;
2245 dst.flush_list_bytes = src.flush_list_bytes;
2501#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
2556#ifndef UNIV_HOTBACKUP
2563 template <
typename F>
2568 std::forward<F>(change)();
2570 if (was_set && !should_be_set) {
2572 }
else if (!was_set && should_be_set) {
2581 "BUF_BUDDY_LOW > UNIV_ZIP_SIZE_MIN");
2595#ifndef UNIV_HOTBACKUP
2597#define buf_flush_list_mutex_own(b) mutex_own(&(b)->flush_list_mutex)
2600#define buf_flush_list_mutex_enter(b) \
2602 mutex_enter(&(b)->flush_list_mutex); \
2605#define buf_flush_list_mutex_exit(b) \
2607 mutex_exit(&(b)->flush_list_mutex); \
2610#define buf_page_mutex_enter(b) \
2612 mutex_enter(&(b)->mutex); \
2616#define buf_page_mutex_exit(b) \
2618 (b)->mutex.exit(); \
2641#if defined(UNIV_DEBUG) && !defined(UNIV_HOTBACKUP)
2677#define buf_page_hash_lock_held_s(b, p) (true)
2678#define buf_page_hash_lock_held_x(b, p) (true)
2679#define buf_page_hash_lock_held_s_or_x(b, p) (true)
2680#define buf_block_hash_lock_held_s(b, p) (true)
2681#define buf_block_hash_lock_held_x(b, p) (true)
2682#define buf_block_hash_lock_held_s_or_x(b, p) (true)
2731#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
2732#ifndef UNIV_HOTBACKUP
2767#ifndef UNIV_HOTBACKUP
2771 bpage->reset_page_id();
2779 return block->get_page_zip();
2788 return block->get_page_zip();
2813 if (page_type !=
type) {
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:48
uint32_t page_no_t
Page number.
Definition: api0api.h:46
Cache_hint
Definition: buf0buf.h:94
@ MAKE_YOUNG
Move the block to the start of the LRU list if there is a danger that the block would drift out of th...
@ KEEP_OLD
Preserve the current LRU position of the block.
static 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.
bool buf_block_hash_lock_held_x(const buf_pool_t *buf_pool, const buf_block_t *block)
Definition: buf0buf.h:2667
static 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,...
static bool buf_page_belongs_to_unzip_LRU(const buf_page_t *bpage)
Determines if a block should be on unzip_LRU list.
static bool buf_page_can_relocate(const buf_page_t *bpage)
Determine if a buffer block can be relocated in memory.
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).
Definition: buf0buf.cc:3324
dberr_t buf_pool_init(ulint total_size, ulint n_instances)
Creates the buffer pool.
Definition: buf0buf.cc:1509
void buf_page_print(const byte *read_buf, const page_size_t &page_size, ulint flags)
Prints a page to stderr.
Definition: buf0buf.cc:611
ulint buf_get_n_pending_read_ios(void)
Returns the number of pending buf pool read ios.
Definition: buf0buf.cc:6573
bool buf_page_hash_lock_held_s_or_x(const buf_pool_t *buf_pool, const buf_page_t *bpage)
Test if page_hash lock is held in x or s-mode.
Definition: buf0buf.h:2656
static ulint buf_pool_get_curr_size(void)
Gets the current size of buffer buf_pool in bytes.
ulint buf_page_hash_lock_held_x(const buf_pool_t *buf_pool, const buf_page_t *bpage)
Test if page_hash lock is held in x-mode.
Definition: buf0buf.h:2649
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.
Definition: buf0buf.cc:5450
bool buf_validate(void)
Validates the buffer pool data structure.
Definition: buf0buf.cc:6359
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.
Definition: buf0flu.cc:941
static enum buf_page_state buf_block_get_state(const buf_block_t *block)
Gets the state of a block.
static void buf_page_set_state(buf_page_t *bpage, enum buf_page_state state)
Sets the state of a block.
buf_block_t * buf_block_from_ahi(const byte *ptr)
Get a buffer block from an adaptive hash index pointer.
Definition: buf0buf.cc:3543
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.
Definition: buf0buf.cc:5811
lsn_t buf_pool_get_oldest_modification_lwm(void)
Gets a safe low watermark for oldest_modification.
Definition: buf0buf.cc:484
bool buf_frame_will_withdrawn(buf_pool_t *buf_pool, const byte *ptr)
Determines if a frame is intended to be withdrawn.
Definition: buf0buf.cc:1887
void buf_pool_update_madvise()
Checks if innobase_should_madvise_buf_pool() value has changed since we've last check and if so,...
Definition: buf0buf.cc:1016
ulonglong buf_pool_adjust_chunk_unit(ulonglong size)
Adjust the proposed chunk unit size so that it satisfies all invariants.
Definition: buf0buf.cc:2156
static 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.
static enum buf_io_fix buf_page_get_io_fix(const buf_page_t *bpage)
Gets the io_fix state of a block.
static void buf_page_set_io_fix(buf_page_t *bpage, enum buf_io_fix io_fix)
Sets the io_fix state of a block.
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.
Definition: buf0buf.cc:3237
static void buf_page_set_accessed(buf_page_t *bpage)
Flag a block accessed.
static void buf_block_set_io_fix(buf_block_t *block, enum buf_io_fix io_fix)
Sets the io_fix state of a block.
void buf_page_make_young(buf_page_t *bpage)
Moves a page to the start of the buffer pool LRU list.
Definition: buf0buf.cc:3191
buf_pool_t * buf_pool_ptr
The buffer pools of the database.
Definition: buf0buf.cc:306
void buf_pool_clear_hash_index(void)
Clears the adaptive hash index on all pages in the buffer pool.
Definition: buf0buf.cc:2729
void buf_get_total_stat(buf_pool_stat_t *tot_stat)
Get total buffer pool statistics.
Definition: buf0buf.cc:556
static buf_pool_t * buf_pool_from_bpage(const buf_page_t *bpage)
Returns the buffer pool instance given a page instance.
static buf_flush_t buf_page_get_flush_type(const buf_page_t *bpage)
Get the flush type of a page.
static ulint buf_page_get_freed_page_clock(const buf_page_t *bpage)
Reads the freed_page_clock of a buffer block.
ulint buf_page_hash_lock_held_s(const buf_pool_t *buf_pool, const buf_page_t *bpage)
Test if page_hash lock is held in s-mode.
Definition: buf0buf.h:2643
static std::chrono::steady_clock::time_point buf_page_is_accessed(const buf_page_t *bpage)
Determine the time of first access of a block in the buffer pool.
constexpr ulint MAX_PAGE_HASH_LOCKS
The maximum number of page_hash locks.
Definition: buf0buf.h:115
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.
Definition: buf0buf.cc:4532
void buf_pool_watch_unset(const page_id_t &page_id)
Stop watching if the page has been read in.
Definition: buf0buf.cc:3140
static byte * buf_frame_copy(byte *buf, const buf_frame_t *frame)
Copies contents of a buffer frame to a given buffer.
void buf_assert_all_are_replaceable()
Assert that all file pages in the buffer are in a replaceable state.
Definition: buf0buf.cc:6922
bool buf_pool_watch_occurred(const page_id_t &page_id)
Check if the page has been read in.
Definition: buf0buf.cc:3167
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.
Definition: buf0buf.cc:4896
static bool 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 i...
bool buf_page_free_stale(buf_pool_t *buf_pool, buf_page_t *bpage) noexcept
Free a stale page.
Definition: buf0buf.cc:5417
buf_page_t * buf_page_hash_get_x_locked(buf_pool_t *b, const page_id_t &page_id, rw_lock_t **l)
Definition: buf0buf.h:1045
static void buf_page_set_old(buf_page_t *bpage, bool old)
Flag a block old.
size_t buf_pool_pending_io_reads_count()
Computes number of pending I/O read operations for the buffer pool.
Definition: buf0buf.cc:6928
size_t buf_pool_pending_io_writes_count()
Computes number of pending I/O write operations for the buffer pool.
Definition: buf0buf.cc:6936
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.
Definition: buf0buf.cc:5382
static ulint buf_block_unfix(buf_page_t *bpage)
Decrements the bufferfix count.
static void buf_page_set_flush_type(buf_page_t *bpage, buf_flush_t flush_type)
Set the flush type of a page.
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.
Definition: buf0buf.cc:5558
static buf_pool_t * buf_pool_from_block(const buf_block_t *block)
Returns the buffer pool instance given a block 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.
Definition: buf0buf.cc:3579
rw_lock_t * buf_page_hash_lock_get(const buf_pool_t *buf_pool, const page_id_t page_id)
Get appropriate page_hash_lock.
Definition: buf0buf.h:2622
std::ostream & operator<<(std::ostream &out, const buf_pool_t &buf_pool)
Print the given buf_pool_t object.
Definition: buf0buf.cc:7009
static BPageMutex * buf_page_get_mutex(const buf_page_t *bpage)
Gets the mutex of a block.
static uint64_t buf_pool_hash_zip_frame(void *ptr)
Compute the hash value for blocks in buf_pool->zip_hash.
Definition: buf0buf.h:2032
static buf_frame_t * buf_block_get_frame(const buf_block_t *block)
Gets a pointer to the memory frame of a block.
void buf_block_reset_page_type_on_mismatch(buf_block_t &block, page_type_t type, mtr_t &mtr)
Verify the page contained by the block.
Definition: buf0buf.h:2808
void buf_pool_free_all()
Frees the buffer pool at shutdown.
Definition: buf0buf.cc:7043
static enum buf_page_state buf_page_get_state(const buf_page_t *bpage)
Gets the state of a block.
static ulint buf_pool_index(const buf_pool_t *buf_pool)
Calculates the index of a buffer pool to the buf_pool[] array.
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.
Definition: buf0buf.cc:4465
ulint buf_get_free_list_len(void)
Gets the current length of the free list of buffer blocks.
rw_lock_t * buf_page_hash_lock_x_confirm(rw_lock_t *hash_lock, buf_pool_t *buf_pool, const page_id_t &page_id)
Definition: buf0buf.h:2634
static lsn_t buf_page_get_newest_modification(const buf_page_t *bpage)
Gets the youngest modification log sequence number for a frame.
ulint buf_get_latched_pages_number(void)
Returns the number of latched pages in the buffer pool.
Definition: buf0buf.cc:6554
static 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.
static ulint buf_block_fix(buf_page_t *bpage)
Increments the bufferfix count.
constexpr ulint MAX_BUFFER_POOLS
The maximum number of buffer pools that can be defined.
Definition: buf0buf.h:109
static 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.
void buf_print_io(FILE *file)
Prints info of the buffer i/o.
Definition: buf0buf.cc:6850
static buf_pool_t * buf_pool_from_array(ulint index)
Returns the buffer pool instance given its array index.
static void buf_page_release_latch(buf_block_t *block, ulint rw_latch)
Releases a latch, if specified.
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.
Definition: buf0buf.cc:6657
void buf_resize_thread()
This is the thread for resizing buffer pool.
Definition: buf0buf.cc:2702
void buf_print(void)
Prints info of the buffer pool data structure.
Definition: buf0buf.cc:6460
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.
Definition: buf0buf.cc:4725
static ulint buf_block_get_freed_page_clock(const buf_block_t *block)
Reads the freed_page_clock of a buffer block.
static 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 c...
static bool 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 buf...
bool buf_block_will_withdrawn(buf_pool_t *buf_pool, const buf_block_t *block)
Determines if a block is intended to be withdrawn.
Definition: buf0buf.cc:1866
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.
Definition: buf0buf.cc:3203
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.
Definition: buf0buf.cc:431
buf_block_t * buf_block_hash_get_s_locked(buf_pool_t *b, const page_id_t &page_id, rw_lock_t **l)
Definition: buf0buf.h:1058
Page_fetch
Definition: buf0buf.h:58
@ NO_LATCH
get and bufferfix, but set no latch; we have separated this case, because it is error-prone programmi...
@ IF_IN_POOL
get if in pool
@ POSSIBLY_FREED_NO_READ_AHEAD
Like Page_fetch::POSSIBLY_FREED, but do not initiate read ahead.
@ 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.
@ PEEK_IF_IN_POOL
get if in pool, do not make the block young in the LRU list
@ POSSIBLY_FREED
Like Page_fetch::NORMAL, but do not mind if the file page has been freed.
@ SCAN
Same as NORMAL, but hint that the fetch is part of a large scan.
rw_lock_t * buf_page_hash_lock_s_confirm(rw_lock_t *hash_lock, const buf_pool_t *buf_pool, const page_id_t page_id)
If not appropriate page_hash_lock, relock until appropriate.
Definition: buf0buf.h:2628
static void buf_page_unset_sticky(buf_page_t *bpage)
Removes stickiness of a block.
buf_page_print_flags
Definition: buf0buf.h:659
@ BUF_PAGE_PRINT_NO_FULL
Do not print the full page dump.
Definition: buf0buf.h:663
@ BUF_PAGE_PRINT_NO_CRASH
Do not crash at the end of buf_page_print().
Definition: buf0buf.h:661
buf_page_t * buf_page_get_also_watch(buf_pool_t *b, const page_id_t &page_id)
Definition: buf0buf.h:1053
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.
Definition: buf0buf.cc:2985
buf_block_t * buf_page_get_with_no_latch(const page_id_t &id, const page_size_t &size, ut::Location location, mtr_t *mtr)
Use these macros to bufferfix a page with no latching.
Definition: buf0buf.h:464
constexpr ulint MAX_BUFFER_POOLS_BITS
Number of bits to representing a buffer pool ID.
Definition: buf0buf.h:106
bool buf_block_hash_lock_held_s(const buf_pool_t *buf_pool, const buf_block_t *block)
Definition: buf0buf.h:2662
buf_block_t * buf_block_hash_get(buf_pool_t *b, const page_id_t &page_id)
Definition: buf0buf.h:1068
bool buf_page_in_memory(const buf_page_t *bpage)
Definition: buf0buf.h:2791
bool is_buffer_pool_resize_in_progress()
Definition: buf0buf.cc:7053
static bool buf_page_peek(const page_id_t &page_id)
Returns true if the page can be found in the buffer pool hash table.
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.
Definition: buf0buf.cc:4632
buf_page_t * buf_page_hash_get_s_locked(buf_pool_t *b, const page_id_t &page_id, rw_lock_t **l)
Definition: buf0buf.h:1040
static void buf_page_release_zip(buf_page_t *bpage)
Releases a compressed-only page acquired with buf_page_get_zip().
static void buf_block_free(buf_block_t *block)
Frees a buffer block which does not contain a file page.
static uint64_t buf_pool_hash_zip(buf_block_t *b)
Definition: buf0buf.h:2036
buf_page_t * buf_page_hash_get(buf_pool_t *b, const page_id_t &page_id)
Definition: buf0buf.h:1050
static void buf_block_set_state(buf_block_t *block, enum buf_page_state state)
Sets the state of a block.
constexpr uint32_t BUF_PAGE_STATE_BITS
The common buffer control block structure for compressed and uncompressed frames.
Definition: buf0buf.h:1152
static void buf_block_buf_fix_inc_func(ut::Location location, buf_block_t *block)
Increments the bufferfix count.
static buf_pool_t * buf_pool_get(const page_id_t &page_id)
Returns the buffer pool instance given a page id.
static 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 cur...
buf_page_state
States of a control block.
Definition: buf0buf.h:131
@ BUF_BLOCK_NOT_USED
Is in the free list; must be after the BUF_BLOCK_ZIP_ constants for compressed-only pages.
Definition: buf0buf.h:141
@ BUF_BLOCK_ZIP_PAGE
Contains a clean compressed page.
Definition: buf0buf.h:135
@ BUF_BLOCK_REMOVE_HASH
Hash index should be removed before putting to the free list.
Definition: buf0buf.h:153
@ BUF_BLOCK_MEMORY
Contains some main memory object.
Definition: buf0buf.h:150
@ BUF_BLOCK_ZIP_DIRTY
Contains a compressed page that is in the buf_pool->flush_list.
Definition: buf0buf.h:137
@ BUF_BLOCK_POOL_WATCH
A sentinel for the buffer pool watch, element of buf_pool->watch[].
Definition: buf0buf.h:133
@ BUF_BLOCK_READY_FOR_USE
When buf_LRU_get_free_block returns a block, it is in this state.
Definition: buf0buf.h:144
@ BUF_BLOCK_FILE_PAGE
Contains a buffered file page.
Definition: buf0buf.h:147
void buf_refresh_io_stats_all()
Refresh the statistics used to print per-second averages.
Definition: buf0buf.cc:6912
static ulint buf_pool_get_n_pages(void)
Gets the current size of buffer buf_pool in frames.
buf_block_t * buf_block_alloc(buf_pool_t *buf_pool)
Allocates a buffer block.
Definition: buf0buf.cc:582
static 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.
static ulint buf_pool_size_align(ulint size)
Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit, if needed.
buf_block_t * buf_page_get(const page_id_t &id, const page_size_t &size, ulint latch, ut::Location location, mtr_t *mtr)
NOTE! The following macros should be used instead of buf_page_get_gen, to improve debugging.
Definition: buf0buf.h:453
static void buf_block_modify_clock_inc(buf_block_t *block)
Increment the modify clock.
static bool buf_page_in_file(const buf_page_t *bpage)
Determines if a block is mapped to a tablespace.
page_zip_des_t * buf_block_get_page_zip(buf_block_t *block) noexcept
Gets the compressed page descriptor corresponding to an uncompressed page if applicable.
Definition: buf0buf.h:2778
void buf_pool_invalidate(void)
Invalidates the file pages in the buffer pool when an archive recovery is completed.
Definition: buf0buf.cc:6165
void buf_page_free_descriptor(buf_page_t *bpage)
Free a buf_page_t descriptor.
Definition: buf0buf.cc:1424
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.
Definition: buf0buf.cc:5102
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...
Definition: buf0buf.cc:6587
static buf_frame_t * buf_frame_align(byte *ptr)
void buf_page_prepare_for_free(buf_page_t *bpage) noexcept
Prepare a page before adding to the free list.
Definition: buf0buf.h:2770
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.
Definition: buf0buf.cc:1173
static void buf_block_set_file_page(buf_block_t *block, const page_id_t &page_id)
Map a block to a file page.
void buf_pool_wait_for_no_pending_io()
Waits until there are no pending I/O operations for the buffer pool.
Definition: buf0buf.cc:6948
static buf_page_t * buf_page_alloc_descriptor(void)
Allocates a buf_page_t descriptor.
static enum buf_io_fix buf_block_get_io_fix(const buf_block_t *block)
Gets the io_fix state of a block.
bool buf_block_hash_lock_held_s_or_x(const buf_pool_t *buf_pool, const buf_block_t *block)
Definition: buf0buf.h:2672
bool buf_block_state_valid(buf_block_t *block)
Check if a buf_block_t object is in a valid state.
Definition: buf0buf.h:2025
buf_block_t * buf_block_hash_get_x_locked(buf_pool_t *b, const page_id_t &page_id, rw_lock_t **l)
Definition: buf0buf.h:1063
const std::unordered_map< buf_page_state, std::string_view > buf_page_state_str
Definition: buf0buf.h:156
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.
Definition: buf0buf.cc:3263
static bool buf_page_is_old(const buf_page_t *bpage)
Determine if a block has been flagged old.
void buf_block_buf_fix_inc(buf_block_t *b, ut::Location l)
Increments the bufferfix count.
Definition: buf0buf.h:615
static void buf_page_set_sticky(buf_page_t *bpage)
Makes a block sticky.
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.
Definition: buf0buf.cc:535
void buf_get_total_list_len(ulint *LRU_len, ulint *free_len, ulint *flush_list_len)
Get total buffer pool statistics.
Definition: buf0buf.cc:515
bool buf_zip_decompress(buf_block_t *block, bool check)
Decompress a block.
Definition: buf0buf.cc:3475
The database buffer buf_pool.
The database buffer pool global types for the directory.
byte buf_frame_t
A buffer frame.
Definition: buf0types.h:62
BPageMutex BufPoolZipMutex
Definition: buf0types.h:201
constexpr uint32_t BUF_BUDDY_LOW
Smallest buddy page size.
Definition: buf0types.h:183
constexpr uint32_t BUF_BUDDY_SIZES_MAX
Maximum number of buddy sizes based on the max page size.
Definition: buf0types.h:189
buf_flush_t
Flags for flush types.
Definition: buf0types.h:68
@ BUF_FLUSH_N_TYPES
Index of last element + 1
Definition: buf0types.h:79
ib_mutex_t BufListMutex
Definition: buf0types.h:199
ib_bpmutex_t BPageMutex
Definition: buf0types.h:198
buf_io_fix
Flags for io_fix types.
Definition: buf0types.h:99
@ 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
The database buffer pool high-level routines.
Class implementing buf_pool->flush_list hazard pointer.
Definition: buf0buf.h:2103
~FlushHp() override=default
Destructor.
FlushHp(const buf_pool_t *buf_pool, const ib_mutex_t *mutex)
Constructor.
Definition: buf0buf.h:2108
void adjust(const buf_page_t *bpage) override
Adjust the value of hp.
Definition: buf0buf.cc:2945
We use Flush_observer to track flushing of non-redo logged pages in bulk create index(btr0load....
Definition: buf0flu.h:270
A "Hazard Pointer" class used to iterate over page lists inside the buffer pool.
Definition: buf0buf.h:2045
bool is_hp(const buf_page_t *bpage)
Checks if a bpage is the hp.
Definition: buf0buf.cc:2920
void set(buf_page_t *bpage)
Set current value.
Definition: buf0buf.cc:2907
virtual void adjust(const buf_page_t *bpage)=0
Adjust the value of hp.
const ib_mutex_t * m_mutex
mutex that protects access to the m_hp.
Definition: buf0buf.h:2095
void move(const buf_page_t *bpage, buf_page_t *dpage)
Adjust the value of hp for moving.
Definition: buf0buf.cc:2932
buf_page_t * m_hp
hazard pointer.
Definition: buf0buf.h:2099
virtual ~HazardPointer()=default
Destructor.
const buf_pool_t * m_buf_pool
Buffer pool instance.
Definition: buf0buf.h:2091
HazardPointer(const HazardPointer &)
Disable copying.
buf_page_t * get() const
Get current value.
Definition: buf0buf.h:2057
HazardPointer(const buf_pool_t *buf_pool, const ib_mutex_t *mutex)
Constructor.
Definition: buf0buf.h:2050
HazardPointer & operator=(const HazardPointer &)
The IO Context that is passed down to the low level IO code.
Definition: os0file.h:266
Class implementing buf_pool->LRU hazard pointer.
Definition: buf0buf.h:2122
~LRUHp() override=default
Destructor.
void adjust(const buf_page_t *bpage) override
Adjust the value of hp.
Definition: buf0buf.cc:2960
LRUHp(const buf_pool_t *buf_pool, const ib_mutex_t *mutex)
Constructor.
Definition: buf0buf.h:2127
Special purpose iterators to be used when scanning the LRU list.
Definition: buf0buf.h:2144
~LRUItr() override=default
Destructor.
buf_page_t * start()
Selects from where to start a scan.
Definition: buf0buf.cc:2975
LRUItr(const buf_pool_t *buf_pool, const ib_mutex_t *mutex)
Constructor.
Definition: buf0buf.h:2149
The purpose of this class is to hide the knowledge that Buf_io_fix_latching_rules even exists from us...
Definition: buf0buf.cc:5652
Definition: buf0buf.h:1433
bool someone_is_responsible() const
Checks if there is any thread responsible for I/O on this page now.
Definition: buf0buf.h:1441
void release()
Called by the thread responsible for I/O on this page to release its responsibility.
Definition: buf0buf.h:1453
bool current_thread_is_responsible() const
Checks if the current thread is responsible for I/O on this page now.
Definition: buf0buf.h:1447
void take()
Called by the thread which becomes responsible for I/O on this page to indicate that it takes the res...
Definition: buf0buf.h:1460
std::thread::id responsible_thread
The thread responsible for I/O on this page, or an impossible value if no thread is currently respons...
Definition: buf0buf.h:1436
Definition: buf0buf.h:1162
uint32_t freed_page_clock
The value of buf_pool->freed_page_clock when this block was the last time put to the head of the LRU ...
Definition: buf0buf.h:1677
buf_page_t(const buf_page_t &other)
Copy constructor.
Definition: buf0buf.h:1166
void space_id_changed()
Updates new space reference and acquires "reference count latch" and the current version of the space...
Definition: buf0buf.h:1324
void take_io_responsibility()
Called by the thread which becomes responsible for I/O on this page to indicate that it takes the res...
Definition: buf0buf.h:1487
bool is_stale() const
Checks if this space reference saved during last page ID initialization was deleted or truncated sinc...
Definition: buf0buf.h:1241
void init_io_fix()
This is called only when having full ownership of the page object and no other thread can reach it.
Definition: buf0buf.h:1517
void set_io_fix(buf_io_fix io_fix)
Sets io_fix to specified value.
Definition: buf0buf.cc:5726
bool someone_has_io_responsibility() const
Checks if there is any thread responsible for I/O on this page now.
Definition: buf0buf.h:1471
bool has_correct_io_fix_value() const
Checks if io_fix has any of the known enum values.
Definition: buf0buf.h:1420
lsn_t get_newest_lsn() const noexcept
Definition: buf0buf.h:1357
bool current_thread_has_io_responsibility() const
Checks if the current thread is responsible for I/O on this page now.
Definition: buf0buf.h:1477
void set_newest_lsn(lsn_t lsn) noexcept
Set the latest modification LSN.
Definition: buf0buf.h:1368
buf_page_t * hash
Node used in chaining to buf_pool->page_hash or buf_pool->zip_hash.
Definition: buf0buf.h:1607
bool is_io_fix_write() const
Checks if the current value of io_fix is BUF_IO_WRITE.
Definition: buf0buf.cc:5706
Flush_observer * get_flush_observer() noexcept
Definition: buf0buf.h:1341
fil_space_t * get_space() const
Retrieve the tablespace object if one was available during page ID initialization.
Definition: buf0buf.h:1280
bool is_io_fix_read_as_opposed_to_write() const
Assuming that io_fix is either BUF_IO_READ or BUF_IO_WRITE determines which of the two it is.
Definition: buf0buf.cc:5718
space_id_t space() const noexcept
Retrieve the tablespace id.
Definition: buf0buf.h:1230
bool in_zip_hash
true if in buf_pool->zip_hash
Definition: buf0buf.h:1722
bool in_free_list
true if in buf_pool->free; when buf_pool->free_list_mutex is free, the following should hold: in_free...
Definition: buf0buf.h:1713
std::chrono::steady_clock::time_point access_time
Time of first access, or 0 if the block was never accessed in the buffer pool.
Definition: buf0buf.h:1686
Flush_observer * m_flush_observer
Flush observer instance.
Definition: buf0buf.h:1669
buf_fix_count_atomic_t buf_fix_count
Count of how many fold this block is currently bufferfixed.
Definition: buf0buf.h:1391
bool in_flush_list
true if in buf_pool->flush_list; when buf_pool->flush_list_mutex is free, the following should hold: ...
Definition: buf0buf.h:1709
void reset_page_id()
Sets stored value to invalid/empty value.
Definition: buf0buf.h:1317
bool is_dirty() const noexcept
Definition: buf0buf.h:1364
bool old
true if the block is in the old blocks in buf_pool->LRU_old
Definition: buf0buf.h:1695
bool was_io_fix_read() const
Checks if io_fix is BUF_IO_READ without requiring or acquiring any latches.
Definition: buf0buf.h:1577
void reinit_io_fix()
This is called only when having full ownership of the page object and no other thread can reach it.
Definition: buf0buf.h:1529
void reset_page_id(page_id_t new_page_id)
Sets stored page ID to the new value.
Definition: buf0buf.h:1301
void set_oldest_lsn(lsn_t lsn) noexcept
Set the LSN when the page is modified for the first time.
Definition: buf0buf.ic:746
uint16_t get_dblwr_batch_id() const
Definition: buf0buf.h:1226
bool was_stale() const
Checks if this space reference saved during last page ID initialization was deleted or truncated sinc...
Definition: buf0buf.h:1258
void set_page_id(const page_id_t page_id)
Set the stored page id to a new value.
Definition: buf0buf.h:1285
friend std::ostream & operator<<(std::ostream &outs, const buf_page_t &page)
Print page metadata in JSON format {"key":"value"}.
Definition: buf0buf.cc:7094
lsn_t newest_modification
The flush LSN, LSN when this page was written to the redo log.
Definition: buf0buf.h:1640
void release_io_responsibility()
Called by the thread responsible for I/O on this page to release its responsibility.
Definition: buf0buf.h:1483
static bool is_memory(const page_t *const ptr) noexcept
Check if the given ptr lies in a memory block of type BUF_BLOCK_MEMORY.
Definition: buf0buf.cc:7060
lsn_t get_oldest_lsn() const noexcept
Definition: buf0buf.h:1361
lsn_t oldest_modification
log sequence number of the youngest modification to this block, zero if not modified.
Definition: buf0buf.h:1644
page_id_t id
Page id.
Definition: buf0buf.h:1385
copyable_atomic_t< buf_io_fix > io_fix
Type of pending I/O operation.
Definition: buf0buf.h:1397
UT_LIST_NODE_T(buf_page_t) list
Based on state, this is a list node, protected by the corresponding list mutex, in one of the followi...
buf_io_fix get_io_fix_snapshot() const
Retrieves a value of io_fix without requiring or acquiring any latches.
Definition: buf0buf.h:1503
page_size_t size
Page size.
Definition: buf0buf.h:1388
io_responsibility_t io_responsibility
Tracks which thread is responsible for I/O on this page.
Definition: buf0buf.h:1466
uint8_t buf_pool_index
Index number of the buffer pool that this block belongs to.
Definition: buf0buf.h:1604
uint16_t m_dblwr_id
Double write instance ordinal value during writes.
Definition: buf0buf.h:1691
bool was_io_fix_none() const
Checks if io_fix is BUF_IO_NONE without requiring or acquiring any latches.
Definition: buf0buf.h:1594
void set_clean() noexcept
Set page to clean state.
Definition: buf0buf.h:1375
buf_io_fix get_io_fix() const
Retrieves the current value of io_fix.
Definition: buf0buf.h:1545
bool is_io_fix_read() const
Checks if the current value of io_fix is BUF_IO_READ.
Definition: buf0buf.cc:5712
uint32_t m_version
Version of fil_space_t when the page was updated.
Definition: buf0buf.h:1682
bool in_LRU_list
true if the page is in the LRU list; used in debugging
Definition: buf0buf.h:1716
void set_flush_observer(Flush_observer *flush_observer) noexcept
Set the flush observer for the page.
Definition: buf0buf.h:1345
buf_page_state state
Block state.
Definition: buf0buf.h:1597
page_no_t page_no() const noexcept
Retrieve the page number.
Definition: buf0buf.h:1234
fil_space_t * m_space
Tablespace instance that this page belongs to.
Definition: buf0buf.h:1672
bool was_io_fixed() const
Checks if io_fix is BUF_IO_FIX or BUF_IO_READ or BUF_IO_WRITE without requiring or acquiring any latc...
Definition: buf0buf.h:1584
void reset_flush_observer() noexcept
Remove the flush observer.
Definition: buf0buf.h:1353
void set_dblwr_batch_id(uint16_t batch_id)
Set the doublewrite buffer ID.
Definition: buf0buf.h:1223
bool file_page_was_freed
This is set to true when fsp frees a page in buffer pool; protected by buf_pool->zip_mutex or buf_blo...
Definition: buf0buf.h:1700
UT_LIST_NODE_T(buf_page_t) LRU
node of the LRU list
friend class Latching_rules_helpers
Definition: buf0buf.h:1425
bool is_memory() const noexcept
Check if the state of this page is BUF_BLOCK_MEMORY.
Definition: buf0buf.h:1216
buf_flush_t flush_type
If this block is currently being flushed to disk, this tells the flush_type.
Definition: buf0buf.h:1601
void set_page_size(const page_size_t &page_size)
Set the page size to a new value.
Definition: buf0buf.h:1293
bool in_page_hash
true if in buf_pool->page_hash
Definition: buf0buf.h:1719
page_zip_des_t zip
compressed page; zip.data (but not the data it points to) is protected by buf_pool->zip_mutex; state ...
Definition: buf0buf.h:1665
static bool is_correct_io_fix_value(buf_io_fix io_fix)
Checks if io_fix has any of the known enum values.
Definition: buf0buf.h:1404
Definition: buf0buf.h:1155
copyable_atomic_t(const copyable_atomic_t< T > &other)
Definition: buf0buf.h:1157
Definition: hash0hash.h:375
Page identifier.
Definition: buf0types.h:207
uint64_t hash() const
Retrieve the hash value.
Definition: buf0types.h:247
page_no_t page_no() const
Retrieve the page number.
Definition: buf0types.h:243
Page size descriptor.
Definition: page0size.h:50
size_t logical() const
Retrieve the logical page size (in-memory).
Definition: page0size.h:129
int page
Definition: ctype-mb.cc:1234
dberr_t
Definition: db0err.h:39
fil_space_t * fil_space_get(space_id_t space_id)
Look up a tablespace.
Definition: fil0fil.cc:2230
void fil_page_reset_type(const page_id_t &page_id, byte *page, ulint type, mtr_t *mtr)
Reset the page type.
Definition: fil0fil.cc:8238
The low-level file system.
uint16_t page_type_t
Definition: fil0fil.h:1245
constexpr page_type_t FIL_PAGE_INDEX
File page types (values of FIL_PAGE_TYPE)
Definition: fil0fil.h:1249
constexpr page_no_t FIL_NULL
'null' (undefined) page offset in the context of file spaces
Definition: fil0fil.h:1183
page_type_t fil_page_get_type(const byte *page)
Get the file page type.
Definition: fil0fil.h:1362
constexpr uint32_t FIL_PAGE_TYPE
file page type: FIL_PAGE_INDEX,..., 2 bytes.
Definition: fil0types.h:76
constexpr uint32_t FIL_PAGE_OFFSET
page offset inside space
Definition: fil0types.h:46
constexpr uint32_t FIL_PAGE_DATA
start of the data on the page
Definition: fil0types.h:111
constexpr uint32_t FIL_PAGE_SPACE_ID
alias for space id
Definition: fil0types.h:108
constexpr uint32_t FIL_PAGE_NEXT
if there is a 'natural' successor of the page, its offset.
Definition: fil0types.h:61
constexpr uint32_t FIL_PAGE_PREV
if there is a 'natural' predecessor of the page, its offset.
Definition: fil0types.h:51
flush_type
Definition: my_sys.h:300
The simple hash table utility.
static rw_lock_t * hash_lock_s_confirm(rw_lock_t *hash_lock, hash_table_t *table, uint64_t hash_value)
If not appropriate rw_lock for a hash value in a hash table, relock S-lock the another rw_lock until ...
static rw_lock_t * hash_lock_x_confirm(rw_lock_t *hash_lock, hash_table_t *table, uint64_t hash_value)
If not appropriate rw_lock for a hash value in a hash table, relock X-lock the another rw_lock until ...
static rw_lock_t * hash_get_lock(hash_table_t *table, uint64_t hash_value)
Gets the rw_lock for a hash value in a hash table.
static int flags[50]
Definition: hp_test1.cc:40
#define malloc(A)
Definition: lexyy.cc:914
#define free(A)
Definition: lexyy.cc:915
lock_mode
Definition: lock0types.h:54
constexpr lsn_t LSN_MAX
Maximum possible lsn value is slightly higher than the maximum sn value, because lsn sequence enumera...
Definition: log0constants.h:159
uint64_t lsn_t
Type used for all log sequence number storage and arithmetic.
Definition: log0types.h:63
static uint16_t mach_read_from_2(const byte *b)
The following function is used to fetch data from 2 consecutive bytes.
static uint32_t mach_read_from_4(const byte *b)
The following function is used to fetch data from 4 consecutive bytes.
static void mach_write_to_4(byte *b, ulint n)
The following function is used to store data in 4 consecutive bytes.
Mini-transaction buffer global types.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
void copy(Shards< COUNT > &dst, const Shards< COUNT > &src) noexcept
Copy the counters, overwrite destination.
Definition: ut0counter.h:354
void clear(Shards< COUNT > &shards) noexcept
Clear the counter - reset to 0.
Definition: ut0counter.h:344
Definition: buf0block_hint.cc:30
const std::string FILE("FILE")
bool load(THD *, const dd::String_type &fname, dd::String_type *buf)
Read an sdi file from disk and store in a buffer.
Definition: sdi_file.cc:308
Provides atomic access in shared-exclusive modes.
Definition: shared_spin_lock.h:79
size_t size(const char *const c)
Definition: base64.h:46
Definition: gcs_xcom_synode.h:64
mode
Definition: file_handle.h:61
pid_type get_id()
Definition: process.h:48
static uint64_t hash_uint64(uint64_t value)
Hashes a 64-bit integer.
Definition: ut0rnd.h:199
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2883
void os_event_set(os_event_t event)
Sets an event semaphore to the signaled state: lets waiting threads proceed.
Definition: os0event.cc:553
bool os_event_is_set(const os_event_t event)
Check if the event is set.
Definition: os0event.cc:545
int64_t os_event_reset(os_event_t event)
Resets an event semaphore to the non-signaled state.
Definition: os0event.cc:568
The interface to the operating system process control primitives.
byte page_t
Type of the index page.
Definition: page0types.h:152
required string type
Definition: replication_group_member_actions.proto:34
Shutdowns the Innobase database server.
std::atomic< enum srv_shutdown_t > srv_shutdown_state
At a shutdown this value climbs from SRV_SHUTDOWN_NONE to SRV_SHUTDOWN_EXIT_THREADS.
Definition: srv0start.cc:163
@ SRV_SHUTDOWN_EXIT_THREADS
Exit all threads and free resources.
Definition: srv0shutdown.h:111
Functor to validate the LRU list.
Definition: buf0buf.h:2744
static void validate(const buf_pool_t *buf_pool)
Definition: buf0buf.h:2747
void operator()(const buf_page_t *elem) const
Definition: buf0buf.h:2745
Functor to validate the LRU list.
Definition: buf0buf.h:2734
void operator()(const buf_page_t *elem) const
Definition: buf0buf.h:2735
static void validate(const buf_pool_t *buf_pool)
Definition: buf0buf.h:2737
Definition: buf0buf.h:2753
static void validate(const buf_pool_t *buf_pool)
Definition: buf0buf.h:2759
void operator()(const buf_block_t *elem) const
Definition: buf0buf.h:2754
Structure used by AHI to contain information on record prefixes to be considered in hash index subsys...
Definition: buf0buf.h:1737
bool operator==(const btr_search_prefix_info_t &other) const
Definition: buf0buf.h:1751
bool operator!=(const btr_search_prefix_info_t &other) const
Definition: buf0buf.h:1756
bool equals_without_left_side(const btr_search_prefix_info_t &other) const
Definition: buf0buf.h:1747
uint32_t n_bytes
recommended prefix: number of bytes in an incomplete field
Definition: buf0buf.h:1740
uint16_t n_fields
recommended prefix length for hash search: number of full fields
Definition: buf0buf.h:1742
bool left_side
true or false, depending on whether the leftmost record of several records with the same prefix shoul...
Definition: buf0buf.h:1745
Structure that holds most AHI-related fields.
Definition: buf0buf.h:1800
void assert_empty_on_init() const
Definition: buf0buf.h:1866
std::atomic< dict_index_t * > index
Index for which the adaptive hash index has been created, or nullptr if the page does not exist in th...
Definition: buf0buf.h:1819
void assert_empty() const
Definition: buf0buf.h:1864
void validate() const
Definition: buf0buf.h:1842
std::atomic< btr_search_prefix_info_t > prefix_info
Prefix info that was used for building hash index.
Definition: buf0buf.h:1818
std::atomic< uint16_t > n_pointers
Used in debugging.
Definition: buf0buf.h:1840
std::atomic< btr_search_prefix_info_t > recommended_prefix_info
Recommended prefix info for hash search.
Definition: buf0buf.h:1807
The buffer control block structure.
Definition: buf0buf.h:1762
rw_lock_t debug_latch
In the debug version, each thread which bufferfixes the block acquires an s-latch here; so we can use...
Definition: buf0buf.h:1901
uint64_t modify_clock
This clock is incremented every time a pointer to a record on the page may become obsolete; this is u...
Definition: buf0buf.h:1915
BPageLock lock
read-write lock of the buffer frame
Definition: buf0buf.h:1772
std::atomic< uint32_t > n_hash_helps
Counter which controls how many times the current prefix recommendation would help in searches.
Definition: buf0buf.h:1889
page_type_t get_page_type() const
Get the page type of the current buffer block.
Definition: buf0buf.h:1961
struct buf_block_t::ahi_t ahi
buf_page_t page
page information; this must be the first field, so that buf_pool->page_hash can point to buf_page_t o...
Definition: buf0buf.h:1768
page_no_t get_next_page_no() const
Get the next page number of the current buffer block.
Definition: buf0buf.h:1949
page_zip_des_t const * get_page_zip() const noexcept
Const version.
Definition: buf0buf.h:2005
const char * get_page_type_str() const noexcept
Get the page type of the current buffer block as string.
Definition: buf0buf.cc:7036
bool in_withdraw_list
Definition: buf0buf.h:1794
UT_LIST_NODE_T(buf_block_t) unzip_LRU
node of the decompressed LRU list; a block is in the unzip_LRU list if page.state == BUF_BLOCK_FILE_P...
page_no_t get_prev_page_no() const
Get the prev page number of the current buffer block.
Definition: buf0buf.h:1955
bool is_leaf() const
Definition: buf0buf.h:2016
void mark_for_read_io()
Mark the frame with jumbled page_id, while initiating i/o read (BUF_IO_READ).
Definition: buf0buf.h:1968
uint64_t get_modify_clock(bool single_threaded) const noexcept
Get the modified clock (version) value.
Definition: buf0buf.h:1928
bool in_unzip_LRU_list
true if the page is in the decompressed LRU list; used in debugging
Definition: buf0buf.h:1792
bool is_empty() const
Check if this index page is empty.
Definition: buf0buf.cc:7073
const page_id_t & get_page_id() const
Get the page number and space id of the current buffer block.
Definition: buf0buf.h:1941
BPageMutex mutex
mutex protecting this block: state (also protected by the buffer pool mutex), io_fix,...
Definition: buf0buf.h:1922
byte * frame
pointer to buffer frame which is of size UNIV_PAGE_SIZE, and aligned to an address divisible by UNIV_...
Definition: buf0buf.h:1784
page_no_t get_page_no() const
Get the page number of the current buffer block.
Definition: buf0buf.h:1945
bool is_index_page() const
Definition: buf0buf.h:2018
bool is_root() const
Definition: buf0buf.h:2012
bool was_freed() const
Check if the buffer block was freed.
Definition: buf0buf.h:1777
bool made_dirty_with_no_latch
true if block has been made dirty without acquiring X/SX latch as the block belongs to temporary tabl...
Definition: buf0buf.h:1893
page_zip_des_t * get_page_zip() noexcept
Gets the compressed page descriptor corresponding to an uncompressed page if applicable.
Definition: buf0buf.h:1999
bool is_memory() const noexcept
Definition: buf0buf.h:2009
uint16_t get_page_level() const
Definition: buf0buf.cc:7065
friend std::ostream & operator<<(std::ostream &outs, const buf_block_t &block)
Print control block information in JSON format: {"key":"value"}.
Definition: buf0buf.cc:7128
Struct that is embedded in the free zip blocks.
Definition: buf0buf.h:2163
UT_LIST_NODE_T(buf_buddy_free_t) list
Node of zip_free list.
ulint size
size of the block
Definition: buf0buf.h:2165
byte bytes[FIL_PAGE_DATA]
stamp[FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID] == BUF_BUDDY_FREE_STAMP denotes a free block.
Definition: buf0buf.h:2166
union buf_buddy_free_t::@196 stamp
buf_page_t bpage
Embedded bpage descriptor.
Definition: buf0buf.h:2177
Definition: buf0buf.h:2275
uint64_t relocated
Definition: buf0buf.h:2277
ulint used
Definition: buf0buf.h:2276
std::chrono::steady_clock::duration relocated_duration
Definition: buf0buf.h:2278
Statistics of buddy blocks of a given size.
Definition: buf0buf.h:2265
uint64_t relocated
Number of blocks relocated by the buddy system.
Definition: buf0buf.h:2270
snapshot_t take_snapshot()
Definition: buf0buf.h:2281
std::atomic< ulint > used
Number of blocks allocated from the buddy system.
Definition: buf0buf.h:2267
std::chrono::steady_clock::duration relocated_duration
Total duration of block relocations.
Definition: buf0buf.h:2273
A chunk of buffers.
Definition: buf0buf.ic:53
This structure defines information we will fetch from each buffer pool.
Definition: buf0buf.h:170
ulint young_making_delta
num of pages made young since last printout
Definition: buf0buf.h:223
std::array< size_t, BUF_FLUSH_N_TYPES > n_pending_flush
Number of pages pending flush of given type.
Definition: buf0buf.h:190
double pages_created_rate
num of pages create per second
Definition: buf0buf.h:219
ulint n_pages_read
buf_pool->n_pages_read
Definition: buf0buf.h:196
ulint pool_unique_id
Buffer Pool ID.
Definition: buf0buf.h:174
ulint n_pend_reads
buf_pool->n_pend_reads, pages pending read
Definition: buf0buf.h:188
ulint n_ra_pages_read_rnd
buf_pool->n_ra_pages_read_rnd, number of pages readahead
Definition: buf0buf.h:204
ulint lru_len
Length of buf_pool->LRU.
Definition: buf0buf.h:178
ulint unzip_cur
buf_LRU_stat_cur.unzip, num pages decompressed in current interval
Definition: buf0buf.h:244
ulint page_read_delta
num of pages read since last printout
Definition: buf0buf.h:221
double pages_written_rate
num of pages written per second
Definition: buf0buf.h:220
double page_made_young_rate
page made young rate in pages per second
Definition: buf0buf.h:214
ulint io_sum
buf_LRU_stat_sum.io
Definition: buf0buf.h:240
ulint io_cur
buf_LRU_stat_cur.io, num of IO for current interval
Definition: buf0buf.h:241
ulint old_lru_len
buf_pool->LRU_old_len
Definition: buf0buf.h:180
double pages_readahead_rnd_rate
random readahead rate in pages per second
Definition: buf0buf.h:229
ulint unzip_sum
buf_LRU_stat_sum.unzip
Definition: buf0buf.h:243
ulint n_pages_made_young
number of pages made young
Definition: buf0buf.h:192
ulint n_ra_pages_read
buf_pool->n_ra_pages_read, number of pages readahead
Definition: buf0buf.h:206
ulint n_pages_not_made_young
number of pages not made young
Definition: buf0buf.h:194
ulint n_ra_pages_evicted
buf_pool->n_ra_pages_evicted, number of readahead pages evicted without access
Definition: buf0buf.h:209
ulint n_pages_created
buf_pool->n_pages_created
Definition: buf0buf.h:198
ulint n_page_get_delta
num of buffer pool page gets since last printout
Definition: buf0buf.h:211
ulint free_list_len
Length of buf_pool->free list.
Definition: buf0buf.h:182
double pages_evicted_rate
rate of readahead page evicted without access, in pages per second
Definition: buf0buf.h:233
ulint not_young_making_delta
num of pages not make young since last printout
Definition: buf0buf.h:225
ulint n_pend_unzip
buf_pool->n_pend_unzip, pages pending decompress
Definition: buf0buf.h:186
double pages_readahead_rate
readahead rate in pages per second
Definition: buf0buf.h:231
ulint unzip_lru_len
length of buf_pool->unzip_LRU list
Definition: buf0buf.h:237
ulint pool_size
Buffer Pool size in pages.
Definition: buf0buf.h:176
ulint flush_list_len
Length of buf_pool->flush_list.
Definition: buf0buf.h:184
double page_not_made_young_rate
page not made young rate in pages per second
Definition: buf0buf.h:216
ulint n_page_gets
buf_pool->n_page_gets
Definition: buf0buf.h:202
double pages_read_rate
num of pages read per second
Definition: buf0buf.h:218
ulint n_pages_written
buf_pool->n_pages_written
Definition: buf0buf.h:200
The buffer pool statistics structure.
Definition: buf0buf.h:2183
uint64_t n_pages_not_made_young
Number of pages not made young because the first access was not long enough ago, in buf_page_peek_if_...
Definition: buf0buf.h:2216
std::atomic< uint64_t > n_pages_read
Number of read operations.
Definition: buf0buf.h:2192
std::atomic< uint64_t > n_pages_created
number of pages created in the pool with no read.
Definition: buf0buf.h:2198
uint64_t n_pages_made_young
Number of pages made young, in calls to buf_LRU_make_block_young().
Definition: buf0buf.h:2212
uint64_t n_ra_pages_evicted
Number of read ahead pages that are evicted without being accessed.
Definition: buf0buf.h:2208
std::atomic< uint64_t > n_ra_pages_read_rnd
Number of pages read in as part of random read ahead.
Definition: buf0buf.h:2201
uint64_t flush_list_bytes
Flush_list size in bytes.
Definition: buf0buf.h:2222
std::atomic< uint64_t > n_ra_pages_read
Number of pages read in as part of read ahead.
Definition: buf0buf.h:2204
Shards m_n_page_gets
Number of page gets performed; also successful searches through the adaptive hash index are counted a...
Definition: buf0buf.h:2189
uint64_t LRU_bytes
LRU size in bytes.
Definition: buf0buf.h:2219
void reset()
Definition: buf0buf.h:2248
static void copy(buf_pool_stat_t &dst, const buf_pool_stat_t &src) noexcept
Definition: buf0buf.h:2224
std::atomic< uint64_t > n_pages_written
Number of write operations.
Definition: buf0buf.h:2195
The buffer pool structure.
Definition: buf0buf.h:2291
UT_LIST_BASE_NODE_T(buf_buddy_free_t, list) zip_free[BUF_BUDDY_SIZES_MAX]
Buddy free lists.
UT_LIST_BASE_NODE_T(buf_page_t, list) free
Base node of the free block list.
buf_chunk_t * chunks_old
old buffer pool chunks to be freed after resizing buffer pool
Definition: buf0buf.h:2345
void change_flush_state(buf_flush_t flush_type, F &&change)
Executes change() which modifies fields protected by flush_state_mutex.
Definition: buf0buf.h:2564
hash_table_t * zip_hash
Hash table of buf_block_t blocks whose frames are allocated to the zip buddy system,...
Definition: buf0buf.h:2364
FlushHp flush_hp
"Hazard pointer" used during scan of flush_list while doing flush list batch.
Definition: buf0buf.h:2398
buf_buddy_stat_t buddy_stat[BUF_BUDDY_SIZES_MAX+1]
Statistics of buddy system, indexed by block size.
Definition: buf0buf.h:2377
LRUItr single_scan_itr
Iterator used to scan the LRU list when searching for single page flushing victim.
Definition: buf0buf.h:2475
buf_pool_stat_t old_stat
Old statistics.
Definition: buf0buf.h:2383
void deallocate_chunk(buf_chunk_t *chunk)
A wrapper for buf_pool_t::allocator.deallocate_large which also advices the OS that this chunk can be...
Definition: buf0buf.cc:979
bool try_LRU_scan
Set to false when an LRU scan for free block fails.
Definition: buf0buf.h:2437
ulint buddy_n_frames
Number of frames allocated from the buffer pool to the buddy system.
Definition: buf0buf.h:2332
std::atomic< ulint > n_pend_reads
Number of pending read operations.
Definition: buf0buf.h:2367
UT_LIST_BASE_NODE_T(buf_page_t, list) zip_clean
Unmodified compressed pages.
UT_LIST_BASE_NODE_T(buf_page_t, list) flush_list
Base node of the modified block list.
LRUHp lru_hp
"hazard pointer" used during scan of LRU while doing LRU list batch.
Definition: buf0buf.h:2467
bool allocate_chunk(ulonglong mem_size, buf_chunk_t *chunk)
A wrapper for buf_pool_t::allocator.alocate_large which also advices the OS that this chunk should no...
Definition: buf0buf.cc:945
bool is_tracking()
Check if the page modifications are tracked.
Definition: buf0buf.h:2444
UT_LIST_BASE_NODE_T(buf_block_t, unzip_LRU) unzip_LRU
Base node of the unzip_LRU list.
std::chrono::steady_clock::time_point last_printout_time
when buf_print_io was last time called.
Definition: buf0buf.h:2373
ulint LRU_old_ratio
Reserve this much of the buffer pool for "old" blocks.
Definition: buf0buf.h:2328
BufListMutex chunks_mutex
protects (de)allocation of chunks:
Definition: buf0buf.h:2300
lsn_t track_page_lsn
Page Tracking start LSN.
Definition: buf0buf.h:2440
BufListMutex zip_free_mutex
buddy allocator mutex
Definition: buf0buf.h:2309
volatile ulint n_chunks
Number of buffer pool chunks.
Definition: buf0buf.h:2336
LRUItr lru_scan_itr
Iterator used to scan the LRU list when searching for replaceable victim.
Definition: buf0buf.h:2471
bool madvise_dump()
Advices the OS that all chunks in this buffer pool instance can be dumped to a core file.
Definition: buf0buf.cc:990
ulint old_size
Previous pool size in pages.
Definition: buf0buf.h:2351
UT_LIST_BASE_NODE_T(buf_page_t, LRU) LRU
Base node of the LRU list.
FlushHp oldest_hp
Entry pointer to scan the oldest page except for system temporary.
Definition: buf0buf.h:2401
buf_page_t * LRU_old
Pointer to the about LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV oldest blocks in the LRU list; NULL if LRU l...
Definition: buf0buf.h:2483
buf_page_t * watch
Sentinel records for buffer pool watches.
Definition: buf0buf.h:2512
BufListMutex flush_list_mutex
Mutex protecting the flush list access.
Definition: buf0buf.h:2394
ib_mutex_t flush_state_mutex
Flush state protection mutex.
Definition: buf0buf.h:2315
ib_rbt_t * flush_rbt
A red-black tree is used exclusively during recovery to speed up insertions in the flush_list.
Definition: buf0buf.h:2424
buf_chunk_t * chunks
buffer pool chunks
Definition: buf0buf.h:2342
BufListMutex LRU_list_mutex
LRU list mutex.
Definition: buf0buf.h:2303
hash_table_t * page_hash
Hash table of buf_page_t or buf_block_t file pages, buf_page_in_file() == true, indexed by (space_id,...
Definition: buf0buf.h:2360
ulint withdraw_target
Target length of withdraw block list, when withdrawing.
Definition: buf0buf.h:2463
os_event_t no_flush[BUF_FLUSH_N_TYPES]
This is in the set state when there is no flush batch of the given type running.
Definition: buf0buf.h:2416
buf_pool_stat_t stat
Current statistics.
Definition: buf0buf.h:2380
page_no_t read_ahead_area
Size in pages of the area which the read-ahead algorithms read if invoked.
Definition: buf0buf.h:2355
ulint curr_pool_size
Current pool size in bytes.
Definition: buf0buf.h:2325
bool init_flush[BUF_FLUSH_N_TYPES]
This is true when a flush of the given type is being initialized.
Definition: buf0buf.h:2408
ulint curr_size
Current pool size in pages.
Definition: buf0buf.h:2348
ulint instance_no
Array index of this buffer pool instance.
Definition: buf0buf.h:2322
ulint LRU_old_len
Length of the LRU list from the block to which LRU_old points onward, including that block; see buf0l...
Definition: buf0buf.h:2489
std::array< size_t, BUF_FLUSH_N_TYPES > n_flush
This is the number of pending writes in the given flush type.
Definition: buf0buf.h:2412
std::atomic< ulint > n_pend_unzip
number of pending decompressions.
Definition: buf0buf.h:2370
UT_LIST_BASE_NODE_T(buf_page_t, list) withdraw
base node of the withdraw block list.
lsn_t max_lsn_io
Maximum LSN for which write io has already started.
Definition: buf0buf.h:2447
ulint freed_page_clock
A sequence number used to count the number of buffer blocks removed from the end of the LRU list; NOT...
Definition: buf0buf.h:2431
BufListMutex free_list_mutex
free and withdraw list mutex
Definition: buf0buf.h:2306
BufPoolZipMutex zip_mutex
Zip mutex of this buffer pool instance, protects compressed only pages (of type buf_page_t,...
Definition: buf0buf.h:2319
bool madvise_dont_dump()
Advices the OS that all chunks in this buffer pool instance should not be dumped to a core file.
Definition: buf0buf.cc:1000
volatile ulint n_chunks_new
New number of buffer pool chunks.
Definition: buf0buf.h:2339
BufListMutex zip_hash_mutex
zip_hash mutex
Definition: buf0buf.h:2312
bool is_flushing(buf_flush_t flush_type) const
Checks if the batch is running, which is basically equivalent to !os_event_is_set(no_flush[type]) if ...
Definition: buf0buf.h:2551
The occupied bytes of lists in all buffer pools.
Definition: buf0buf.h:250
ulint LRU_bytes
LRU size in bytes.
Definition: buf0buf.h:251
ulint unzip_LRU_bytes
unzip_LRU size in bytes
Definition: buf0buf.h:252
ulint flush_list_bytes
flush_list size in bytes
Definition: buf0buf.h:253
File space address.
Definition: fil0fil.h:1200
File node of a tablespace or the log data space.
Definition: fil0fil.h:179
Tablespace or log data space.
Definition: fil0fil.h:262
space_id_t id
Tablespace ID.
Definition: fil0fil.h:358
void dec_ref() noexcept
Decrement the page reference count.
Definition: fil0fil.h:320
uint32_t get_current_version() const
Returns current version of the space object.
Definition: fil0fil.cc:11818
uint32_t get_recent_version() const
Returns current version of the space object.
Definition: fil0fil.cc:11822
bool was_not_deleted() const
Definition: fil0fil.cc:11810
void inc_ref() noexcept
Increment the page reference count.
Definition: fil0fil.h:309
bool is_deleted() const
Definition: fil0fil.cc:11805
Red black tree instance.
Definition: ut0rbt.h:72
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:177
InnoDB condition variable.
Definition: os0event.cc:63
Compressed page descriptor.
Definition: page0types.h:201
page_zip_t * data
Compressed page data.
Definition: page0types.h:203
The structure used in the spin lock implementation of a read-write lock.
Definition: sync0rw.h:363
bool rw_lock_own(const rw_lock_t *lock, ulint lock_type)
Checks if the thread has locked the rw-lock in the specified mode, with the pass value == 0.
Definition: sync0rw.cc:858
rw_lock_type_t
Definition: sync0rw.h:97
@ RW_NO_LATCH
Definition: sync0rw.h:101
bool rw_lock_own_flagged(const rw_lock_t *lock, rw_lock_flags_t flags)
Checks if the thread has locked the rw-lock in the specified mode, with the pass value == 0.
Definition: sync0rw.cc:898
latch_level_t
Latching order levels.
Definition: sync0types.h:201
@ RW_LOCK_S
Definition: sync0types.h:208
@ RW_LOCK_X
Definition: sync0types.h:209
@ RW_LOCK_FLAG_X
Definition: sync0types.h:1216
@ RW_LOCK_FLAG_SX
Definition: sync0types.h:1217
@ RW_LOCK_FLAG_S
Definition: sync0types.h:1215
Version control for database, common definitions, and include files.
constexpr uint32_t UINT32_UNDEFINED
The 'undefined' value for a 32-bit unsigned integer.
Definition: univ.i:428
#define UNIV_PAGE_SIZE_SHIFT
The 2-logarithm of UNIV_PAGE_SIZE:
Definition: univ.i:291
#define IF_DEBUG(...)
Definition: univ.i:674
unsigned long int ulint
Definition: univ.i:406
#define UNIV_MEM_VALID(addr, size)
Definition: univ.i:591
constexpr uint32_t UNIV_ZIP_SIZE_MIN
Smallest compressed page size.
Definition: univ.i:330
Utilities for byte operations.
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105
#define ut_d(EXPR)
Debug statement.
Definition: ut0dbg.h:107
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:93
void ut_list_validate(const List &list, Functor &functor)
Checks the consistency of a two-way list.
Definition: ut0lst.h:493
#define mutex_own(M)
Checks that the current thread owns the mutex.
Definition: ut0mutex.h:165
#define mutex_exit(M)
Definition: ut0mutex.h:123
#define mutex_enter(M)
Definition: ut0mutex.h:117
static uint64_t lsn
Definition: xcom_base.cc:446
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510
int n
Definition: xcom_base.cc:509