📄 buf0buf.h
字号:
Gets the youngest modification log sequence number for a frame.Returns zero if not file page or no modification occurred yet. */UNIV_INLINEdulintbuf_frame_get_newest_modification(/*==============================*/ /* out: newest modification to page */ buf_frame_t* frame); /* in: pointer to a frame *//************************************************************************Increments the modify clock of a frame by 1. The caller must (1) own thepool mutex and block bufferfix count has to be zero, (2) or own an x-lockon the block. */UNIV_INLINEdulintbuf_frame_modify_clock_inc(/*=======================*/ /* out: new value */ buf_frame_t* frame); /* in: pointer to a frame *//************************************************************************Increments the modify clock of a frame by 1. The caller must (1) own thebuf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lockon the block. */UNIV_INLINEdulintbuf_block_modify_clock_inc(/*=======================*/ /* out: new value */ buf_block_t* block); /* in: block *//************************************************************************Returns the value of the modify clock. The caller must have an s-lock or x-lock on the block. */UNIV_INLINEdulintbuf_block_get_modify_clock(/*=======================*/ /* out: value */ buf_block_t* block); /* in: block *//************************************************************************Calculates a page checksum which is stored to the page when it is writtento a file. Note that we must be careful to calculate the same valueon 32-bit and 64-bit architectures. */ulintbuf_calc_page_new_checksum(/*=======================*/ /* out: checksum */ byte* page); /* in: buffer page *//************************************************************************In versions < 4.0.14 and < 4.1.1 there was a bug that the checksum onlylooked at the first few bytes of the page. This calculates that oldchecksum. NOTE: we must first store the new formula checksum toFIL_PAGE_SPACE_OR_CHKSUM before calculating and storing this old checksumbecause this takes that field as an input! */ulintbuf_calc_page_old_checksum(/*=======================*/ /* out: checksum */ byte* page); /* in: buffer page *//************************************************************************Checks if a page is corrupt. */iboolbuf_page_is_corrupted(/*==================*/ /* out: TRUE if corrupted */ byte* read_buf); /* in: a database page *//**************************************************************************Gets the page number of a pointer pointing within a buffer frame containinga file page. */UNIV_INLINEulintbuf_frame_get_page_no(/*==================*/ /* out: page number */ byte* ptr); /* in: pointer to within a buffer frame *//**************************************************************************Gets the space id of a pointer pointing within a buffer frame containing afile page. */UNIV_INLINEulintbuf_frame_get_space_id(/*===================*/ /* out: space id */ byte* ptr); /* in: pointer to within a buffer frame *//**************************************************************************Gets the space id, page offset, and byte offset within page of apointer pointing to a buffer frame containing a file page. */UNIV_INLINEvoidbuf_ptr_get_fsp_addr(/*=================*/ byte* ptr, /* in: pointer to a buffer frame */ ulint* space, /* out: space id */ fil_addr_t* addr); /* out: page offset and byte offset *//**************************************************************************Gets the hash value of the page the pointer is pointing to. This can be usedin searches in the lock hash table. */UNIV_INLINEulintbuf_frame_get_lock_hash_val(/*========================*/ /* out: lock hash value */ byte* ptr); /* in: pointer to within a buffer frame *//**************************************************************************Gets the mutex number protecting the page record lock hash chain in the locktable. */UNIV_INLINEmutex_t*buf_frame_get_lock_mutex(/*=====================*/ /* out: mutex */ byte* ptr); /* in: pointer to within a buffer frame *//***********************************************************************Gets the frame the pointer is pointing to. */UNIV_INLINEbuf_frame_t*buf_frame_align(/*============*/ /* out: pointer to frame */ byte* ptr); /* in: pointer to a frame *//***********************************************************************Checks if a pointer points to the block array of the buffer pool (blocks, notthe frames). */UNIV_INLINEiboolbuf_pool_is_block(/*==============*/ /* out: TRUE if pointer to block */ void* ptr); /* in: pointer to memory */#ifdef UNIV_DEBUG/*************************************************************************Validates the buffer pool data structure. */iboolbuf_validate(void);/*==============*//*************************************************************************Prints info of the buffer pool data structure. */voidbuf_print(void);/*============*/#endif /* UNIV_DEBUG *//************************************************************************Prints a page to stderr. */voidbuf_page_print(/*===========*/ byte* read_buf); /* in: a database page *//*************************************************************************Returns the number of latched pages in the buffer pool. */ulintbuf_get_latched_pages_number(void);/*==============================*//*************************************************************************Returns the number of pending buf pool ios. */ulintbuf_get_n_pending_ios(void);/*=======================*//*************************************************************************Prints info of the buffer i/o. */voidbuf_print_io(/*=========*/ FILE* file); /* in: file where to print *//*************************************************************************Returns the ratio in percents of modified pages in the buffer pool /database pages in the buffer pool. */ulintbuf_get_modified_ratio_pct(void);/*============================*//**************************************************************************Refreshes the statistics used to print per-second averages. */voidbuf_refresh_io_stats(void);/*======================*//*************************************************************************Checks that all file pages in the buffer are in a replaceable state. */iboolbuf_all_freed(void);/*===============*//*************************************************************************Checks that there currently are no pending i/o-operations for the bufferpool. */iboolbuf_pool_check_no_pending_io(void);/*==============================*/ /* out: TRUE if there is no pending i/o *//*************************************************************************Invalidates the file pages in the buffer pool when an archive recovery iscompleted. All the file pages buffered must be in a replaceable state whenthis function is called: not latched and not modified. */voidbuf_pool_invalidate(void);/*=====================*//*========================================================================--------------------------- LOWER LEVEL ROUTINES -------------------------=========================================================================*//************************************************************************Maps the page of block to a frame, if not mapped yet. Unmaps some pagefrom the end of the awe_LRU_free_mapped. */voidbuf_awe_map_page_to_frame(/*======================*/ buf_block_t* block, /* in: block whose page should be mapped to a frame */ ibool add_to_mapped_list);/* in: TRUE if we in the case we need to map the page should also add the block to the awe_LRU_free_mapped list */#ifdef UNIV_SYNC_DEBUG/*************************************************************************Adds latch level info for the rw-lock protecting the buffer frame. Thisshould be called in the debug version after a successful latching of apage if we know the latching order level of the acquired latch. */UNIV_INLINEvoidbuf_page_dbg_add_level(/*===================*/ buf_frame_t* frame, /* in: buffer page where we have acquired a latch */ ulint level); /* in: latching order level */#endif /* UNIV_SYNC_DEBUG *//*************************************************************************Gets a pointer to the memory frame of a block. */UNIV_INLINEbuf_frame_t*buf_block_get_frame(/*================*/ /* out: pointer to the frame */ buf_block_t* block); /* in: pointer to the control block *//*************************************************************************Gets the space id of a block. */UNIV_INLINEulintbuf_block_get_space(/*================*/ /* out: space id */ buf_block_t* block); /* in: pointer to the control block *//*************************************************************************Gets the page number of a block. */UNIV_INLINEulintbuf_block_get_page_no(/*==================*/ /* out: page number */ buf_block_t* block); /* in: pointer to the control block *//***********************************************************************Gets the block to whose frame the pointer is pointing to. */UNIV_INLINEbuf_block_t*buf_block_align(/*============*/ /* out: pointer to block */ byte* ptr); /* in: pointer to a frame *//************************************************************************This function is used to get info if there is an io operationgoing on on a buffer page. */UNIV_INLINEiboolbuf_page_io_query(/*==============*/ /* out: TRUE if io going on */ buf_block_t* block); /* in: pool block, must be bufferfixed *//***********************************************************************Accessor function for block array. */UNIV_INLINEbuf_block_t*buf_pool_get_nth_block(/*===================*/ /* out: pointer to block */ buf_pool_t* pool, /* in: pool */ ulint i); /* in: index of the block *//************************************************************************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 lockon the buffer frame. The io-handler must take care that the flag is clearedand the lock released later. This is one of the functions which perform thestate transition NOT_USED => FILE_PAGE to a block (the other isbuf_page_create). */ buf_block_t*buf_page_init_for_read(/*===================*/ /* out: pointer to the block or NULL */ ulint* err, /* out: DB_SUCCESS or DB_TABLESPACE_DELETED */ ulint mode, /* in: BUF_READ_IBUF_PAGES_ONLY, ... */ ulint space, /* in: space id */ ib_longlong tablespace_version,/* in: prevents reading from a wrong version of the tablespace in case we have done DISCARD + IMPORT */ ulint offset);/* in: page number *//************************************************************************Completes an asynchronous read or write request of a file page to or fromthe buffer pool. */voidbuf_page_io_complete(/*=================*/ buf_block_t* block); /* in: pointer to the block in question *//************************************************************************Calculates a folded value of a file page address to use in the page hashtable. */UNIV_INLINEulintbuf_page_address_fold(/*==================*/ /* out: the folded value */ ulint space, /* in: space id */ ulint offset);/* in: offset of the page within space *//**********************************************************************Returns the control block of a file page, NULL if not found. */UNIV_INLINEbuf_block_t*buf_page_hash_get(/*==============*/ /* out: block, NULL if not found */ ulint space, /* in: space id */ ulint offset);/* in: offset of the page within space *//***********************************************************************Increments the pool clock by one and returns its new value. Remember thatin the 32 bit version the clock wraps around at 4 billion! */UNIV_INLINEulintbuf_pool_clock_tic(void);/*====================*/ /* out: new clock value *//*************************************************************************Gets the current length of the free list of buffer blocks. */ulintbuf_get_free_list_len(void);/*=======================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -