MySQL 5.6.14 Source Code Document
|
#include "buf0buf.h"
#include "mem0mem.h"
#include "btr0btr.h"
#include "fil0fil.h"
#include "buf0buddy.h"
#include "lock0lock.h"
#include "btr0sea.h"
#include "ibuf0ibuf.h"
#include "trx0undo.h"
#include "log0log.h"
#include "srv0srv.h"
#include "dict0dict.h"
#include "log0recv.h"
#include "page0zip.h"
#include "srv0mon.h"
#include "buf0checksum.h"
Go to the source code of this file.
Macros | |
#define | MONITOR_RW_COUNTER(io_type, counter) |
Functions | |
UNIV_INTERN lsn_t | buf_pool_get_oldest_modification (void) |
UNIV_INTERN void | buf_get_total_list_len (ulint *LRU_len, ulint *free_len, ulint *flush_list_len) |
UNIV_INTERN void | buf_get_total_list_size_in_bytes (buf_pools_list_size_t *buf_pools_list_size) |
UNIV_INTERN void | buf_get_total_stat (buf_pool_stat_t *tot_stat) |
UNIV_INTERN buf_block_t * | buf_block_alloc (buf_pool_t *buf_pool) |
UNIV_INTERN ibool | buf_page_is_corrupted (bool check_lsn, const byte *read_buf, ulint zip_size) |
UNIV_INTERN void | buf_page_print (const byte *read_buf, ulint zip_size, ulint flags) |
UNIV_INTERN ulint | buf_pool_init_instance (buf_pool_t *buf_pool, ulint buf_pool_size, ulint instance_no) |
UNIV_INTERN dberr_t | buf_pool_init (ulint total_size, ulint n_instances) |
UNIV_INTERN void | buf_pool_free (ulint n_instances) |
UNIV_INTERN void | buf_pool_clear_hash_index (void) |
UNIV_INTERN void | buf_relocate (buf_page_t *bpage, buf_page_t *dpage) |
UNIV_INTERN ibool | buf_pool_watch_is_sentinel (buf_pool_t *buf_pool, const buf_page_t *bpage) |
UNIV_INTERN buf_page_t * | buf_pool_watch_set (ulint space, ulint offset, ulint fold) |
UNIV_INTERN void | buf_pool_watch_unset (ulint space, ulint offset) |
UNIV_INTERN ibool | buf_pool_watch_occurred (ulint space, ulint offset) |
UNIV_INTERN void | buf_page_make_young (buf_page_t *bpage) |
UNIV_INTERN void | buf_reset_check_index_page_at_flush (ulint space, ulint offset) |
UNIV_INTERN buf_page_t * | buf_page_get_zip (ulint space, ulint zip_size, ulint offset) |
UNIV_INLINE void | buf_block_init_low (buf_block_t *block) |
UNIV_INTERN ibool | buf_zip_decompress (buf_block_t *block, ibool check) |
UNIV_INTERN buf_block_t * | buf_block_align_instance (buf_pool_t *buf_pool, const byte *ptr) |
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_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 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_INLINE void | buf_page_init_low (buf_page_t *bpage) |
Variables | |
UNIV_INTERN buf_pool_t * | buf_pool_ptr |
static ulint | space |
static ulint ulint | offset |
static ulint ulint ulint | fold |
static ulint ulint ulint ulint | zip_size |
#define MONITOR_RW_COUNTER | ( | io_type, | |
counter | |||
) |
Macro to determine whether the read of write counter is used depending
on the io_type
Definition at line 301 of file buf0buf.cc.
UNIV_INTERN buf_block_t* buf_block_align | ( | const byte * | ptr | ) |
Gets the block to whose frame the pointer is pointing to.
ptr | in: pointer to a frame |
Definition at line 2294 of file buf0buf.cc.
UNIV_INTERN buf_block_t* buf_block_align_instance | ( | buf_pool_t * | buf_pool, |
const byte * | ptr | ||
) |
Gets the block to whose frame the pointer is pointing to if found in this buffer pool instance.
buf_pool | in: buffer in which the block resides |
ptr | in: pointer to a frame |
Definition at line 2204 of file buf0buf.cc.
UNIV_INTERN buf_block_t* buf_block_alloc | ( | buf_pool_t * | buf_pool | ) |
Allocates a buffer block.
buf_pool | in/out: buffer pool instance, or NULL for round-robin selection of the buffer pool |
Definition at line 444 of file buf0buf.cc.
UNIV_INLINE void buf_block_init_low | ( | buf_block_t * | block | ) |
Initialize some fields of a control block.
block | in: block to init |
Definition at line 2115 of file buf0buf.cc.
UNIV_INTERN void buf_get_total_list_len | ( | ulint * | LRU_len, |
ulint * | free_len, | ||
ulint * | flush_list_len | ||
) |
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 357 of file buf0buf.cc.
UNIV_INTERN 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.
buf_pools_list_size | out: list sizes in all buffer pools |
Definition at line 384 of file buf0buf.cc.
UNIV_INTERN void buf_get_total_stat | ( | buf_pool_stat_t * | tot_stat | ) |
Get total buffer pool statistics.
tot_stat | out: buffer pool stats |
Definition at line 410 of file buf0buf.cc.
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.
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 2416 of file buf0buf.cc.
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. 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 3049 of file buf0buf.cc.
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.
space | in: space id |
zip_size | in: compressed page size |
offset | in: page number |
Definition at line 1983 of file buf0buf.cc.
UNIV_INLINE void buf_page_init_low | ( | buf_page_t * | bpage | ) |
Initialize some fields of a control block.
bpage | in: block to init |
Definition at line 3243 of file buf0buf.cc.
UNIV_INTERN ibool buf_page_is_corrupted | ( | bool | check_lsn, |
const byte * | read_buf, | ||
ulint | zip_size | ||
) |
Checks if a page is corrupt.
check_lsn | in: true if we need to check and complain about the LSN |
read_buf | in: a database page |
zip_size | in: size of compressed page; 0 for uncompressed pages |
Definition at line 474 of file buf0buf.cc.
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.
bpage | in: buffer block of a file page |
Definition at line 1812 of file buf0buf.cc.
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.
rw_latch | in: RW_S_LATCH, RW_X_LATCH |
block | in: guessed buffer block |
modify_clock | in: modify clock value |
file | in: file name |
line | in: line where called |
mtr | in: mini-transaction |
Definition at line 2931 of file buf0buf.cc.
UNIV_INTERN void buf_page_print | ( | const byte * | read_buf, |
ulint | zip_size, | ||
ulint | flags | ||
) |
Prints a page to stderr.
read_buf | in: a database page |
zip_size | in: compressed page size, or 0 for uncompressed pages |
flags | in: 0 or BUF_PAGE_PRINT_NO_CRASH or BUF_PAGE_PRINT_NO_FULL |
Definition at line 706 of file buf0buf.cc.
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 lock_sys_t::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 3154 of file buf0buf.cc.
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
ptr | in: pointer not dereferenced |
Definition at line 2351 of file buf0buf.cc.
UNIV_INTERN void buf_pool_clear_hash_index | ( | void | ) |
Clears the adaptive hash index on all pages in the buffer pool.
Definition at line 1419 of file buf0buf.cc.
UNIV_INTERN void buf_pool_free | ( | ulint | n_instances | ) |
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 1401 of file buf0buf.cc.
UNIV_INTERN lsn_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 312 of file buf0buf.cc.
UNIV_INTERN dberr_t buf_pool_init | ( | ulint | total_size, |
ulint | n_instances | ||
) |
Creates the buffer pool.
total_size | in: size of the total pool in bytes |
n_instances | in: number of instances |
Definition at line 1361 of file buf0buf.cc.
UNIV_INTERN ulint buf_pool_init_instance | ( | buf_pool_t * | buf_pool, |
ulint | buf_pool_size, | ||
ulint | instance_no | ||
) |
Initialize a buffer pool instance.
buf_pool | in: buffer pool instance |
buf_pool_size | in: size in bytes |
instance_no | in: id of the instance |
Definition at line 1230 of file buf0buf.cc.
UNIV_INTERN ibool buf_pool_watch_is_sentinel | ( | buf_pool_t * | buf_pool, |
const buf_page_t * | bpage | ||
) |
Determine if a block is a sentinel for a buffer pool watch.
buf_pool | buffer pool instance |
bpage | in: block |
Definition at line 1552 of file buf0buf.cc.
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 1782 of file buf0buf.cc.
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 appropriate hash_lock for the bpage. This function may release the hash_lock and reacquire it.
space | in: space id |
offset | in: page number |
fold | in: buf_page_address_fold(space, offset) |
Definition at line 1585 of file buf0buf.cc.
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.
space | in: space id |
offset | in: page number |
Definition at line 1731 of file buf0buf.cc.
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 1465 of file buf0buf.cc.
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.
space | in: space id |
offset | in: page number |
Definition at line 1854 of file buf0buf.cc.
UNIV_INTERN ibool buf_zip_decompress | ( | buf_block_t * | block, |
ibool | check | ||
) |
Decompress a block.
block | in/out: block |
check | in: TRUE=verify the page checksum |
Definition at line 2134 of file buf0buf.cc.
UNIV_INTERN buf_pool_t* buf_pool_ptr |
The buffer pools of the database
Definition at line 252 of file buf0buf.cc.
ulint ulint ulint fold |
in: buf_page_address_fold(space,offset)
Definition at line 3267 of file buf0buf.cc.
static ulint ulint offset |
in: offset of the page within space in units of a page
in: page offset; if equal to the free limit, we try to add new extents to the space free list
Definition at line 3267 of file buf0buf.cc.
ulint space |
< in/out: buffer pool in: space id
Definition at line 3267 of file buf0buf.cc.
static ulint zip_size |
in: compressed page size, or 0
< in: space id in: compressed page size in bytes or 0 for uncompressed pages
Definition at line 3267 of file buf0buf.cc.