Go to the source code of this file.
Macros | |
#define | buf0rea_h |
#define | BUF_READ_AHEAD_AREA(b) 64 |
Modes used in read-ahead @{ | |
#define | BUF_READ_IBUF_PAGES_ONLY 131 |
#define | BUF_READ_ANY_PAGE 132 |
Functions | |
UNIV_INTERN ulint | buf_read_page_low (ulint *err, ibool sync, ulint mode, ulint space, ulint zip_size, ibool unzip, ib_int64_t tablespace_version, ulint offset) |
UNIV_INTERN ibool | buf_read_page (ulint space, ulint zip_size, ulint offset) |
UNIV_INTERN ulint | buf_read_ahead_linear (ulint space, ulint zip_size, ulint offset, ibool inside_ibuf) |
UNIV_INTERN void | buf_read_ibuf_merge_pages (ibool sync, const ulint *space_ids, const ib_int64_t *space_versions, const ulint *page_nos, ulint n_stored) |
UNIV_INTERN void | buf_read_recv_pages (ibool sync, ulint space, ulint zip_size, const ulint *page_nos, ulint n_stored) |
#define BUF_READ_AHEAD_AREA | ( | b) | 64 |
The size in pages of the area which the read-ahead algorithms read if
invoked
Definition at line 160 of file buf0rea.h.
Referenced by buf_read_ahead_linear().
#define BUF_READ_ANY_PAGE 132 |
read any page
Definition at line 166 of file buf0rea.h.
Referenced by buf_LRU_file_restore(), buf_page_init_for_read(), buf_read_ahead_linear(), buf_read_ibuf_merge_pages(), buf_read_page(), and buf_read_recv_pages().
#define BUF_READ_IBUF_PAGES_ONLY 131 |
read only pages belonging to the insert buffer tree
Definition at line 164 of file buf0rea.h.
Referenced by buf_page_init_for_read(), and buf_read_ahead_linear().
UNIV_INTERN ulint buf_read_ahead_linear | ( | ulint | space, |
ulint | zip_size, | ||
ulint | offset, | ||
ibool | inside_ibuf | ||
) |
Applies linear read-ahead if in the buf_pool the page is a border page of a linear read-ahead area and all the pages in the area have been accessed. Does not read any page if the read-ahead mechanism is not activated. Note that the the algorithm looks at the 'natural' adjacent successor and predecessor of the page, which on the leaf level of a B-tree are the next and previous page in the chain of leaves. To know these, the page specified in (space, offset) must already be present in the buf_pool. Thus, the natural way to use this function is to call it when a page in the buf_pool is accessed the first time, calling this function just after it has been bufferfixed. NOTE 1: as this function looks at the natural predecessor and successor fields on the page, what happens, if these are not initialized to any sensible value? No problem, before applying read-ahead we check that the area to read is within the span of the space, if not, read-ahead is not applied. An uninitialized value may result in a useless read operation, but only very improbably. NOTE 2: the calling thread may own latches on pages: to avoid deadlocks this function must be written such that it cannot end up waiting for these latches! NOTE 3: the calling thread must want access to the page given: this rule is set to prevent unintended read-aheads performed by ibuf routines, a situation which could result in a deadlock if the OS does not support asynchronous io.
Applies linear read-ahead if in the buf_pool the page is a border page of a linear read-ahead area and all the pages in the area have been accessed. Does not read any page if the read-ahead mechanism is not activated. Note that the the algorithm looks at the 'natural' adjacent successor and predecessor of the page, which on the leaf level of a B-tree are the next and previous page in the chain of leaves. To know these, the page specified in (space, offset) must already be present in the buf_pool. Thus, the natural way to use this function is to call it when a page in the buf_pool is accessed the first time, calling this function just after it has been bufferfixed. NOTE 1: as this function looks at the natural predecessor and successor fields on the page, what happens, if these are not initialized to any sensible value? No problem, before applying read-ahead we check that the area to read is within the span of the space, if not, read-ahead is not applied. An uninitialized value may result in a useless read operation, but only very improbably. NOTE 2: the calling thread may own latches on pages: to avoid deadlocks this function must be written such that it cannot end up waiting for these latches! NOTE 3: the calling thread must want access to the page given: this rule is set to prevent unintended read-aheads performed by ibuf routines, a situation which could result in a deadlock if the OS does not support asynchronous io.
space | in: space id |
zip_size | in: compressed page size in bytes, or 0 |
offset | in: page number; see NOTE 3 above |
inside_ibuf | in: TRUE if we are inside ibuf routine |
Definition at line 233 of file buf0rea.cc.
References BUF_BLOCK_FILE_PAGE, BUF_BLOCK_ZIP_PAGE, buf_LRU_stat_inc_io, buf_page_get_state(), buf_page_hash_get(), buf_page_is_accessed(), buf_pool_get(), buf_pool_mutex_enter, buf_pool_mutex_exit, BUF_READ_AHEAD_AREA, BUF_READ_ANY_PAGE, BUF_READ_IBUF_PAGES_ONLY, buf_pool_struct::curr_size, page_zip_des_struct::data, ibuf_bitmap_page(), buf_pool_struct::n_pend_reads, buf_pool_stat_struct::n_ra_pages_read, os_aio_simulated_put_read_threads_to_sleep(), os_aio_simulated_wake_handler_threads(), OS_AIO_SIMULATED_WAKE_LATER, srv_startup_is_before_trx_rollback_phase, buf_pool_struct::stat, trx_sys_hdr_page(), ut_error, ut_min(), ut_print_timestamp(), ut_ulint_cmp(), and buf_page_struct::zip.
UNIV_INTERN void buf_read_ibuf_merge_pages | ( | ibool | sync, |
const ulint * | space_ids, | ||
const ib_int64_t * | space_versions, | ||
const ulint * | page_nos, | ||
ulint | n_stored | ||
) |
Issues read requests for pages which the ibuf module wants to read in, in order to contract the insert buffer tree. Technically, this function is like a read-ahead function. in: number of elements in the arrays
Issues read requests for pages which the ibuf module wants to read in, in order to contract the insert buffer tree. Technically, this function is like a read-ahead function.
sync | in: TRUE if the caller wants this function to wait for the highest address page to get read in, before this function returns |
space_ids | in: array of space ids |
space_versions | in: the spaces must have this version number (timestamp), otherwise we discard the read; we use this to cancel reads if DISCARD + IMPORT may have changed the tablespace size |
page_nos | in: array of page numbers to read, with the highest page number the last in the array |
n_stored | in: number of elements in the arrays |
Definition at line 497 of file buf0rea.cc.
References buf_pool_get(), BUF_READ_ANY_PAGE, buf_pool_struct::curr_size, buf_pool_struct::n_pend_reads, os_aio_simulated_wake_handler_threads(), os_thread_sleep(), and ut_a.
UNIV_INTERN ibool buf_read_page | ( | ulint | space, |
ulint | zip_size, | ||
ulint | offset | ||
) |
High-level function which reads a page asynchronously from a file to the buffer buf_pool if it is not already there. Sets the io_fix flag and sets an exclusive lock on the buffer frame. The flag is cleared and the x-lock released by the i/o-handler thread.
High-level function which reads a page asynchronously from a file to the buffer buf_pool if it is not already there. Sets the io_fix flag and sets an exclusive lock on the buffer frame. The flag is cleared and the x-lock released by the i/o-handler thread.
space | in: space id |
zip_size | in: compressed page size in bytes, or 0 |
offset | in: page number |
Definition at line 168 of file buf0rea.cc.
References buf_LRU_stat_inc_io, buf_pool_get(), BUF_READ_ANY_PAGE, srv_buf_pool_reads, and ut_print_timestamp().
UNIV_INTERN ulint buf_read_page_low | ( | ulint * | err, |
ibool | sync, | ||
ulint | mode, | ||
ulint | space, | ||
ulint | zip_size, | ||
ibool | unzip, | ||
ib_int64_t | tablespace_version, | ||
ulint | offset | ||
) |
Low-level function which reads a page asynchronously from a file to the buffer buf_pool if it is not already there, in which case does nothing. Sets the io_fix flag and sets an exclusive lock on the buffer frame. The flag is cleared and the x-lock released by an i/o-handler thread.
Low-level function which reads a page asynchronously from a file to the buffer buf_pool if it is not already there, in which case does nothing. Sets the io_fix flag and sets an exclusive lock on the buffer frame. The flag is cleared and the x-lock released by an i/o-handler thread.
err | out: DB_SUCCESS or DB_TABLESPACE_DELETED if we are trying to read from a non-existent tablespace, or a tablespace which is just now being dropped |
sync | in: TRUE if synchronous aio is desired |
mode | in: BUF_READ_IBUF_PAGES_ONLY, ..., ORed to OS_AIO_SIMULATED_WAKE_LATER (see below at read-ahead functions) |
space | in: space id |
zip_size | in: compressed page size, or 0 |
unzip | in: TRUE=request uncompressed page |
tablespace_version | in: if the space memory object has this timestamp different from what we are giving here, treat the tablespace as dropped; this is a timestamp we use to stop dangling page reads from a tablespace which we have DISCARDed + IMPORTed back |
offset | in: page number |
Definition at line 61 of file buf0rea.cc.
References trx_doublewrite_struct::block1, trx_doublewrite_struct::block2, BUF_BLOCK_FILE_PAGE, buf_page_get_state(), buf_page_in_file(), page_zip_des_struct::data, ibuf_bitmap_page(), OS_AIO_SIMULATED_WAKE_LATER, OS_FILE_READ, trx_doublewrite, TRX_SYS_DOUBLEWRITE_BLOCK_SIZE, trx_sys_hdr_page(), ut_a, ut_ad, ut_print_timestamp(), and buf_page_struct::zip.
UNIV_INTERN void buf_read_recv_pages | ( | ibool | sync, |
ulint | space, | ||
ulint | zip_size, | ||
const ulint * | page_nos, | ||
ulint | n_stored | ||
) |
Issues read requests for pages which recovery wants to read in. in: number of page numbers in the array
Issues read requests for pages which recovery wants to read in.
sync | in: TRUE if the caller wants this function to wait for the highest address page to get read in, before this function returns |
space | in: space id |
zip_size | in: compressed page size in bytes, or 0 |
page_nos | in: array of page numbers to read, with the highest page number the last in the array |
n_stored | in: number of page numbers in the array |
Definition at line 576 of file buf0rea.cc.
References buf_pool_get(), BUF_READ_ANY_PAGE, buf_pool_struct::n_pend_reads, os_aio_print_debug, os_aio_simulated_wake_handler_threads(), OS_AIO_SIMULATED_WAKE_LATER, os_file_n_pending_preads, os_thread_sleep(), and recv_n_pool_free_frames.