![]()  | 
  
    MySQL 9.5.0
    
   Source Code Documentation 
   | 
 
The database buffer read. More...
Go to the source code of this file.
Functions | |
| ulint | buf_read_page_low (dberr_t *err, bool sync, ulint type, ulint mode, const page_id_t &page_id, const page_size_t &page_size, bool unzip) | 
| 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.  More... | |
| bool | buf_read_page (const page_id_t &page_id, const page_size_t &page_size) | 
| High-level function which reads a page asynchronously from a file to the buffer buf_pool if it is not already there.  More... | |
| bool | buf_read_page_background (const page_id_t &page_id, const page_size_t &page_size, bool sync) | 
| High-level function which reads a page asynchronously from a file to the buffer buf_pool if it is not already there.  More... | |
| ulint | buf_read_ahead_random (const page_id_t &page_id, const page_size_t &page_size, bool inside_ibuf) | 
| Applies a random read-ahead in buf_pool if there are at least a threshold value of accessed pages from the random read-ahead area.  More... | |
| ulint | buf_read_ahead_linear (const page_id_t &page_id, const page_size_t &page_size, bool 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.  More... | |
| void | buf_read_ibuf_merge_pages (bool sync, const space_id_t *space_ids, const page_no_t *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.  More... | |
| void | buf_read_recv_pages (space_id_t space_id, const page_no_t *page_nos, ulint n_stored) | 
| Issues asynchronous read requests for pages which recovery wants to read in.  More... | |
Variables | |
Modes used in read-ahead  | |
| constexpr uint32_t | BUF_READ_IBUF_PAGES_ONLY = 131 | 
| read only pages belonging to the insert buffer tree  More... | |
| constexpr uint32_t | BUF_READ_ANY_PAGE = 132 | 
| read any page  More... | |
The database buffer read.
Created 11/5/1995 Heikki Tuuri
| ulint buf_read_ahead_linear | ( | const page_id_t & | page_id, | 
| const page_size_t & | page_size, | ||
| bool | 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 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.
| [in] | page_id | page id; see NOTE 3 above | 
| [in] | page_size | page size | 
| [in] | inside_ibuf | true if we are inside ibuf routine | 
| ulint buf_read_ahead_random | ( | const page_id_t & | page_id, | 
| const page_size_t & | page_size, | ||
| bool | inside_ibuf | ||
| ) | 
Applies a random read-ahead in buf_pool if there are at least a threshold value of accessed pages from the random read-ahead area.
Does not read any page, not even the one at the position (space, offset), if the read-ahead mechanism is not activated. NOTE 1: 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 2: 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 i/o.
| [in] | page_id | page id of a page which the current thread wants to access | 
| [in] | page_size | page size | 
| [in] | inside_ibuf | true if we are inside ibuf routine | 
| void buf_read_ibuf_merge_pages | ( | bool | sync, | 
| const space_id_t * | space_ids, | ||
| const page_no_t * | 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] | sync | true if the caller wants this function to wait for the highest address page to get read in, before this function returns. | 
| [in] | space_ids | Array of space ids. | 
| [in] | page_nos | Array of page numbers to read, with the highest page number the last in the array. | 
| [in] | n_stored | number of elements in the arrays. | 
| bool buf_read_page | ( | const page_id_t & | page_id, | 
| const page_size_t & | page_size | ||
| ) | 
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.
| [in] | page_id | page id | 
| [in] | page_size | page size | 
| bool buf_read_page_background | ( | const page_id_t & | page_id, | 
| const page_size_t & | page_size, | ||
| bool | sync | ||
| ) | 
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.
| [in] | page_id | page id | 
| [in] | page_size | page size | 
| [in] | sync | true if synchronous aio is desired | 
| ulint buf_read_page_low | ( | dberr_t * | err, | 
| bool | sync, | ||
| ulint | type, | ||
| ulint | mode, | ||
| const page_id_t & | page_id, | ||
| const page_size_t & | page_size, | ||
| bool | unzip | ||
| ) | 
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.
| [out] | err | 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 | 
| [in] | sync | whether synchronous aio is desired | 
| [in] | type | Request type | 
| [in] | mode | BUF_READ_IBUF_PAGES_ONLY, ... | 
| [in] | page_id | page id | 
| [in] | page_size | page size | 
| [in] | unzip | true=request uncompressed page | 
| void buf_read_recv_pages | ( | space_id_t | space_id, | 
| const page_no_t * | page_nos, | ||
| ulint | n_stored | ||
| ) | 
Issues asynchronous read requests for pages which recovery wants to read in.
| [in] | space_id | tablespace id | 
| [in] | page_nos | array of page numbers to read, with the highest page number the last in the array | 
| [in] | n_stored | number of page numbers in the array | 
      
  | 
  constexpr | 
read any page
      
  | 
  constexpr | 
read only pages belonging to the insert buffer tree