#include "univ.i"
#include "fil0fil.h"
#include "mtr0types.h"
#include "buf0types.h"
#include "hash0hash.h"
#include "ut0byte.h"
#include "page0types.h"
#include "ut0rbt.h"
#include "os0proc.h"
Go to the source code of this file.
Classes | |
struct | buf_pool_info_struct |
struct | buf_page_struct |
struct | buf_block_struct |
struct | buf_pool_stat_struct |
The buffer pool statistics structure. More... | |
struct | buf_buddy_stat_struct |
struct | buf_pool_struct |
The buffer pool structure. More... | |
Macros | |
#define | buf0buf_h |
#define | MAX_BUFFER_POOLS 64 |
#define | BUF_POOL_WATCH_SIZE 1 |
#define | BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL |
#define | buf_page_get(SP, ZS, OF, LA, MTR) |
#define | buf_page_get_with_no_latch(SP, ZS, OF, MTR) |
#define | buf_page_try_get(space_id, page_no, mtr) buf_page_try_get_func(space_id, page_no, __FILE__, __LINE__, mtr); |
#define | buf_block_dbg_add_level(block, level) /* nothing */ |
#define | buf_block_get_frame(block) (block)->frame |
#define | buf_block_get_page_zip(block) (UNIV_LIKELY_NULL((block)->page.zip.data) ? &(block)->page.zip : NULL) |
#define | buf_pool_is_block_mutex(m) buf_pointer_is_block_field((const void*)(m)) |
#define | buf_pool_is_block_lock(l) buf_pointer_is_block_field((const void*)(l)) |
#define | buf_block_state_valid(block) |
Modes for buf_page_get_gen | |
#define | BUF_GET 10 |
#define | BUF_GET_IF_IN_POOL 11 |
#define | BUF_PEEK_IF_IN_POOL 12 |
#define | BUF_GET_NO_LATCH 14 |
#define | BUF_GET_IF_IN_POOL_OR_WATCH 15 |
Modes for buf_page_get_known_nowait | |
#define | BUF_MAKE_YOUNG 51 |
#define | BUF_KEEP_OLD 52 |
#define | BUF_POOL_ZIP_FOLD_PTR(ptr) ((ulint) (ptr) / UNIV_PAGE_SIZE) |
#define | BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->frame) |
#define | BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b)) |
Accessors for buf_pool->mutex. | |
Use these instead of accessing buf_pool->mutex directly. | |
#define | buf_pool_mutex_own(b) mutex_own(&b->mutex) |
#define | buf_pool_mutex_enter(b) |
#define | buf_flush_list_mutex_own(b) mutex_own(&b->flush_list_mutex) |
#define | buf_flush_list_mutex_enter(b) |
#define | buf_flush_list_mutex_exit(b) |
#define | buf_pool_mutex_exit_forbid(b) ((void) 0) |
#define | buf_pool_mutex_exit_allow(b) ((void) 0) |
#define | buf_pool_mutex_exit(b) mutex_exit(&b->mutex) |
Typedefs | |
typedef struct buf_pool_info_struct | buf_pool_info_t |
Enumerations | |
enum | buf_page_state { BUF_BLOCK_ZIP_FREE = 0, BUF_BLOCK_POOL_WATCH = 0, BUF_BLOCK_ZIP_PAGE, BUF_BLOCK_ZIP_DIRTY, BUF_BLOCK_NOT_USED, BUF_BLOCK_READY_FOR_USE, BUF_BLOCK_FILE_PAGE, BUF_BLOCK_MEMORY, BUF_BLOCK_REMOVE_HASH } |
States of a control block. More... | |
Functions | |
UNIV_INLINE void | buf_pool_mutex_enter_all (void) |
UNIV_INLINE void | buf_pool_mutex_exit_all (void) |
UNIV_INTERN ulint | buf_pool_init (ulint size, ulint n_instances) |
UNIV_INTERN void | buf_pool_free (ulint n_instances) |
UNIV_INTERN void | buf_pool_drop_hash_index (void) |
UNIV_INTERN void | buf_relocate (buf_page_t *bpage, buf_page_t *dpage) __attribute__((nonnull)) |
UNIV_INTERN void | buf_pool_resize (void) |
UNIV_INLINE ulint | buf_pool_get_curr_size (void) |
UNIV_INLINE ulint | buf_pool_get_n_pages (void) |
UNIV_INTERN ib_uint64_t | buf_pool_get_oldest_modification (void) |
UNIV_INTERN buf_block_t * | buf_block_alloc (buf_pool_t *buf_pool) |
UNIV_INLINE void | buf_block_free (buf_block_t *block) |
UNIV_INLINE byte * | buf_frame_copy (byte *buf, const buf_frame_t *frame) |
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_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_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_INTERN buf_page_t * | buf_page_get_zip (ulint space, ulint zip_size, ulint offset) |
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_INTERN buf_block_t * | buf_page_create (ulint space, ulint offset, ulint zip_size, mtr_t *mtr) |
UNIV_INLINE void | buf_page_release_zip (buf_page_t *bpage) |
UNIV_INLINE void | buf_page_release (buf_block_t *block, ulint rw_latch) |
UNIV_INTERN void | buf_page_make_young (buf_page_t *bpage) |
UNIV_INLINE ibool | buf_page_peek (ulint space, ulint offset) |
UNIV_INTERN void | buf_reset_check_index_page_at_flush (ulint space, ulint offset) |
UNIV_INLINE ulint | buf_page_get_freed_page_clock (const buf_page_t *bpage) __attribute__((pure)) |
UNIV_INLINE ulint | buf_block_get_freed_page_clock (const buf_block_t *block) __attribute__((pure)) |
UNIV_INLINE ibool | buf_page_peek_if_too_old (const buf_page_t *bpage) |
UNIV_INTERN ibool | buf_page_peek_if_search_hashed (ulint space, ulint offset) |
UNIV_INLINE ib_uint64_t | buf_page_get_newest_modification (const buf_page_t *bpage) |
UNIV_INLINE void | buf_block_modify_clock_inc (buf_block_t *block) |
UNIV_INLINE ib_uint64_t | buf_block_get_modify_clock (buf_block_t *block) |
UNIV_INTERN ulint | buf_calc_page_new_checksum (const byte *page) |
UNIV_INTERN ulint | buf_calc_page_old_checksum (const byte *page) |
UNIV_INTERN ibool | buf_page_is_corrupted (const byte *read_buf, ulint zip_size) |
UNIV_INLINE void | buf_ptr_get_fsp_addr (const void *ptr, ulint *space, fil_addr_t *addr) |
UNIV_INLINE ulint | buf_block_get_lock_hash_val (const buf_block_t *block) __attribute__((pure)) |
UNIV_INTERN void | buf_page_print (const byte *read_buf, ulint zip_size) |
UNIV_INTERN ibool | buf_zip_decompress (buf_block_t *block, ibool check) |
UNIV_INTERN ulint | buf_get_n_pending_ios (void) |
UNIV_INTERN void | buf_print_io (FILE *file) |
UNIV_INTERN ulint | buf_get_modified_ratio_pct (void) |
UNIV_INTERN void | buf_refresh_io_stats (buf_pool_t *buf_pool) |
UNIV_INTERN void | buf_refresh_io_stats_all (void) |
UNIV_INTERN ibool | buf_all_freed (void) |
UNIV_INTERN ibool | buf_pool_check_no_pending_io (void) |
UNIV_INTERN void | buf_pool_invalidate (void) |
UNIV_INLINE enum buf_page_state | buf_page_get_state (const buf_page_t *bpage) |
UNIV_INLINE enum buf_page_state | buf_block_get_state (const buf_block_t *block) __attribute__((pure)) |
UNIV_INLINE void | buf_page_set_state (buf_page_t *bpage, enum buf_page_state state) |
UNIV_INLINE void | buf_block_set_state (buf_block_t *block, enum buf_page_state state) |
UNIV_INLINE ibool | buf_page_in_file (const buf_page_t *bpage) __attribute__((pure)) |
UNIV_INLINE ibool | buf_page_belongs_to_unzip_LRU (const buf_page_t *bpage) __attribute__((pure)) |
UNIV_INLINE mutex_t * | buf_page_get_mutex (const buf_page_t *bpage) __attribute__((pure)) |
UNIV_INLINE enum buf_flush | buf_page_get_flush_type (const buf_page_t *bpage) __attribute__((pure)) |
UNIV_INLINE void | buf_page_set_flush_type (buf_page_t *bpage, enum buf_flush flush_type) |
UNIV_INLINE void | buf_block_set_file_page (buf_block_t *block, ulint space, ulint page_no) |
UNIV_INLINE enum buf_io_fix | buf_page_get_io_fix (const buf_page_t *bpage) __attribute__((pure)) |
UNIV_INLINE enum buf_io_fix | buf_block_get_io_fix (const buf_block_t *block) __attribute__((pure)) |
UNIV_INLINE void | buf_page_set_io_fix (buf_page_t *bpage, enum buf_io_fix io_fix) |
UNIV_INLINE void | buf_block_set_io_fix (buf_block_t *block, enum buf_io_fix io_fix) |
UNIV_INLINE ibool | buf_page_can_relocate (const buf_page_t *bpage) __attribute__((pure)) |
UNIV_INLINE ibool | buf_page_is_old (const buf_page_t *bpage) __attribute__((pure)) |
UNIV_INLINE void | buf_page_set_old (buf_page_t *bpage, ibool old) |
UNIV_INLINE unsigned | buf_page_is_accessed (const buf_page_t *bpage) __attribute__((nonnull |
UNIV_INLINE void | buf_page_set_accessed (buf_page_t *bpage, ulint time_ms) __attribute__((nonnull)) |
UNIV_INLINE buf_block_t * | buf_page_get_block (buf_page_t *bpage) __attribute__((pure)) |
UNIV_INLINE ulint | buf_page_get_space (const buf_page_t *bpage) __attribute__((pure)) |
UNIV_INLINE ulint | buf_block_get_space (const buf_block_t *block) __attribute__((pure)) |
UNIV_INLINE ulint | buf_page_get_page_no (const buf_page_t *bpage) __attribute__((pure)) |
UNIV_INLINE ulint | buf_block_get_page_no (const buf_block_t *block) __attribute__((pure)) |
UNIV_INLINE ulint | buf_page_get_zip_size (const buf_page_t *bpage) __attribute__((pure)) |
UNIV_INLINE ulint | buf_block_get_zip_size (const buf_block_t *block) __attribute__((pure)) |
UNIV_INTERN buf_block_t * | buf_block_align (const byte *ptr) |
UNIV_INTERN ibool | buf_pointer_is_block_field (const void *ptr) |
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_INTERN void | buf_page_io_complete (buf_page_t *bpage) |
UNIV_INLINE ulint | buf_page_address_fold (ulint space, ulint offset) __attribute__((const )) |
UNIV_INLINE ulint | buf_pool_index (const buf_pool_t *buf_pool) __attribute__((nonnull |
UNIV_INLINE buf_pool_t * | buf_pool_from_bpage (const buf_page_t *bpage) |
UNIV_INLINE buf_pool_t * | buf_pool_from_block (const buf_block_t *block) |
UNIV_INLINE buf_pool_t * | buf_pool_get (ulint space, ulint offset) |
UNIV_INLINE buf_pool_t * | buf_pool_from_array (ulint index) |
UNIV_INLINE buf_page_t * | buf_page_hash_get_low (buf_pool_t *buf_pool, ulint space, ulint offset, ulint fold) |
UNIV_INLINE buf_page_t * | buf_page_hash_get (buf_pool_t *buf_pool, ulint space, ulint offset) |
UNIV_INLINE buf_block_t * | buf_block_hash_get (buf_pool_t *buf_pool, ulint space, ulint offset) |
UNIV_INTERN ulint | buf_get_free_list_len (void) |
UNIV_INTERN ibool | buf_pool_watch_is_sentinel (buf_pool_t *buf_pool, const buf_page_t *bpage) UNIV_WARN_UNUSED_RESULT |
UNIV_INTERN buf_page_t * | buf_pool_watch_set (ulint space, ulint offset, ulint fold) UNIV_WARN_UNUSED_RESULT |
UNIV_INTERN void | buf_pool_watch_unset (ulint space, ulint offset) |
UNIV_INTERN ibool | buf_pool_watch_occurred (ulint space, ulint offset) UNIV_WARN_UNUSED_RESULT |
UNIV_INTERN void | buf_get_total_list_len (ulint *LRU_len, ulint *free_len, ulint *flush_list_len) |
UNIV_INTERN void | buf_get_total_stat (buf_pool_stat_t *tot_stat) |
Variables | |
buf_pool_t * | buf_pool_ptr |
UNIV_INLINE unsigned | pure |
UNIV_INLINE ulint | const |
The database buffer pool high-level routines
Created 11/5/1995 Heikki Tuuri
Definition in file buf0buf.h.
#define buf_block_get_page_zip | ( | block | ) | (UNIV_LIKELY_NULL((block)->page.zip.data) ? &(block)->page.zip : NULL) |
Gets the compressed page descriptor corresponding to an uncompressed page if applicable.
Definition at line 1034 of file buf0buf.h.
Referenced by btr_compress(), btr_create(), btr_cur_del_mark_set_clust_rec(), btr_cur_del_mark_set_sec_rec(), btr_cur_optimistic_update(), btr_cur_search_to_nth_level(), btr_cur_update_alloc_zip(), btr_cur_update_in_place(), btr_discard_page(), btr_page_split_and_insert(), btr_root_raise_and_insert(), ibuf_merge_or_delete_for_page(), ibuf_update_free_bits_low(), lock_rec_insert_check_and_lock(), lock_sec_rec_modify_check_and_lock(), page_copy_rec_list_end(), page_copy_rec_list_start(), page_create_zip(), page_cur_insert_rec_zip(), page_cur_parse_delete_rec(), page_cur_parse_insert_rec(), page_cur_search_with_match(), page_delete_rec_list_end(), page_delete_rec_list_start(), page_parse_copy_rec_list_to_created_page(), page_zip_reorganize(), and recv_recover_page_func().
#define buf_block_state_valid | ( | block | ) |
Check if a buf_block_t object is in a valid state
block | buffer block |
#define buf_flush_list_mutex_enter | ( | b | ) |
Acquire the flush list mutex.
Definition at line 1774 of file buf0buf.h.
Referenced by buf_flush_free_flush_rbt(), buf_flush_init_flush_rbt(), buf_flush_relocate_on_flush_list(), buf_flush_remove(), and buf_pool_get_oldest_modification().
#define buf_flush_list_mutex_exit | ( | b | ) |
Release the flush list mutex.
Definition at line 1778 of file buf0buf.h.
Referenced by buf_flush_free_flush_rbt(), buf_flush_init_flush_rbt(), buf_flush_relocate_on_flush_list(), buf_flush_remove(), and buf_pool_get_oldest_modification().
#define buf_flush_list_mutex_own | ( | b | ) | mutex_own(&b->flush_list_mutex) |
#define BUF_GET 10 |
get always
Definition at line 43 of file buf0buf.h.
Referenced by btr_cur_open_at_rnd_pos_func(), btr_cur_search_to_nth_level(), buf_page_get_gen(), and trx_undo_report_row_operation().
#define BUF_GET_IF_IN_POOL 11 |
get if in pool
Definition at line 44 of file buf0buf.h.
Referenced by btr_cur_search_to_nth_level(), and buf_page_get_gen().
#define BUF_GET_IF_IN_POOL_OR_WATCH 15 |
Get the page only if it's in the buffer pool, if not then set a watch on the page.
Definition at line 59 of file buf0buf.h.
Referenced by btr_cur_search_to_nth_level(), and buf_page_get_gen().
#define BUF_GET_NO_LATCH 14 |
get and bufferfix, but set no latch; we have separated this case, because it is error-prone programming not to set a latch, and it should be used with care
Definition at line 48 of file buf0buf.h.
Referenced by buf_page_get_gen(), and ibuf_page_low().
#define BUF_KEEP_OLD 52 |
Preserve the current LRU position of the block.
Definition at line 75 of file buf0buf.h.
Referenced by buf_page_get_known_nowait(), ibuf_merge_or_delete_for_page(), and recv_recover_page_func().
#define BUF_MAKE_YOUNG 51 |
Move the block to the start of the LRU list if there is a danger that the block would drift out of the buffer pool
Definition at line 66 of file buf0buf.h.
Referenced by btr_search_guess_on_hash(), and buf_page_get_known_nowait().
#define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL |
Magic value to use instead of checksums when they are disabled
Definition at line 101 of file buf0buf.h.
Referenced by buf_flush_init_for_writing(), buf_LRU_free_block(), buf_page_is_corrupted(), buf_page_print(), and buf_zip_decompress().
#define buf_page_get | ( | SP, | |
ZS, | |||
OF, | |||
LA, | |||
MTR | |||
) |
NOTE! The following macros should be used instead of buf_page_get_gen, to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed in LA!
Definition at line 316 of file buf0buf.h.
Referenced by btr_create(), btr_page_alloc(), dict_hdr_get(), fseg_create_general(), fsp_header_init(), recv_apply_hashed_log_recs(), trx_sys_create_doublewrite_buf(), and trx_sys_mark_upgraded_to_multiple_tablespaces().
#define buf_page_get_with_no_latch | ( | SP, | |
ZS, | |||
OF, | |||
MTR | |||
) |
Use these macros to bufferfix a page with no latching. Remember not to read the contents of the page unless you know it is safe. Do not modify the contents of the page! We have separated this case, because it is error-prone programming not to set a latch, and it should be used with care.
Definition at line 325 of file buf0buf.h.
Referenced by btr_get_next_user_rec(), btr_get_prev_user_rec(), buf_page_create(), and lock_print_info_all_transactions().
#define buf_page_try_get | ( | space_id, | |
page_no, | |||
mtr | |||
) | buf_page_try_get_func(space_id, page_no, __FILE__, __LINE__, mtr); |
Tries to get a page. If the page is not in the buffer pool it is not loaded. Suitable for using when holding the kernel mutex.
space_id | in: tablespace id |
page_no | in: page number |
mtr | in: mini-transaction |
Definition at line 378 of file buf0buf.h.
Referenced by lock_rec_print().
#define BUF_PEEK_IF_IN_POOL 12 |
get if in pool, do not make the block young in the LRU list
Definition at line 45 of file buf0buf.h.
Referenced by btr_search_drop_page_hash_when_freed(), and buf_page_get_gen().
#define buf_pool_is_block_lock | ( | l | ) | buf_pointer_is_block_field((const void*)(l)) |
Find out if a pointer corresponds to a buf_block_t::lock.
l | in: rw-lock candidate |
Definition at line 1063 of file buf0buf.h.
Referenced by innodb_mutex_show_status().
#define buf_pool_is_block_mutex | ( | m | ) | buf_pointer_is_block_field((const void*)(m)) |
Find out if a pointer corresponds to a buf_block_t::mutex.
m | in: mutex candidate |
Definition at line 1058 of file buf0buf.h.
Referenced by innodb_mutex_show_status().
#define buf_pool_mutex_enter | ( | b | ) |
Acquire a buffer pool mutex.
Definition at line 1765 of file buf0buf.h.
Referenced by buf_LRU_buf_pool_running_out(), buf_LRU_file_dump(), buf_LRU_free_block(), buf_LRU_search_and_free_block(), buf_LRU_try_free_flushed_blocks(), buf_page_create(), buf_page_get_gen(), buf_page_get_known_nowait(), buf_page_get_zip(), buf_page_init_for_read(), buf_page_io_complete(), buf_page_make_young(), buf_page_peek_if_search_hashed(), buf_page_try_get_func(), buf_pool_watch_occurred(), buf_pool_watch_unset(), buf_read_ahead_linear(), buf_reset_check_index_page_at_flush(), and ibuf_insert().
#define buf_pool_mutex_exit | ( | b | ) | mutex_exit(&b->mutex) |
Release the buffer pool mutex.
Definition at line 1807 of file buf0buf.h.
Referenced by buf_LRU_buf_pool_running_out(), buf_LRU_file_dump(), buf_LRU_free_block(), buf_LRU_search_and_free_block(), buf_LRU_try_free_flushed_blocks(), buf_page_create(), buf_page_get_gen(), buf_page_get_known_nowait(), buf_page_get_zip(), buf_page_init_for_read(), buf_page_io_complete(), buf_page_make_young(), buf_page_peek_if_search_hashed(), buf_page_try_get_func(), buf_pool_watch_occurred(), buf_pool_watch_unset(), buf_read_ahead_linear(), buf_reset_check_index_page_at_flush(), and ibuf_insert().
#define buf_pool_mutex_exit_allow | ( | b | ) | ((void) 0) |
Allow the release of the buffer pool mutex.
Definition at line 1805 of file buf0buf.h.
Referenced by buf_LRU_block_free_non_file_page(), and buf_LRU_free_block().
#define buf_pool_mutex_exit_forbid | ( | b | ) | ((void) 0) |
Forbid the release of the buffer pool mutex.
Definition at line 1803 of file buf0buf.h.
Referenced by buf_LRU_block_free_non_file_page(), and buf_LRU_free_block().
#define buf_pool_mutex_own | ( | b | ) | mutex_own(&b->mutex) |
Test if a buffer pool mutex is owned.
Definition at line 1763 of file buf0buf.h.
Referenced by buf_flush_ready_for_replace(), buf_flush_relocate_on_flush_list(), buf_flush_remove(), buf_LRU_block_free_non_file_page(), buf_LRU_free_block(), buf_LRU_get_free_only(), buf_LRU_insert_zip_clean(), buf_LRU_make_block_young(), buf_pool_watch_set(), buf_relocate(), and buf_unzip_LRU_add_block().
#define BUF_POOL_WATCH_SIZE 1 |
Maximum number of concurrent buffer pool watches
Definition at line 84 of file buf0buf.h.
Referenced by buf_pool_watch_is_sentinel(), and buf_pool_watch_set().
#define BUF_POOL_ZIP_FOLD_PTR | ( | ptr | ) | ((ulint) (ptr) / UNIV_PAGE_SIZE) |
#define MAX_BUFFER_POOLS 64 |
The maximum number of buffer pools that can be defined
Definition at line 80 of file buf0buf.h.
Referenced by buf_pool_init(), and srv_master_thread().
enum buf_page_state |
States of a control block.
The enumeration values must be 0..7.
Enumerator | |
---|---|
BUF_BLOCK_ZIP_FREE |
contains a free compressed page |
BUF_BLOCK_POOL_WATCH |
a sentinel for the buffer pool watch, element of buf_pool->watch[] |
BUF_BLOCK_ZIP_PAGE |
contains a clean compressed page |
BUF_BLOCK_ZIP_DIRTY |
contains a compressed page that is in the buf_pool->flush_list |
BUF_BLOCK_NOT_USED |
is in the free list; must be after the BUF_BLOCK_ZIP_ constants for compressed-only pages
|
BUF_BLOCK_READY_FOR_USE |
when buf_LRU_get_free_block returns a block, it is in this state |
BUF_BLOCK_FILE_PAGE |
contains a buffered file page |
BUF_BLOCK_MEMORY |
contains some main memory object |
BUF_BLOCK_REMOVE_HASH |
hash index should be removed before putting to the free list |
UNIV_INTERN ibool buf_all_freed | ( | void | ) |
Asserts that all file pages in the buffer are in a replaceable state.
Check if all pages in all buffer pools are in a replacable state.
Definition at line 5173 of file buf0buf.cc.
References buf_pool_from_array(), and srv_buf_pool_instances.
Referenced by logs_empty_and_mark_files_at_shutdown().
UNIV_INTERN buf_block_t* buf_block_align | ( | const byte * | ptr | ) |
Gets the block to whose frame the pointer is pointing to.
Gets the block to whose frame the pointer is pointing to.
ptr | in: pointer to a frame |
Definition at line 2610 of file buf0buf.cc.
References buf_pool_from_array(), srv_buf_pool_instances, and ut_error.
Referenced by btr_search_guess_on_hash().
UNIV_INTERN buf_block_t* buf_block_alloc | ( | buf_pool_t * | buf_pool | ) |
Allocates a buffer block.
Allocates a buffer block.
buf_pool | in/out: buffer pool instance, or NULL for round-robin selection of the buffer pool |
Definition at line 420 of file buf0buf.cc.
References BUF_BLOCK_MEMORY, buf_block_set_state(), buf_LRU_get_free_block(), buf_pool_from_array(), buf_pool_index(), and srv_buf_pool_instances.
Referenced by page_zip_reorganize().
UNIV_INLINE void buf_block_free | ( | buf_block_t * | block | ) |
Frees a buffer block which does not contain a file page. in, own: block to be freed
Referenced by buf_page_create(), and page_zip_reorganize().
UNIV_INLINE ulint buf_block_get_freed_page_clock | ( | const buf_block_t * | block | ) |
Reads the freed_page_clock of a buffer block.
block | in: block |
UNIV_INLINE enum buf_io_fix buf_block_get_io_fix | ( | const buf_block_t * | block | ) |
Gets the io_fix state of a block.
block | in: pointer to the control block |
Referenced by buf_page_get_gen().
UNIV_INLINE ulint buf_block_get_lock_hash_val | ( | const buf_block_t * | block | ) |
Gets the hash value of a block. This can be used in searches in the lock hash table.
block | in: block |
UNIV_INLINE ib_uint64_t buf_block_get_modify_clock | ( | buf_block_t * | block | ) |
Returns the value of the modify clock. The caller must have an s-lock or x-lock on the block.
Referenced by btr_pcur_restore_position_func(), and btr_pcur_store_position().
UNIV_INLINE ulint buf_block_get_page_no | ( | const buf_block_t * | block | ) |
Gets the page number of a block.
block | in: pointer to the control block |
Referenced by btr_compress(), btr_create(), btr_discard_page(), btr_page_free_low(), btr_page_split_and_insert(), btr_pcur_move_to_next_page(), btr_root_raise_and_insert(), buf_page_create(), buf_page_get_gen(), buf_page_get_known_nowait(), buf_page_optimistic_get(), buf_page_try_get_func(), ibuf_merge_or_delete_for_page(), lock_move_rec_list_end(), lock_move_rec_list_start(), lock_move_reorganize_page(), recv_recover_page_func(), and trx_rseg_header_create().
UNIV_INLINE ulint buf_block_get_space | ( | const buf_block_t * | block | ) |
Gets the space id of a block.
block | in: pointer to the control block |
Referenced by btr_page_free_low(), btr_pcur_move_to_next_page(), buf_page_create(), buf_page_get_gen(), buf_page_get_known_nowait(), buf_page_optimistic_get(), buf_page_try_get_func(), buf_zip_decompress(), ibuf_merge_or_delete_for_page(), lock_move_rec_list_end(), lock_move_rec_list_start(), lock_move_reorganize_page(), and recv_recover_page_func().
UNIV_INLINE enum buf_page_state buf_block_get_state | ( | const buf_block_t * | block | ) |
Gets the state of a block.
block | in: pointer to the control block |
Referenced by btr_search_guess_on_hash(), buf_LRU_block_free_non_file_page(), buf_page_get_gen(), buf_page_get_known_nowait(), buf_page_optimistic_get(), buf_page_peek_if_search_hashed(), buf_page_try_get_func(), and buf_reset_check_index_page_at_flush().
UNIV_INLINE ulint buf_block_get_zip_size | ( | const buf_block_t * | block | ) |
Gets the compressed page size of a block.
block | in: pointer to the control block |
Referenced by btr_page_split_and_insert(), btr_pcur_move_to_next_page(), buf_flush_free_flush_rbt(), buf_page_optimistic_get(), buf_zip_decompress(), and ibuf_merge_or_delete_for_page().
UNIV_INLINE buf_block_t* buf_block_hash_get | ( | buf_pool_t * | buf_pool, |
ulint | space, | ||
ulint | offset | ||
) |
Returns the control block of a file page, NULL if not found or an uncompressed page frame does not exist.
buf_pool | in: buffer pool instance |
space | in: space id |
Referenced by buf_page_try_get_func().
UNIV_INLINE void buf_block_modify_clock_inc | ( | buf_block_t * | block | ) |
Increments the modify clock of a frame by 1. The caller must (1) own the buf_pool->mutex and block bufferfix count has to be zero, (2) or own an x-lock on the block. in: block
Referenced by btr_page_free_low(), page_cur_delete_rec(), and page_delete_rec_list_end().
UNIV_INLINE void buf_block_set_file_page | ( | buf_block_t * | block, |
ulint | space, | ||
ulint | page_no | ||
) |
Map a block to a file page. in: page number
block | in/out: pointer to control block |
space | in: tablespace id |
UNIV_INLINE void buf_block_set_io_fix | ( | buf_block_t * | block, |
enum buf_io_fix | io_fix | ||
) |
Sets the io_fix state of a block. in: io_fix state
block | in/out: control block |
Referenced by buf_page_get_gen().
UNIV_INLINE void buf_block_set_state | ( | buf_block_t * | block, |
enum buf_page_state | state | ||
) |
Sets the state of a block. in: state
block | in/out: pointer to control block |
Referenced by buf_block_alloc(), buf_LRU_block_free_non_file_page(), and buf_LRU_get_free_only().
UNIV_INTERN ulint buf_calc_page_new_checksum | ( | const byte * | page | ) |
Calculates a page checksum which is stored to the page when it is written to a file. Note that we must be careful to calculate the same value on 32-bit and 64-bit architectures.
Calculates a page checksum which is stored to the page when it is written to a file. Note that we must be careful to calculate the same value on 32-bit and 64-bit architectures.
page | in: buffer page |
Definition at line 451 of file buf0buf.cc.
References FIL_PAGE_DATA, FIL_PAGE_END_LSN_OLD_CHKSUM, FIL_PAGE_FILE_FLUSH_LSN, FIL_PAGE_OFFSET, and ut_fold_binary().
Referenced by buf_flush_init_for_writing(), buf_page_is_corrupted(), and buf_page_print().
UNIV_INTERN ulint buf_calc_page_old_checksum | ( | const byte * | page | ) |
In versions < 4.0.14 and < 4.1.1 there was a bug that the checksum only looked at the first few bytes of the page. This calculates that old checksum. NOTE: we must first store the new formula checksum to FIL_PAGE_SPACE_OR_CHKSUM before calculating and storing this old checksum because this takes that field as an input!
In versions < 4.0.14 and < 4.1.1 there was a bug that the checksum only looked at the first few bytes of the page. This calculates that old checksum. NOTE: we must first store the new formula checksum to FIL_PAGE_SPACE_OR_CHKSUM before calculating and storing this old checksum because this takes that field as an input!
page | in: buffer page |
Definition at line 485 of file buf0buf.cc.
References FIL_PAGE_FILE_FLUSH_LSN, and ut_fold_binary().
Referenced by buf_flush_init_for_writing(), buf_page_is_corrupted(), and buf_page_print().
UNIV_INLINE byte* buf_frame_copy | ( | byte * | buf, |
const buf_frame_t * | frame | ||
) |
Copies contents of a buffer frame to a given buffer.
buf | in: buffer to copy to |
Referenced by page_zip_reorganize().
UNIV_INTERN ulint buf_get_free_list_len | ( | void | ) |
Gets the current length of the free list of buffer blocks.
UNIV_INTERN ulint buf_get_modified_ratio_pct | ( | void | ) |
Returns the ratio in percents of modified pages in the buffer pool / database pages in the buffer pool.
Definition at line 4796 of file buf0buf.cc.
References buf_get_total_list_len().
Referenced by srv_master_thread().
UNIV_INTERN ulint buf_get_n_pending_ios | ( | void | ) |
Returns the number of pending buf pool ios.
Definition at line 4769 of file buf0buf.cc.
References BUF_FLUSH_LIST, BUF_FLUSH_LRU, BUF_FLUSH_SINGLE_PAGE, buf_pool_from_array(), buf_pool_struct::n_flush, buf_pool_struct::n_pend_reads, and srv_buf_pool_instances.
Referenced by srv_master_thread().
UNIV_INTERN void buf_get_total_list_len | ( | ulint * | LRU_len, |
ulint * | free_len, | ||
ulint * | flush_list_len | ||
) |
Get total buffer pool statistics. out: length of all flush lists
Get total buffer pool statistics.
LRU_len | out: length of all LRU lists |
free_len | out: length of all free lists |
flush_list_len | out: length of all flush lists |
Definition at line 361 of file buf0buf.cc.
References buf_pool_from_array(), srv_buf_pool_instances, and UT_LIST_GET_LEN.
Referenced by buf_get_modified_ratio_pct(), and srv_export_innodb_status().
UNIV_INTERN void buf_get_total_stat | ( | buf_pool_stat_t * | tot_stat | ) |
Get total buffer pool statistics. out: buffer pool stats
Get total buffer pool statistics.
tot_stat | out: buffer pool stats |
Definition at line 387 of file buf0buf.cc.
References buf_pool_from_array(), buf_pool_stat_struct::n_page_gets, buf_pool_stat_struct::n_pages_created, buf_pool_stat_struct::n_pages_made_young, buf_pool_stat_struct::n_pages_not_made_young, buf_pool_stat_struct::n_pages_read, buf_pool_stat_struct::n_pages_written, buf_pool_stat_struct::n_ra_pages_evicted, buf_pool_stat_struct::n_ra_pages_read, srv_buf_pool_instances, and buf_pool_struct::stat.
Referenced by srv_export_innodb_status(), and srv_master_thread().
UNIV_INLINE ulint buf_page_address_fold | ( | ulint | space, |
ulint | offset | ||
) | const |
Calculates a folded value of a file page address to use in the page hash table.
space | in: space id |
offset | in: offset of the page within space |
Referenced by buf_LRU_free_block(), buf_page_create(), buf_page_get_gen(), buf_page_init_for_read(), buf_pool_watch_occurred(), buf_pool_watch_unset(), buf_relocate(), and ibuf_insert().
UNIV_INLINE ibool buf_page_belongs_to_unzip_LRU | ( | const buf_page_t * | bpage | ) |
Determines if a block should be on unzip_LRU list.
bpage | in: pointer to control block |
Referenced by buf_page_create(), buf_page_init_for_read(), and buf_unzip_LRU_add_block().
UNIV_INLINE ibool buf_page_can_relocate | ( | const buf_page_t * | bpage | ) |
Determine if a buffer block can be relocated in memory. The block can be dirty, but it must not be I/O-fixed or bufferfixed.
bpage | control block being relocated |
Referenced by buf_LRU_free_block().
UNIV_INTERN buf_block_t* buf_page_create | ( | ulint | space, |
ulint | offset, | ||
ulint | zip_size, | ||
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).
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).
space | in: space id |
offset | in: offset of the page within space in units of a page |
zip_size | in: compressed page size, or 0 |
mtr | in: mini-transaction handle |
Definition at line 3794 of file buf0buf.cc.
References buf_block_free(), buf_block_get_page_no(), buf_block_get_space(), buf_buddy_alloc(), buf_flush_free_margin(), BUF_IO_NONE, BUF_IO_READ, buf_LRU_add_block(), buf_LRU_get_free_block(), buf_page_address_fold(), buf_page_belongs_to_unzip_LRU(), buf_page_get_with_no_latch, buf_page_hash_get_low(), buf_page_in_file(), buf_page_set_accessed(), buf_page_set_io_fix(), buf_pool_get(), buf_pool_mutex_enter, buf_pool_mutex_exit, buf_pool_watch_is_sentinel(), buf_unzip_LRU_add_block(), page_zip_des_struct::data, FIL_PAGE_FILE_FLUSH_LSN, FIL_PAGE_NEXT, FIL_PAGE_PREV, FIL_PAGE_TYPE, FIL_PAGE_TYPE_ALLOCATED, buf_block_struct::frame, ibuf_merge_or_delete_for_page(), buf_block_struct::lock, mach_write_to_2(), mtr_memo_push(), buf_block_struct::mutex, buf_pool_stat_struct::n_pages_created, buf_block_struct::page, page_zip_set_size(), buf_pool_struct::stat, ut_a, ut_ad, ut_time_ms(), and buf_page_struct::zip.
Referenced by fsp_header_init().
UNIV_INLINE buf_block_t* buf_page_get_block | ( | buf_page_t * | bpage | ) |
Gets the buf_block_t handle of a buffered file block if an uncompressed page frame exists, or NULL. Note: even though bpage is not declared a const we don't update its value. It is safe to make this pure.
bpage | in: control block, or NULL |
UNIV_INLINE enum buf_flush buf_page_get_flush_type | ( | const buf_page_t * | bpage | ) |
Get the flush type of a page.
bpage | in: buffer page |
Referenced by buf_flush_write_complete().
UNIV_INLINE ulint buf_page_get_freed_page_clock | ( | const buf_page_t * | bpage | ) |
Reads the freed_page_clock of a buffer block.
bpage | in: block |
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 | ||
) |
This is the general function used to get access to a database page.
This is the general function used to get access to a database page.
space | in: space id |
zip_size | in: compressed page size in bytes or 0 for uncompressed pages |
offset | in: page number |
rw_latch | in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH |
guess | in: guessed block or NULL |
mode | in: BUF_GET, BUF_GET_IF_IN_POOL, BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH |
file | in: file name |
line | in: line where called |
mtr | in: mini-transaction |
Definition at line 2712 of file buf0buf.cc.
References BUF_BLOCK_FILE_PAGE, buf_block_get_io_fix(), buf_block_get_page_no(), buf_block_get_space(), buf_block_get_state(), BUF_BLOCK_MEMORY, BUF_BLOCK_NOT_USED, BUF_BLOCK_READY_FOR_USE, BUF_BLOCK_REMOVE_HASH, buf_block_set_io_fix(), BUF_BLOCK_ZIP_DIRTY, BUF_BLOCK_ZIP_FREE, BUF_BLOCK_ZIP_PAGE, buf_buddy_free(), buf_page_struct::buf_fix_count, buf_flush_relocate_on_flush_list(), BUF_GET, BUF_GET_IF_IN_POOL, BUF_GET_IF_IN_POOL_OR_WATCH, BUF_GET_NO_LATCH, BUF_IO_NONE, BUF_IO_READ, buf_LRU_block_free_non_file_page(), buf_LRU_free_block(), BUF_LRU_FREED, buf_LRU_get_free_block(), buf_page_address_fold(), buf_page_get_io_fix(), buf_page_get_state(), buf_page_hash_get_low(), buf_page_is_accessed(), BUF_PEEK_IF_IN_POOL, buf_pool_get(), buf_pool_mutex_enter, buf_pool_mutex_exit, buf_pool_watch_is_sentinel(), buf_pool_watch_set(), buf_read_ahead_linear(), buf_read_page(), buf_relocate(), buf_unzip_LRU_add_block(), buf_zip_decompress(), page_zip_des_struct::data, fil_space_get_zip_size(), ibuf_inside(), ibuf_merge_or_delete_for_page(), ibuf_page_low(), buf_block_struct::lock, buf_block_struct::lock_hash_val, lock_rec_hash(), mtr_memo_push(), buf_block_struct::mutex, buf_pool_stat_struct::n_page_gets, buf_pool_struct::n_pend_unzip, buf_page_struct::offset, os_thread_sleep(), buf_block_struct::page, page_zip_get_size(), recv_no_ibuf_operations, rw_lock_s_lock_func(), rw_lock_x_lock_func(), buf_page_struct::space, buf_pool_struct::stat, buf_page_struct::state, ut_a, ut_ad, ut_error, ut_is_2pow, UT_LIST_REMOVE, buf_page_struct::zip, and buf_pool_struct::zip_mutex.
Referenced by btr_cur_open_at_rnd_pos_func(), btr_cur_search_to_nth_level(), btr_search_drop_page_hash_when_freed(), ibuf_page_low(), and trx_undo_report_row_operation().
UNIV_INLINE enum buf_io_fix buf_page_get_io_fix | ( | const buf_page_t * | bpage | ) |
Gets the io_fix state of a block.
bpage | in: pointer to the control block |
Referenced by buf_flush_ready_for_replace(), buf_page_get_gen(), buf_page_get_zip(), buf_page_io_complete(), and buf_relocate().
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 | ||
) |
This is used to get access to a known database page, when no waiting can be done.
This is used to get access to a known database page, when no waiting can be done. For example, if a search in an adaptive hash index leads us to this frame.
rw_latch | in: RW_S_LATCH, RW_X_LATCH |
block | in: the known page |
mode | in: BUF_MAKE_YOUNG or BUF_KEEP_OLD |
file | in: file name |
line | in: line where called |
mtr | in: mini-transaction |
Definition at line 3267 of file buf0buf.cc.
References BUF_BLOCK_FILE_PAGE, buf_block_get_page_no(), buf_block_get_space(), buf_block_get_state(), BUF_BLOCK_REMOVE_HASH, buf_page_struct::buf_fix_count, BUF_KEEP_OLD, buf_LRU_make_block_young(), BUF_MAKE_YOUNG, buf_page_is_accessed(), buf_page_peek_if_too_old(), buf_page_set_accessed(), buf_pool_from_block(), buf_pool_mutex_enter, buf_pool_mutex_exit, ibuf_inside(), buf_block_struct::lock, mtr_memo_push(), buf_block_struct::mutex, buf_pool_stat_struct::n_page_gets, buf_block_struct::page, rw_lock_x_lock_func_nowait(), buf_pool_struct::stat, ut_a, ut_ad, and ut_time_ms().
Referenced by btr_search_guess_on_hash(), ibuf_merge_or_delete_for_page(), and recv_recover_page_func().
UNIV_INLINE mutex_t* buf_page_get_mutex | ( | const buf_page_t * | bpage | ) |
Gets the mutex of a block.
bpage | in: pointer to control block |
Referenced by buf_flush_ready_for_replace(), buf_flush_relocate_on_flush_list(), buf_flush_remove(), buf_LRU_free_block(), buf_page_io_complete(), buf_pool_watch_unset(), and buf_relocate().
UNIV_INLINE ib_uint64_t buf_page_get_newest_modification | ( | const buf_page_t * | bpage | ) |
Gets the youngest modification log sequence number for a frame. Returns zero if not file page or no modification occurred yet.
Referenced by recv_recover_page_func().
UNIV_INLINE ulint buf_page_get_page_no | ( | const buf_page_t * | bpage | ) |
Gets the page number of a block.
bpage | in: pointer to the control block |
Referenced by buf_LRU_free_block(), buf_page_get_zip(), and buf_page_io_complete().
UNIV_INLINE ulint buf_page_get_space | ( | const buf_page_t * | bpage | ) |
Gets the space id of a block.
bpage | in: pointer to the control block |
Referenced by buf_LRU_free_block(), buf_page_get_zip(), and buf_page_io_complete().
UNIV_INLINE enum buf_page_state buf_page_get_state | ( | const buf_page_t * | bpage | ) |
Gets the state of a block.
Referenced by buf_flush_ready_for_replace(), buf_flush_remove(), buf_LRU_free_block(), buf_LRU_insert_zip_clean(), buf_page_get_gen(), buf_page_get_zip(), buf_page_io_complete(), buf_pool_watch_is_sentinel(), buf_read_ahead_linear(), buf_read_page_low(), and buf_relocate().
UNIV_INTERN buf_page_t* buf_page_get_zip | ( | ulint | space, |
ulint | zip_size, | ||
ulint | offset | ||
) |
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.
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.
space | in: space id |
zip_size | in: compressed page size |
offset | in: page number |
Definition at line 2306 of file buf0buf.cc.
References BUF_BLOCK_FILE_PAGE, BUF_BLOCK_MEMORY, BUF_BLOCK_NOT_USED, BUF_BLOCK_READY_FOR_USE, BUF_BLOCK_REMOVE_HASH, BUF_BLOCK_ZIP_DIRTY, BUF_BLOCK_ZIP_FREE, BUF_BLOCK_ZIP_PAGE, buf_page_struct::buf_fix_count, BUF_IO_READ, buf_LRU_free_block(), BUF_LRU_FREED, buf_page_get_io_fix(), buf_page_get_page_no(), buf_page_get_space(), buf_page_get_state(), buf_page_hash_get(), buf_page_in_file(), buf_page_is_accessed(), buf_pool_get(), buf_pool_mutex_enter, buf_pool_mutex_exit, buf_pool_watch_is_sentinel(), buf_read_page(), page_zip_des_struct::data, buf_pool_stat_struct::n_page_gets, os_thread_sleep(), buf_pool_struct::stat, ut_a, ut_ad, ut_error, buf_page_struct::zip, and buf_pool_struct::zip_mutex.
UNIV_INLINE ulint buf_page_get_zip_size | ( | const buf_page_t * | bpage | ) |
Gets the compressed page size of a block.
bpage | in: pointer to the control block |
Referenced by buf_page_io_complete().
UNIV_INLINE buf_page_t* buf_page_hash_get | ( | buf_pool_t * | buf_pool, |
ulint | space, | ||
ulint | offset | ||
) |
Returns the control block of a file page, NULL if not found.
buf_pool | in: buffer pool instance |
space | in: space id |
Referenced by buf_page_get_zip(), buf_page_peek_if_search_hashed(), buf_read_ahead_linear(), buf_relocate(), and buf_reset_check_index_page_at_flush().
UNIV_INLINE buf_page_t* buf_page_hash_get_low | ( | buf_pool_t * | buf_pool, |
ulint | space, | ||
ulint | offset, | ||
ulint | fold | ||
) |
Returns the control block of a file page, NULL if not found.
buf_pool | buffer pool instance |
space | in: space id |
offset | in: offset of the page within space |
Referenced by buf_LRU_free_block(), buf_page_create(), buf_page_get_gen(), buf_page_init_for_read(), buf_pool_watch_occurred(), buf_pool_watch_set(), buf_pool_watch_unset(), and ibuf_insert().
UNIV_INLINE ibool buf_page_in_file | ( | const buf_page_t * | bpage | ) |
Determines if a block is mapped to a tablespace.
bpage | in: pointer to control block |
Referenced by buf_flush_ready_for_replace(), buf_LRU_free_block(), buf_LRU_get_free_only(), buf_page_create(), buf_page_get_zip(), buf_page_init_for_read(), buf_page_io_complete(), buf_page_make_young(), buf_pool_watch_is_sentinel(), and buf_read_page_low().
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 | ||
) |
Function which 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.
Function which 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.
err | out: DB_SUCCESS or DB_TABLESPACE_DELETED |
mode | in: BUF_READ_IBUF_PAGES_ONLY, ... |
space | in: space id |
zip_size | in: compressed page size, or 0 |
unzip | in: TRUE=request uncompressed page |
tablespace_version | in: prevents reading from a wrong version of the tablespace in case we have done DISCARD + IMPORT |
offset | in: page number |
Definition at line 3558 of file buf0buf.cc.
References BUF_BLOCK_ZIP_FREE, BUF_BLOCK_ZIP_PAGE, buf_buddy_alloc(), buf_buddy_free(), buf_page_struct::buf_fix_count, BUF_IO_READ, buf_LRU_add_block(), buf_LRU_block_free_non_file_page(), buf_LRU_get_free_block(), buf_LRU_insert_zip_clean(), buf_page_address_fold(), buf_page_belongs_to_unzip_LRU(), buf_page_hash_get_low(), buf_page_in_file(), buf_page_set_io_fix(), buf_pool_from_block(), buf_pool_from_bpage(), buf_pool_get(), buf_pool_index(), buf_page_struct::buf_pool_index, buf_pool_mutex_enter, buf_pool_mutex_exit, buf_pool_watch_is_sentinel(), BUF_READ_ANY_PAGE, BUF_READ_IBUF_PAGES_ONLY, buf_unzip_LRU_add_block(), page_zip_des_struct::data, fil_tablespace_deleted_or_being_deleted_in_mem(), HASH_INSERT, ibuf_bitmap_page(), ibuf_mtr_commit(), ibuf_mtr_start(), ibuf_page, buf_block_struct::lock, buf_block_struct::mutex, buf_pool_struct::n_pend_reads, buf_page_struct::offset, buf_block_struct::page, buf_pool_struct::page_hash, page_zip_des_init(), page_zip_get_size(), page_zip_set_size(), recv_no_ibuf_operations, recv_recovery_is_on(), buf_page_struct::space, buf_page_struct::state, ut_a, ut_ad, ut_d, buf_page_struct::zip, and buf_pool_struct::zip_mutex.
Referenced by buf_read_page_low().
UNIV_INTERN void buf_page_io_complete | ( | buf_page_t * | bpage | ) |
Completes an asynchronous read or write request of a file page to or from the buffer pool. in: pointer to the block in question
Completes an asynchronous read or write request of a file page to or from the buffer pool.
bpage | in: pointer to the block in question |
Definition at line 3942 of file buf0buf.cc.
References BUF_BLOCK_FILE_PAGE, buf_flush_write_complete(), BUF_IO_NONE, BUF_IO_READ, BUF_IO_WRITE, buf_page_get_io_fix(), buf_page_get_mutex(), buf_page_get_page_no(), buf_page_get_space(), buf_page_get_state(), buf_page_get_zip_size(), buf_page_in_file(), buf_page_is_corrupted(), buf_page_print(), buf_page_set_io_fix(), buf_pool_from_bpage(), buf_pool_mutex_enter, buf_pool_mutex_exit, buf_zip_decompress(), page_zip_des_struct::data, FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, FIL_PAGE_OFFSET, ibuf_merge_or_delete_for_page(), mach_read_from_4(), buf_pool_stat_struct::n_pages_read, buf_pool_stat_struct::n_pages_written, buf_pool_struct::n_pend_reads, buf_pool_struct::n_pend_unzip, buf_page_struct::offset, recv_no_ibuf_operations, recv_recover_page, recv_recovery_is_on(), buf_page_struct::space, SRV_FORCE_IGNORE_CORRUPT, buf_pool_struct::stat, trx_doublewrite_page_inside(), ut_a, ut_ad, ut_error, ut_print_timestamp(), and buf_page_struct::zip.
Referenced by buf_read_page_low(), and fil_aio_wait().
UNIV_INLINE unsigned buf_page_is_accessed | ( | const buf_page_t * | bpage | ) |
Determine the time of first access of a block in the buffer pool.
bpage | in: control block |
Referenced by buf_page_get_gen(), buf_page_get_known_nowait(), buf_page_get_zip(), buf_page_optimistic_get(), and buf_read_ahead_linear().
UNIV_INTERN ibool buf_page_is_corrupted | ( | const byte * | read_buf, |
ulint | zip_size | ||
) |
Checks if a page is corrupt.
Checks if a page is corrupt.
read_buf | in: a database page |
zip_size | in: size of compressed page; 0 for uncompressed pages |
Definition at line 503 of file buf0buf.cc.
References buf_calc_page_new_checksum(), buf_calc_page_old_checksum(), BUF_NO_CHECKSUM_MAGIC, FIL_PAGE_END_LSN_OLD_CHKSUM, FIL_PAGE_LSN, FIL_PAGE_OFFSET, FIL_PAGE_SPACE_OR_CHKSUM, log_peek_lsn(), mach_read_from_4(), mach_read_from_8(), page_zip_calc_checksum(), recv_lsn_checks_on, and ut_print_timestamp().
Referenced by buf_page_io_complete(), and trx_sys_doublewrite_init_or_restore_pages().
UNIV_INLINE ibool buf_page_is_old | ( | const buf_page_t * | bpage | ) |
Determine if a block has been flagged old.
bpage | in: control block |
Referenced by buf_LRU_free_block(), and buf_relocate().
UNIV_INTERN 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. in: buffer block of a file page
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.
bpage | in: buffer block of a file page |
Definition at line 2127 of file buf0buf.cc.
References buf_LRU_make_block_young(), buf_page_in_file(), buf_pool_from_bpage(), buf_pool_mutex_enter, buf_pool_mutex_exit, and ut_a.
Referenced by btr_search_guess_on_hash().
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 | ||
) |
This is the general function used to get optimistic access to a database page.
This is the general function used to get optimistic access to a database page.
rw_latch | in: RW_S_LATCH, RW_X_LATCH |
block | in: guessed buffer block |
modify_clock | in: modify clock value if mode is ..._GUESS_ON_CLOCK |
file | in: file name |
line | in: line where called |
mtr | in: mini-transaction |
Definition at line 3149 of file buf0buf.cc.
References BUF_BLOCK_FILE_PAGE, buf_block_get_page_no(), buf_block_get_space(), buf_block_get_state(), buf_block_get_zip_size(), buf_page_struct::buf_fix_count, buf_page_is_accessed(), buf_pool_from_block(), buf_read_ahead_linear(), ibuf_inside(), ibuf_page, buf_block_struct::lock, buf_block_struct::modify_clock, mtr_memo_push(), buf_block_struct::mutex, buf_pool_stat_struct::n_page_gets, buf_block_struct::page, rw_lock_x_lock_func_nowait(), buf_pool_struct::stat, ut_a, and ut_ad.
Referenced by btr_pcur_restore_position_func().
UNIV_INLINE ibool buf_page_peek | ( | ulint | space, |
ulint | offset | ||
) |
Returns TRUE if the page can be found in the buffer pool hash table.
NOTE that it is possible that the page is not yet read from disk, though.
space | in: space id |
Referenced by recv_apply_hashed_log_recs().
UNIV_INTERN ibool buf_page_peek_if_search_hashed | ( | ulint | space, |
ulint | offset | ||
) |
Returns the current state of is_hashed of a page. FALSE if the page is not in the pool. NOTE that this operation does not fix the page in the pool if it is found there.
Returns the current state of is_hashed of a page. FALSE if the page is not in the pool. NOTE that this operation does not fix the page in the pool if it is found there.
space | in: space id |
offset | in: page number |
Definition at line 2206 of file buf0buf.cc.
References BUF_BLOCK_FILE_PAGE, buf_block_get_state(), buf_page_hash_get(), buf_pool_get(), buf_pool_mutex_enter, buf_pool_mutex_exit, buf_pool_watch_is_sentinel(), buf_block_struct::is_hashed, buf_block_struct::page, and ut_ad.
Referenced by btr_search_drop_page_hash_when_freed().
UNIV_INLINE ibool buf_page_peek_if_too_old | ( | const buf_page_t * | bpage | ) |
Recommends a move of a block to the start of the LRU list if there is danger of dropping from the buffer pool. NOTE: does not reserve the buffer pool mutex.
Referenced by btr_search_guess_on_hash(), and buf_page_get_known_nowait().
UNIV_INTERN void buf_page_print | ( | const byte * | read_buf, |
ulint | zip_size | ||
) |
Prints a page to stderr. in: compressed page size, or 0 for uncompressed pages
Prints a page to stderr.
read_buf | in: a database page |
zip_size | in: compressed page size, or 0 for uncompressed pages |
Definition at line 601 of file buf0buf.cc.
References btr_page_get_index_id(), buf_calc_page_new_checksum(), buf_calc_page_old_checksum(), BUF_NO_CHECKSUM_MAGIC, dict_index_find_on_id_low(), dict_index_name_print(), FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, FIL_PAGE_END_LSN_OLD_CHKSUM, fil_page_get_type(), FIL_PAGE_IBUF_BITMAP, FIL_PAGE_IBUF_FREE_LIST, FIL_PAGE_INDEX, FIL_PAGE_INODE, FIL_PAGE_LSN, FIL_PAGE_OFFSET, FIL_PAGE_SPACE_OR_CHKSUM, FIL_PAGE_TYPE_ALLOCATED, FIL_PAGE_TYPE_BLOB, FIL_PAGE_TYPE_FSP_HDR, FIL_PAGE_TYPE_SYS, FIL_PAGE_TYPE_TRX_SYS, FIL_PAGE_TYPE_XDES, FIL_PAGE_TYPE_ZBLOB, FIL_PAGE_TYPE_ZBLOB2, mach_read_from_2(), mach_read_from_4(), page_zip_calc_checksum(), TRX_UNDO_PAGE_HDR, TRX_UNDO_PAGE_TYPE, ut_print_buf(), and ut_print_timestamp().
Referenced by btr_index_rec_validate(), buf_page_io_complete(), ibuf_merge_or_delete_for_page(), page_check_dir(), page_copy_rec_list_end_no_locks(), page_cur_parse_insert_rec(), page_dir_find_owner_slot(), page_validate(), row_search_for_mysql(), and trx_sys_doublewrite_init_or_restore_pages().
UNIV_INLINE void buf_page_release | ( | buf_block_t * | block, |
ulint | rw_latch | ||
) |
Decrements the bufferfix count of a buffer control block and releases a latch, if specified. in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
block | in: buffer block |
UNIV_INLINE void buf_page_release_zip | ( | buf_page_t * | bpage | ) |
Releases a compressed-only page acquired with buf_page_get_zip(). in: buffer block
UNIV_INLINE void buf_page_set_accessed | ( | buf_page_t * | bpage, |
ulint | time_ms | ||
) |
Flag a block accessed.
bpage | in/out: control block |
time_ms | in: ut_time_ms() |
Referenced by buf_page_create(), and buf_page_get_known_nowait().
UNIV_INLINE void buf_page_set_flush_type | ( | buf_page_t * | bpage, |
enum buf_flush | flush_type | ||
) |
Set the flush type of a page. in: flush type
bpage | in: buffer page |
UNIV_INLINE void buf_page_set_io_fix | ( | buf_page_t * | bpage, |
enum buf_io_fix | io_fix | ||
) |
Sets the io_fix state of a block. in: io_fix state
bpage | in/out: control block |
Referenced by buf_LRU_free_block(), buf_page_create(), buf_page_init_for_read(), and buf_page_io_complete().
UNIV_INLINE void buf_page_set_old | ( | buf_page_t * | bpage, |
ibool | old | ||
) |
Flag a block old. in: old
bpage | in/out: control block |
Referenced by buf_LRU_free_block(), and buf_relocate().
UNIV_INLINE void buf_page_set_state | ( | buf_page_t * | bpage, |
enum buf_page_state | state | ||
) |
Sets the state of a block. in: state
bpage | in/out: pointer to control block |
Referenced by buf_flush_remove().
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 | ||
) |
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 kernel mutex. in: mini-transaction
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 kernel mutex.
space_id | in: tablespace id |
page_no | in: page number |
file | in: file name |
line | in: line where called |
mtr | in: mini-transaction |
Definition at line 3371 of file buf0buf.cc.
References BUF_BLOCK_FILE_PAGE, buf_block_get_page_no(), buf_block_get_space(), buf_block_get_state(), buf_block_hash_get(), buf_page_struct::buf_fix_count, buf_pool_get(), buf_pool_mutex_enter, buf_pool_mutex_exit, buf_pool_watch_is_sentinel(), buf_block_struct::lock, mtr_memo_push(), buf_block_struct::mutex, buf_pool_stat_struct::n_page_gets, buf_block_struct::page, rw_lock_x_lock_func_nowait(), buf_pool_struct::stat, ut_a, and ut_ad.
UNIV_INTERN ibool buf_pointer_is_block_field | ( | const void * | ptr | ) |
Find out if a pointer belongs to a buf_block_t. It can be a pointer to the buf_block_t itself or a member of it
Find out if a pointer belongs to a buf_block_t. It can be a pointer to the buf_block_t itself or a member of it
ptr | in: pointer not dereferenced |
Definition at line 2667 of file buf0buf.cc.
References buf_pool_from_array(), and srv_buf_pool_instances.
UNIV_INTERN ibool buf_pool_check_no_pending_io | ( | void | ) |
Checks that there currently are no pending i/o-operations for the buffer pool.
Definition at line 5197 of file buf0buf.cc.
References BUF_FLUSH_LIST, BUF_FLUSH_LRU, BUF_FLUSH_SINGLE_PAGE, buf_pool_from_array(), buf_pool_mutex_enter_all(), buf_pool_mutex_exit_all(), buf_pool_struct::n_flush, and buf_pool_struct::n_pend_reads.
Referenced by logs_empty_and_mark_files_at_shutdown().
UNIV_INTERN void buf_pool_drop_hash_index | ( | void | ) |
Drops the adaptive hash index. To prevent a livelock, this function is only to be called while holding btr_search_latch and while btr_search_enabled == FALSE.
Definition at line 1423 of file buf0buf.cc.
References btr_search_enabled, btr_search_latch, buf_pool_from_array(), srv_buf_pool_instances, and ut_ad.
Referenced by btr_search_disable().
UNIV_INTERN void buf_pool_free | ( | ulint | n_instances | ) |
Frees the buffer pool at shutdown. This must not be invoked before freeing all mutexes. in: numbere of instances to free
Frees the buffer pool at shutdown. This must not be invoked before freeing all mutexes.
n_instances | in: numbere of instances to free |
Definition at line 1331 of file buf0buf.cc.
References buf_pool_from_array(), buf_pool_ptr, and mem_free.
Referenced by buf_pool_init(), and innobase_shutdown_for_mysql().
UNIV_INLINE buf_pool_t* buf_pool_from_array | ( | ulint | index | ) |
Returns the buffer pool instance given its array index
Referenced by buf_all_freed(), buf_block_align(), buf_block_alloc(), buf_flush_free_flush_rbt(), buf_flush_free_margins(), buf_flush_init_flush_rbt(), buf_flush_list(), buf_flush_wait_batch_end(), buf_get_n_pending_ios(), buf_get_total_list_len(), buf_get_total_stat(), buf_LRU_buf_pool_running_out(), buf_LRU_file_dump(), buf_LRU_invalidate_tablespace(), buf_LRU_old_ratio_update(), buf_LRU_stat_update(), buf_LRU_try_free_flushed_blocks(), buf_pointer_is_block_field(), buf_pool_check_no_pending_io(), buf_pool_drop_hash_index(), buf_pool_free(), buf_pool_get_oldest_modification(), buf_pool_invalidate(), buf_print_io(), buf_refresh_io_stats_all(), and srv_master_thread().
UNIV_INLINE buf_pool_t* buf_pool_from_block | ( | const buf_block_t * | block | ) |
Returns the buffer pool instance given a block instance
Referenced by buf_LRU_block_free_non_file_page(), buf_LRU_get_free_only(), buf_page_get_known_nowait(), buf_page_init_for_read(), buf_page_optimistic_get(), buf_unzip_LRU_add_block(), and page_zip_reorganize().
UNIV_INLINE buf_pool_t* buf_pool_from_bpage | ( | const buf_page_t * | bpage | ) |
Returns the buffer pool instance given a page instance
Referenced by btr_search_guess_on_hash(), buf_flush_ready_for_replace(), buf_flush_relocate_on_flush_list(), buf_flush_remove(), buf_flush_write_complete(), buf_LRU_free_block(), buf_LRU_insert_zip_clean(), buf_LRU_make_block_young(), buf_page_init_for_read(), buf_page_io_complete(), buf_page_make_young(), and buf_relocate().
UNIV_INLINE buf_pool_t* buf_pool_get | ( | ulint | space, |
ulint | offset | ||
) |
Returns the buffer pool instance given space and offset of page
space | in: space id |
Referenced by buf_page_create(), buf_page_get_gen(), buf_page_get_zip(), buf_page_init_for_read(), buf_page_peek_if_search_hashed(), buf_page_try_get_func(), buf_pool_watch_occurred(), buf_pool_watch_set(), buf_pool_watch_unset(), buf_read_ahead_linear(), buf_read_ibuf_merge_pages(), buf_read_page(), buf_read_recv_pages(), buf_reset_check_index_page_at_flush(), and ibuf_insert().
UNIV_INLINE ulint buf_pool_get_curr_size | ( | void | ) |
Gets the current size of buffer buf_pool in bytes.
Referenced by buf_pool_init(), log_init(), recv_recovery_from_checkpoint_start_func(), recv_sys_init(), and trx_sys_create_doublewrite_buf().
UNIV_INLINE ulint buf_pool_get_n_pages | ( | void | ) |
Gets the current size of buffer buf_pool in frames.
Referenced by srv_export_innodb_status().
UNIV_INTERN ib_uint64_t buf_pool_get_oldest_modification | ( | void | ) |
Gets the smallest oldest_modification lsn for any page in the pool. Returns zero if all modified pages have been flushed to disk.
Definition at line 315 of file buf0buf.cc.
References buf_flush_list_mutex_enter, buf_flush_list_mutex_exit, buf_pool_from_array(), log_flush_order_mutex_enter, log_flush_order_mutex_exit, buf_page_struct::oldest_modification, srv_buf_pool_instances, ut_ad, and UT_LIST_GET_LAST.
Referenced by log_close(), and srv_master_thread().
UNIV_INLINE ulint buf_pool_index | ( | const buf_pool_t * | buf_pool | ) |
Calculates the index of a buffer pool to the buf_pool[] array.
buf_pool | in: buffer pool |
Referenced by buf_block_alloc(), and buf_page_init_for_read().
UNIV_INTERN ulint buf_pool_init | ( | ulint | total_size, |
ulint | n_instances | ||
) |
Creates the buffer pool.
Creates the buffer pool.
total_size | in: size of the total pool in bytes |
n_instances | in: number of instances |
Definition at line 1288 of file buf0buf.cc.
References btr_search_sys_create(), buf_LRU_old_ratio_update(), buf_pool_free(), buf_pool_get_curr_size(), buf_pool_ptr, MAX_BUFFER_POOLS, mem_zalloc, srv_buf_pool_instances, and ut_ad.
Referenced by innobase_start_or_create_for_mysql().
UNIV_INTERN 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.
Definition at line 4251 of file buf0buf.cc.
References buf_pool_from_array(), and srv_buf_pool_instances.
Referenced by innobase_start_or_create_for_mysql(), and recv_apply_hashed_log_recs().
UNIV_INLINE void buf_pool_mutex_enter_all | ( | void | ) |
Acquire mutex on all buffer pool instances
Referenced by buf_pool_check_no_pending_io(), and buf_pool_resize().
UNIV_INLINE void buf_pool_mutex_exit_all | ( | void | ) |
Release mutex on all buffer pool instances
Referenced by buf_pool_check_no_pending_io(), and buf_pool_resize().
UNIV_INTERN void buf_pool_resize | ( | void | ) |
Resizes the buffer pool.
Definition at line 1985 of file buf0buf.cc.
References buf_pool_mutex_enter_all(), buf_pool_mutex_exit_all(), srv_buf_pool_curr_size, srv_buf_pool_instances, srv_buf_pool_old_size, and srv_buf_pool_size.
UNIV_INTERN ibool buf_pool_watch_is_sentinel | ( | buf_pool_t * | buf_pool, |
const buf_page_t * | bpage | ||
) |
buf_pool | buffer pool instance |
bpage | in: block |
Definition at line 1814 of file buf0buf.cc.
References BUF_BLOCK_ZIP_PAGE, buf_page_struct::buf_fix_count, buf_page_get_state(), buf_page_in_file(), BUF_POOL_WATCH_SIZE, page_zip_des_struct::data, ut_ad, buf_pool_struct::watch, and buf_page_struct::zip.
Referenced by buf_page_create(), buf_page_get_gen(), buf_page_get_zip(), buf_page_init_for_read(), buf_page_peek_if_search_hashed(), buf_page_try_get_func(), buf_pool_watch_occurred(), buf_pool_watch_set(), buf_pool_watch_unset(), buf_relocate(), and buf_reset_check_index_page_at_flush().
UNIV_INTERN ibool buf_pool_watch_occurred | ( | ulint | space, |
ulint | offset | ||
) |
Check if the page has been read in. This may only be called after buf_pool_watch_set(space,offset) has returned NULL and before invoking buf_pool_watch_unset(space,offset).
space | in: space id |
offset | in: page number |
Definition at line 2099 of file buf0buf.cc.
References buf_page_address_fold(), buf_page_hash_get_low(), buf_pool_get(), buf_pool_mutex_enter, buf_pool_mutex_exit, buf_pool_watch_is_sentinel(), and ut_a.
UNIV_INTERN buf_page_t* buf_pool_watch_set | ( | ulint | space, |
ulint | offset, | ||
ulint | fold | ||
) |
Add watch for the given page to be read in. Caller must have the buffer pool
Add watch for the given page to be read in. Caller must have the buffer pool mutex reserved.
space | in: space id |
offset | in: page number |
fold | in: buf_page_address_fold(space, offset) |
Definition at line 1844 of file buf0buf.cc.
References buf_page_struct::access_time, BUF_BLOCK_POOL_WATCH, BUF_BLOCK_ZIP_PAGE, buf_page_struct::buf_fix_count, buf_page_hash_get_low(), buf_pool_get(), buf_pool_mutex_own, buf_pool_watch_is_sentinel(), BUF_POOL_WATCH_SIZE, page_zip_des_struct::data, HASH_INSERT, buf_page_struct::newest_modification, buf_page_struct::offset, buf_page_struct::oldest_modification, buf_pool_struct::page_hash, buf_page_struct::space, buf_page_struct::state, ut_ad, ut_d, ut_error, buf_pool_struct::watch, and buf_page_struct::zip.
Referenced by buf_page_get_gen().
UNIV_INTERN void buf_pool_watch_unset | ( | ulint | space, |
ulint | offset | ||
) |
Stop watching if the page has been read in. buf_pool_watch_set(space,offset) must have returned NULL before. in: page number
Stop watching if the page has been read in. buf_pool_watch_set(space,offset) must have returned NULL before.
space | in: space id |
offset | in: page number |
Definition at line 2059 of file buf0buf.cc.
References buf_page_struct::buf_fix_count, buf_page_address_fold(), buf_page_get_mutex(), buf_page_hash_get_low(), buf_pool_get(), buf_pool_mutex_enter, buf_pool_mutex_exit, buf_pool_watch_is_sentinel(), and ut_a.
Referenced by btr_cur_search_to_nth_level().
UNIV_INTERN void buf_print_io | ( | FILE * | file | ) |
Prints info of the buffer i/o. in: file where to print
Prints info of the buffer i/o.
file | in/out: buffer where to print |
Definition at line 5080 of file buf0buf.cc.
References buf_pool_from_array(), mem_free, mem_zalloc, srv_buf_pool_instances, and ut_a.
Referenced by srv_printf_innodb_monitor().
UNIV_INLINE void buf_ptr_get_fsp_addr | ( | const void * | ptr, |
ulint * | space, | ||
fil_addr_t * | addr | ||
) |
Gets the space id, page offset, and byte offset within page of a pointer pointing to a buffer frame containing a file page. out: page offset and byte offset
ptr | in: pointer to a buffer frame |
space | out: space id |
Referenced by flst_add_first(), flst_add_last(), flst_cut_end(), flst_insert_after(), flst_insert_before(), flst_remove(), flst_truncate_end(), and flst_validate().
UNIV_INTERN void buf_refresh_io_stats | ( | buf_pool_t * | buf_pool | ) |
Refreshes the statistics used to print per-second averages. buffer pool instance
Refreshes the statistics used to print per-second averages.
buf_pool | in: buffer pool instance |
Definition at line 5142 of file buf0buf.cc.
References buf_pool_struct::last_printout_time, buf_pool_struct::old_stat, buf_pool_struct::stat, and ut_time().
Referenced by buf_refresh_io_stats_all().
UNIV_INTERN void buf_refresh_io_stats_all | ( | void | ) |
Refreshes the statistics used to print per-second averages.
Definition at line 5154 of file buf0buf.cc.
References buf_pool_from_array(), buf_refresh_io_stats(), and srv_buf_pool_instances.
UNIV_INTERN void buf_relocate | ( | buf_page_t * | bpage, |
buf_page_t * | dpage | ||
) |
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.
bpage | in/out: control block being relocated; buf_page_get_state(bpage) must be BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_ZIP_PAGE |
dpage | in/out: destination control block |
Definition at line 1456 of file buf0buf.cc.
References BUF_BLOCK_FILE_PAGE, BUF_BLOCK_MEMORY, BUF_BLOCK_NOT_USED, BUF_BLOCK_READY_FOR_USE, BUF_BLOCK_REMOVE_HASH, BUF_BLOCK_ZIP_DIRTY, BUF_BLOCK_ZIP_FREE, BUF_BLOCK_ZIP_PAGE, buf_page_struct::buf_fix_count, BUF_IO_NONE, buf_page_address_fold(), buf_page_get_io_fix(), buf_page_get_mutex(), buf_page_get_state(), buf_page_hash_get(), buf_page_is_old(), buf_page_set_old(), buf_pool_from_bpage(), buf_pool_mutex_own, buf_pool_watch_is_sentinel(), HASH_DELETE, HASH_INSERT, buf_pool_struct::LRU_old, buf_page_struct::offset, buf_page_struct::old, buf_pool_struct::page_hash, buf_page_struct::space, ut_a, ut_ad, ut_d, ut_error, UT_LIST_ADD_FIRST, UT_LIST_GET_NEXT, UT_LIST_GET_PREV, UT_LIST_INSERT_AFTER, UT_LIST_REMOVE, and UT_LIST_VALIDATE.
Referenced by buf_page_get_gen().
UNIV_INTERN void buf_reset_check_index_page_at_flush | ( | ulint | space, |
ulint | offset | ||
) |
Resets the check_index_page_at_flush field of a page if found in the buffer pool. in: page number
Resets the check_index_page_at_flush field of a page if found in the buffer pool.
space | in: space id |
offset | in: page number |
Definition at line 2179 of file buf0buf.cc.
References BUF_BLOCK_FILE_PAGE, buf_block_get_state(), buf_page_hash_get(), buf_pool_get(), buf_pool_mutex_enter, buf_pool_mutex_exit, buf_pool_watch_is_sentinel(), buf_block_struct::check_index_page_at_flush, buf_block_struct::page, and ut_ad.
UNIV_INTERN ibool buf_zip_decompress | ( | buf_block_t * | block, |
ibool | check | ||
) |
Decompress a block.
Decompress a block.
block | in/out: block |
check | in: TRUE=verify the page checksum |
Definition at line 2452 of file buf0buf.cc.
References buf_block_get_space(), buf_block_get_zip_size(), BUF_NO_CHECKSUM_MAGIC, page_zip_des_struct::data, fil_page_get_type(), FIL_PAGE_IBUF_BITMAP, FIL_PAGE_INDEX, FIL_PAGE_INODE, FIL_PAGE_SPACE_OR_CHKSUM, FIL_PAGE_TYPE_ALLOCATED, FIL_PAGE_TYPE_FSP_HDR, FIL_PAGE_TYPE_XDES, FIL_PAGE_TYPE_ZBLOB, FIL_PAGE_TYPE_ZBLOB2, buf_block_struct::frame, mach_read_from_4(), buf_page_struct::offset, buf_block_struct::page, page_zip_calc_checksum(), page_zip_decompress(), page_zip_get_size(), buf_page_struct::space, ut_a, ut_ad, ut_print_timestamp(), and buf_page_struct::zip.
Referenced by buf_page_get_gen(), and buf_page_io_complete().
buf_pool_t* buf_pool_ptr |
The buffer pools of the database
Definition at line 252 of file buf0buf.cc.
Referenced by buf_pool_free(), and buf_pool_init().