📄 buf0rea.h
字号:
/******************************************************The database buffer read(c) 1995 Innobase OyCreated 11/5/1995 Heikki Tuuri*******************************************************/#ifndef buf0rea_h#define buf0rea_h#include "univ.i"#include "buf0types.h"/************************************************************************High-level function which reads a page asynchronously from a file to thebuffer buf_pool if it is not already there. Sets the io_fix flag and setsan exclusive lock on the buffer frame. The flag is cleared and the x-lockreleased by the i/o-handler thread. Does a random read-ahead if it seemssensible. */ulintbuf_read_page(/*==========*/ /* out: number of page read requests issued: this can be > 1 if read-ahead occurred */ ulint space, /* in: space id */ ulint offset);/* in: page number *//************************************************************************Applies linear read-ahead if in the buf_pool the page is a border page ofa 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. Notethat the the algorithm looks at the 'natural' adjacent successor andpredecessor of the page, which on the leaf level of a B-tree are the nextand previous page in the chain of leaves. To know these, the page specifiedin (space, offset) must already be present in the buf_pool. Thus, thenatural way to use this function is to call it when a page in the buf_poolis accessed the first time, calling this function just after it has beenbufferfixed.NOTE 1: as this function looks at the natural predecessor and successorfields on the page, what happens, if these are not initialized to anysensible value? No problem, before applying read-ahead we check that thearea to read is within the span of the space, if not, read-ahead is notapplied. An uninitialized value may result in a useless read operation, butonly very improbably.NOTE 2: the calling thread may own latches on pages: to avoid deadlocks thisfunction must be written such that it cannot end up waiting for theselatches!NOTE 3: the calling thread must want access to the page given: this rule isset to prevent unintended read-aheads performed by ibuf routines, a situationwhich could result in a deadlock if the OS does not support asynchronous io. */ulintbuf_read_ahead_linear(/*==================*/ /* out: number of page read requests issued */ ulint space, /* in: space id */ ulint offset);/* in: page number of a page; NOTE: the current thread must want access to this page (see NOTE 3 above) *//************************************************************************Issues read requests for pages which the ibuf module wants to read in, inorder to contract the insert buffer tree. Technically, this function is likea read-ahead function. */voidbuf_read_ibuf_merge_pages(/*======================*/ ibool sync, /* in: TRUE if the caller wants this function to wait for the highest address page to get read in, before this function returns */ ulint* space_ids, /* in: array of space ids */ ib_longlong* 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 */ ulint* page_nos, /* in: array of page numbers to read, with the highest page number the last in the array */ ulint n_stored); /* in: number of page numbers in the array *//************************************************************************Issues read requests for pages which recovery wants to read in. */voidbuf_read_recv_pages(/*================*/ ibool sync, /* in: TRUE if the caller wants this function to wait for the highest address page to get read in, before this function returns */ ulint space, /* in: space id */ ulint* page_nos, /* in: array of page numbers to read, with the highest page number the last in the array */ ulint n_stored); /* in: number of page numbers in the array *//* The size in pages of the area which the read-ahead algorithms read ifinvoked */#define BUF_READ_AHEAD_AREA ut_min(64, ut_2_power_up(buf_pool->curr_size / 32))/* Modes used in read-ahead */#define BUF_READ_IBUF_PAGES_ONLY 131#define BUF_READ_ANY_PAGE 132#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -