44#define BUF_GET_IF_IN_POOL 11
45#define BUF_PEEK_IF_IN_POOL 12
47#define BUF_GET_NO_LATCH 14
53#define BUF_GET_IF_IN_POOL_OR_WATCH 15
60#define BUF_MAKE_YOUNG 51
65#define BUF_KEEP_OLD 52
69#define MAX_BUFFER_POOLS 64
72#define BUF_POOL_WATCH_SIZE 1
78extern ibool buf_debug_prints;
88#define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL
188#ifndef UNIV_HOTBACKUP
242 __attribute__((nonnull));
298#ifndef UNIV_HOTBACKUP
303#define buf_page_get(SP, ZS, OF, LA, MTR) buf_page_get_gen(\
304 SP, ZS, OF, LA, NULL,\
305 BUF_GET, __FILE__, __LINE__, MTR)
312#define buf_page_get_with_no_latch(SP, ZS, OF, MTR) buf_page_get_gen(\
313 SP, ZS, OF, RW_NO_LATCH, NULL,\
314 BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR)
325 ib_uint64_t modify_clock,
365#define buf_page_try_get(space_id, page_no, mtr) \
366 buf_page_try_get_func(space_id, page_no, __FILE__, __LINE__, mtr);
423buf_page_init_for_backup_restore(
433#ifndef UNIV_HOTBACKUP
482#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
491buf_page_set_file_page_was_freed(
503buf_page_reset_file_page_was_freed(
516 __attribute__((pure));
525 __attribute__((pure));
577# define buf_block_modify_clock_inc(block) ((void) 0)
609 const byte* read_buf,
612#ifndef UNIV_HOTBACKUP
632 __attribute__((pure));
640buf_pool_contains_zip(
645#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
654#if defined UNIV_DEBUG_PRINT || defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
669 const byte* read_buf,
681#ifndef UNIV_HOTBACKUP
688buf_get_latched_pages_number(
void);
755#ifdef UNIV_SYNC_DEBUG
762buf_block_dbg_add_level(
768# define buf_block_dbg_add_level(block, level)
786 __attribute__((pure));
811 __attribute__((pure));
812#ifndef UNIV_HOTBACKUP
821 __attribute__((pure));
831 __attribute__((pure));
841 __attribute__((pure));
867 __attribute__((pure));
876 __attribute__((pure));
902 __attribute__((pure));
912 __attribute__((pure));
929 __attribute__((nonnull, pure));
938 __attribute__((nonnull));
949 __attribute__((pure));
960 __attribute__((pure));
962# define buf_block_get_frame(block) (block)->frame
972 __attribute__((pure));
981 __attribute__((pure));
990 __attribute__((pure));
999 __attribute__((pure));
1008 __attribute__((pure));
1017 __attribute__((pure));
1021#define buf_block_get_page_zip(block) \
1022 (UNIV_LIKELY_NULL((block)->page.zip.data) ? &(block)->page.zip : NULL)
1023#ifndef UNIV_HOTBACKUP
1045#define buf_pool_is_block_mutex(m) \
1046 buf_pointer_is_block_field((const void*)(m))
1050#define buf_pool_is_block_lock(l) \
1051 buf_pointer_is_block_field((const void*)(l))
1053#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
1060buf_frame_get_page_zip(
1083 ib_int64_t tablespace_version,
1105 __attribute__((
const));
1114 __attribute__((nonnull,
const));
1202 UNIV_WARN_UNUSED_RESULT;
1213 UNIV_WARN_UNUSED_RESULT;
1234 UNIV_WARN_UNUSED_RESULT;
1278#ifndef UNIV_HOTBACKUP
1290# if MAX_BUFFER_POOLS > 64
1291# error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6"
1301#ifndef UNIV_HOTBACKUP
1343 ibool in_flush_list;
1405# if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
1406 ibool file_page_was_freed;
1428#ifndef UNIV_HOTBACKUP
1435 ibool in_unzip_LRU_list;
1506#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
1526# ifdef UNIV_SYNC_DEBUG
1529 rw_lock_t debug_latch;
1541#define buf_block_state_valid(block) \
1542(buf_block_get_state(block) >= BUF_BLOCK_NOT_USED \
1543 && (buf_block_get_state(block) <= BUF_BLOCK_REMOVE_HASH))
1545#ifndef UNIV_HOTBACKUP
1549#define BUF_POOL_ZIP_FOLD_PTR(ptr) ((ulint) (ptr) / UNIV_PAGE_SIZE)
1550#define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->frame)
1551#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
1611 ulint buddy_n_frames;
1614#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
1615 ulint mutex_exit_forbidden;
1739#if BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE
1740# error "BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE"
1750#define buf_pool_mutex_own(b) mutex_own(&b->mutex)
1752#define buf_pool_mutex_enter(b) do { \
1753 ut_ad(!mutex_own(&b->zip_mutex)); \
1754 mutex_enter(&b->mutex); \
1758#define buf_flush_list_mutex_own(b) mutex_own(&b->flush_list_mutex)
1761#define buf_flush_list_mutex_enter(b) do { \
1762 mutex_enter(&b->flush_list_mutex); \
1765# define buf_flush_list_mutex_exit(b) do { \
1766 mutex_exit(&b->flush_list_mutex); \
1771#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
1773# define buf_pool_mutex_exit_forbid(b) do { \
1774 ut_ad(buf_pool_mutex_own(b)); \
1775 b->mutex_exit_forbidden++; \
1778# define buf_pool_mutex_exit_allow(b) do { \
1779 ut_ad(buf_pool_mutex_own(b)); \
1780 ut_a(b->mutex_exit_forbidden); \
1781 b->mutex_exit_forbidden--; \
1784# define buf_pool_mutex_exit(b) do { \
1785 ut_a(!b->mutex_exit_forbidden); \
1786 mutex_exit(&b->mutex); \
1790# define buf_pool_mutex_exit_forbid(b) ((void) 0)
1792# define buf_pool_mutex_exit_allow(b) ((void) 0)
1794# define buf_pool_mutex_exit(b) mutex_exit(&b->mutex)
1844#include "buf0buf.ic"
UNIV_INLINE buf_pool_t * buf_pool_from_bpage(const buf_page_t *bpage)
UNIV_INLINE ib_uint64_t buf_page_get_newest_modification(const buf_page_t *bpage)
UNIV_INTERN ibool buf_pool_check_no_pending_io(void)
UNIV_INLINE unsigned buf_page_is_accessed(const buf_page_t *bpage) __attribute__((nonnull
UNIV_INLINE ulint buf_pool_index(const buf_pool_t *buf_pool) __attribute__((nonnull
UNIV_INLINE buf_pool_t * buf_pool_from_block(const buf_block_t *block)
UNIV_INTERN void buf_pool_free(ulint n_instances)
UNIV_INTERN ibool buf_pointer_is_block_field(const void *ptr)
UNIV_INLINE ibool buf_page_peek(ulint space, ulint offset)
UNIV_INLINE ulint buf_block_get_freed_page_clock(const buf_block_t *block) __attribute__((pure))
UNIV_INTERN void buf_get_total_stat(buf_pool_stat_t *tot_stat)
UNIV_INTERN const buf_block_t * buf_page_try_get_func(ulint space_id, ulint page_no, const char *file, ulint line, mtr_t *mtr)
UNIV_INLINE enum buf_flush buf_page_get_flush_type(const buf_page_t *bpage) __attribute__((pure))
UNIV_INLINE ulint buf_pool_get_curr_size(void)
UNIV_INTERN ulint buf_calc_page_old_checksum(const byte *page)
UNIV_INLINE ulint buf_block_get_zip_size(const buf_block_t *block) __attribute__((pure))
UNIV_INTERN buf_page_t * buf_pool_watch_set(ulint space, ulint offset, ulint fold) UNIV_WARN_UNUSED_RESULT
UNIV_INTERN ib_uint64_t buf_pool_get_oldest_modification(void)
UNIV_INLINE buf_pool_t * buf_pool_get(ulint space, ulint offset)
UNIV_INLINE ulint buf_page_address_fold(ulint space, ulint offset) __attribute__((const))
UNIV_INTERN void buf_page_make_young(buf_page_t *bpage)
UNIV_INLINE void buf_ptr_get_fsp_addr(const void *ptr, ulint *space, fil_addr_t *addr)
UNIV_INLINE enum buf_page_state buf_block_get_state(const buf_block_t *block) __attribute__((pure))
UNIV_INLINE ulint buf_page_get_space(const buf_page_t *bpage) __attribute__((pure))
UNIV_INLINE void buf_page_set_state(buf_page_t *bpage, enum buf_page_state state)
UNIV_INLINE ulint buf_block_get_lock_hash_val(const buf_block_t *block) __attribute__((pure))
UNIV_INTERN ibool buf_page_is_corrupted(const byte *read_buf, ulint zip_size)
UNIV_INLINE void buf_block_set_io_fix(buf_block_t *block, enum buf_io_fix io_fix)
#define BUF_POOL_WATCH_SIZE
UNIV_INLINE buf_block_t * buf_page_get_block(buf_page_t *bpage) __attribute__((pure))
UNIV_INTERN void buf_reset_check_index_page_at_flush(ulint space, ulint offset)
UNIV_INLINE enum buf_page_state buf_page_get_state(const buf_page_t *bpage)
UNIV_INTERN ibool buf_page_optimistic_get(ulint rw_latch, buf_block_t *block, ib_uint64_t modify_clock, const char *file, ulint line, mtr_t *mtr)
UNIV_INLINE ib_uint64_t buf_block_get_modify_clock(buf_block_t *block)
UNIV_INTERN buf_block_t * buf_page_create(ulint space, ulint offset, ulint zip_size, mtr_t *mtr)
UNIV_INLINE void buf_block_set_state(buf_block_t *block, enum buf_page_state state)
UNIV_INTERN void buf_pool_resize(void)
UNIV_INLINE enum buf_io_fix buf_page_get_io_fix(const buf_page_t *bpage) __attribute__((pure))
UNIV_INLINE void buf_block_free(buf_block_t *block)
UNIV_INTERN void buf_pool_drop_hash_index(void)
UNIV_INLINE void buf_pool_mutex_exit_all(void)
UNIV_INLINE void buf_page_release(buf_block_t *block, ulint rw_latch)
UNIV_INTERN void buf_pool_invalidate(void)
UNIV_INTERN void buf_refresh_io_stats_all(void)
UNIV_INLINE ibool buf_page_can_relocate(const buf_page_t *bpage) __attribute__((pure))
UNIV_INLINE void buf_page_release_zip(buf_page_t *bpage)
UNIV_INLINE ulint buf_block_get_space(const buf_block_t *block) __attribute__((pure))
UNIV_INTERN ibool buf_all_freed(void)
UNIV_INTERN buf_page_t * buf_page_init_for_read(ulint *err, ulint mode, ulint space, ulint zip_size, ibool unzip, ib_int64_t tablespace_version, ulint offset)
UNIV_INLINE buf_pool_t * buf_pool_from_array(ulint index)
UNIV_INLINE ulint buf_page_get_page_no(const buf_page_t *bpage) __attribute__((pure))
UNIV_INTERN buf_block_t * buf_block_align(const byte *ptr)
UNIV_INTERN buf_block_t * buf_page_get_gen(ulint space, ulint zip_size, ulint offset, ulint rw_latch, buf_block_t *guess, ulint mode, const char *file, ulint line, mtr_t *mtr)
UNIV_INLINE byte * buf_frame_copy(byte *buf, const buf_frame_t *frame)
UNIV_INTERN ulint buf_get_free_list_len(void)
UNIV_INLINE enum buf_io_fix buf_block_get_io_fix(const buf_block_t *block) __attribute__((pure))
UNIV_INTERN ulint buf_pool_init(ulint size, ulint n_instances)
UNIV_INTERN ibool buf_pool_watch_occurred(ulint space, ulint offset) UNIV_WARN_UNUSED_RESULT
UNIV_INTERN ibool buf_page_get_known_nowait(ulint rw_latch, buf_block_t *block, ulint mode, const char *file, ulint line, mtr_t *mtr)
UNIV_INLINE ibool buf_page_belongs_to_unzip_LRU(const buf_page_t *bpage) __attribute__((pure))
UNIV_INLINE void buf_block_set_file_page(buf_block_t *block, ulint space, ulint page_no)
UNIV_INLINE buf_block_t * buf_block_hash_get(buf_pool_t *buf_pool, ulint space, ulint offset)
UNIV_INLINE void buf_block_modify_clock_inc(buf_block_t *block)
UNIV_INTERN buf_page_t * buf_page_get_zip(ulint space, ulint zip_size, ulint offset)
UNIV_INLINE ibool buf_page_is_old(const buf_page_t *bpage) __attribute__((pure))
UNIV_INLINE void buf_page_set_io_fix(buf_page_t *bpage, enum buf_io_fix io_fix)
UNIV_INTERN void buf_print_io(FILE *file)
UNIV_INTERN void buf_page_io_complete(buf_page_t *bpage)
UNIV_INLINE void buf_page_set_flush_type(buf_page_t *bpage, enum buf_flush flush_type)
UNIV_INTERN ulint buf_get_modified_ratio_pct(void)
buf_page_state
States of a control block.
@ BUF_BLOCK_READY_FOR_USE
UNIV_INTERN buf_block_t * buf_block_alloc(buf_pool_t *buf_pool)
UNIV_INTERN ibool buf_pool_watch_is_sentinel(buf_pool_t *buf_pool, const buf_page_t *bpage) UNIV_WARN_UNUSED_RESULT
UNIV_INLINE buf_page_t * buf_page_hash_get_low(buf_pool_t *buf_pool, ulint space, ulint offset, ulint fold)
UNIV_INLINE void buf_pool_mutex_enter_all(void)
UNIV_INLINE ibool buf_page_peek_if_too_old(const buf_page_t *bpage)
UNIV_INLINE void buf_page_set_old(buf_page_t *bpage, ibool old)
UNIV_INLINE ulint buf_block_get_page_no(const buf_block_t *block) __attribute__((pure))
UNIV_INLINE ulint buf_pool_get_n_pages(void)
UNIV_INTERN void buf_pool_watch_unset(ulint space, ulint offset)
UNIV_INLINE ulint buf_page_get_freed_page_clock(const buf_page_t *bpage) __attribute__((pure))
UNIV_INTERN ibool buf_page_peek_if_search_hashed(ulint space, ulint offset)
UNIV_INLINE mutex_t * buf_page_get_mutex(const buf_page_t *bpage) __attribute__((pure))
UNIV_INLINE void buf_page_set_accessed(buf_page_t *bpage, ulint time_ms) __attribute__((nonnull))
UNIV_INLINE ibool buf_page_in_file(const buf_page_t *bpage) __attribute__((pure))
UNIV_INTERN void buf_refresh_io_stats(buf_pool_t *buf_pool)
UNIV_INTERN ulint buf_calc_page_new_checksum(const byte *page)
UNIV_INTERN ulint buf_get_n_pending_ios(void)
UNIV_INTERN ibool buf_zip_decompress(buf_block_t *block, ibool check)
UNIV_INTERN void buf_get_total_list_len(ulint *LRU_len, ulint *free_len, ulint *flush_list_len)
UNIV_INTERN void buf_relocate(buf_page_t *bpage, buf_page_t *dpage) __attribute__((nonnull))
UNIV_INLINE ulint buf_page_get_zip_size(const buf_page_t *bpage) __attribute__((pure))
UNIV_INLINE buf_page_t * buf_page_hash_get(buf_pool_t *buf_pool, ulint space, ulint offset)
UNIV_INTERN void buf_page_print(const byte *read_buf, ulint zip_size)
struct buf_pool_stat_struct buf_pool_stat_t
struct buf_chunk_struct buf_chunk_t
struct buf_pool_struct buf_pool_t
struct buf_page_struct buf_page_t
struct buf_buddy_stat_struct buf_buddy_stat_t
struct buf_block_struct buf_block_t
struct fil_addr_struct fil_addr_t
os_event_struct_t * os_event_t
struct page_zip_des_struct page_zip_des_t
ibool check_index_page_at_flush
UT_LIST_NODE_T(buf_block_t) unzip_LRU
ib_uint64_t relocated_usec
UT_LIST_NODE_T(buf_page_t) list
ib_uint64_t oldest_modification
ib_uint64_t newest_modification
unsigned freed_page_clock
UT_LIST_NODE_T(buf_page_t) LRU
double page_not_made_young_rate
ulint n_pages_not_made_young
double page_made_young_rate
double pages_evicted_rate
double pages_created_rate
ulint n_pending_flush_single_page
ulint n_pending_flush_list
ulint n_pending_flush_lru
double pages_written_rate
double pages_readahead_rate
ulint not_young_making_delta
The buffer pool statistics structure.
ulint n_pages_not_made_young
The buffer pool structure.
ibool init_flush[BUF_FLUSH_N_TYPES]
UT_LIST_BASE_NODE_T(buf_page_t) zip_clean
buf_page_t watch[BUF_POOL_WATCH_SIZE]
UT_LIST_BASE_NODE_T(buf_page_t) free
UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES_MAX]
ulint n_flush[BUF_FLUSH_N_TYPES]
time_t last_printout_time
UT_LIST_BASE_NODE_T(buf_block_t) unzip_LRU
os_event_t no_flush[BUF_FLUSH_N_TYPES]
buf_buddy_stat_t buddy_stat[BUF_BUDDY_SIZES_MAX+1]
UT_LIST_BASE_NODE_T(buf_page_t) LRU
UT_LIST_BASE_NODE_T(buf_page_t) flush_list