InnoDB Plugin
1.0
|
#include "univ.i"
#include "ut0byte.h"
#include "log0log.h"
#include "mtr0types.h"
#include "buf0types.h"
#include "buf0flu.ic"
Go to the source code of this file.
Functions | |
UNIV_INTERN void | buf_flush_remove (buf_page_t *bpage) |
UNIV_INTERN void | buf_flush_relocate_on_flush_list (buf_page_t *bpage, buf_page_t *dpage) |
UNIV_INTERN void | buf_flush_write_complete (buf_page_t *bpage) |
UNIV_INTERN void | buf_flush_init_for_writing (byte *page, void *page_zip_, lsn_t newest_lsn) |
UNIV_INTERN ibool | buf_flush_page_try (buf_pool_t *buf_pool, buf_block_t *block)) |
UNIV_INTERN bool | buf_flush_list (ulint min_n, lsn_t lsn_limit, ulint *n_processed) |
UNIV_INTERN ibool | buf_flush_single_page_from_LRU (buf_pool_t *buf_pool) |
UNIV_INTERN void | buf_flush_wait_batch_end (buf_pool_t *buf_pool, buf_flush_t type) |
UNIV_INTERN void | buf_flush_wait_batch_end_wait_only (buf_pool_t *buf_pool, buf_flush_t type) |
UNIV_INLINE void | buf_flush_note_modification (buf_block_t *block, mtr_t *mtr) |
UNIV_INLINE void | buf_flush_recv_note_modification (buf_block_t *block, lsn_t start_lsn, lsn_t end_lsn) |
UNIV_INTERN ibool | buf_flush_ready_for_replace (buf_page_t *bpage) |
UNIV_INTERN os_thread_ret_t DECLARE_THREAD() | buf_flush_page_cleaner_thread (void *arg) |
UNIV_INTERN ulint | buf_flush_LRU_tail (void) |
UNIV_INTERN void | buf_flush_wait_LRU_batch_end (void) |
UNIV_INTERN ibool | buf_flush_validate (buf_pool_t *buf_pool) |
UNIV_INTERN void | buf_flush_init_flush_rbt (void) |
UNIV_INTERN void | buf_flush_free_flush_rbt (void) |
UNIV_INTERN bool | buf_flush_page (buf_pool_t *buf_pool, buf_page_t *bpage, buf_flush_t flush_type, bool sync) |
UNIV_INTERN bool | buf_flush_ready_for_flush (buf_page_t *bpage, buf_flush_t flush_type)) |
UNIV_INTERN ulint | buf_pool_get_dirty_pages_count (buf_pool_t *buf_pool, ulint id) |
UNIV_INTERN ulint | buf_flush_get_dirty_pages_count (ulint id) |
Variables | |
ibool | buf_page_cleaner_is_active |
The database buffer pool flush algorithm
Created 11/5/1995 Heikki Tuuri
UNIV_INTERN void buf_flush_free_flush_rbt | ( | void | ) |
Frees up the red-black tree.
UNIV_INTERN ulint buf_flush_get_dirty_pages_count | ( | ulint | id | ) |
Check if there are any dirty pages that belong to a space id in the flush list.
UNIV_INTERN void buf_flush_init_flush_rbt | ( | void | ) |
Initialize the red-black tree to speed up insertions into the flush_list during recovery process. Should be called at the start of recovery process before any page has been read/written.
UNIV_INTERN void buf_flush_init_for_writing | ( | byte * | page, |
void * | page_zip_, | ||
lsn_t | newest_lsn | ||
) |
Initializes a page for writing to the tablespace. in: newest modification lsn to the page
page | in/out: page |
page_zip_ | in/out: compressed page, or NULL |
UNIV_INTERN bool buf_flush_list | ( | ulint | min_n, |
lsn_t | lsn_limit, | ||
ulint * | n_processed | ||
) |
This utility flushes dirty blocks from the end of the flush list of all buffer pool instances. NOTE: The calling thread is not allowed to own any latches on pages!
min_n | in: wished minimum mumber of blocks flushed (it is not guaranteed that the actual number is that big, though) |
lsn_limit | in the case BUF_FLUSH_LIST all blocks whose oldest_modification is smaller than this should be flushed (if their number does not exceed min_n), otherwise ignored |
UNIV_INTERN ulint buf_flush_LRU_tail | ( | void | ) |
Clears up tail of the LRU lists: Put replaceable pages at the tail of LRU to the free list Flush dirty pages at the tail of LRU to the disk The depth to which we scan each buffer pool is controlled by dynamic config parameter innodb_LRU_scan_depth.
UNIV_INLINE void buf_flush_note_modification | ( | buf_block_t * | block, |
mtr_t * | mtr | ||
) |
This function should be called at a mini-transaction commit, if a page was modified in it. Puts the block to the list of modified blocks, if it not already in it. in: mtr
This function should be called at a mini-transaction commit, if a page was modified in it. Puts the block to the list of modified blocks, if it is not already in it.
block | in: block which is modified |
mtr | in: mtr |
UNIV_INTERN bool buf_flush_page | ( | buf_pool_t * | buf_pool, |
buf_page_t * | bpage, | ||
buf_flush_t | flush_type, | ||
bool | sync | ||
) |
Writes a flushable page asynchronously from the buffer pool to a file. NOTE: in simulated aio we must call os_aio_simulated_wake_handler_threads after we have posted a batch of writes! NOTE: buf_pool->mutex and buf_page_get_mutex(bpage) must be held upon entering this function, and they will be released by this function if it returns true.
buf_pool | in: buffer pool instance |
bpage | in: buffer control block |
flush_type | in: type of flush |
UNIV_INTERN os_thread_ret_t DECLARE_THREAD() buf_flush_page_cleaner_thread | ( | void * | arg | ) |
page_cleaner thread tasked with flushing dirty pages from the buffer pools. As of now we'll have only one instance of this thread.
UNIV_INTERN ibool buf_flush_page_try | ( | buf_pool_t * | buf_pool, |
buf_block_t * | block | ||
) |
Writes a flushable page asynchronously from the buffer pool to a file. NOTE: buf_pool->mutex and block->mutex must be held upon entering this function, and they will be released by this function after flushing. This is loosely based on buf_flush_batch() and buf_flush_page().
buf_pool | in/out: buffer pool instance |
block | in/out: buffer control block |
UNIV_INTERN bool buf_flush_ready_for_flush | ( | buf_page_t * | bpage, |
buf_flush_t | flush_type | ||
) |
Returns true if the block is modified and ready for flushing.
bpage | in: buffer control block, must be buf_page_in_file(bpage) |
flush_type | in: type of flush |
UNIV_INTERN ibool buf_flush_ready_for_replace | ( | buf_page_t * | bpage | ) |
Returns TRUE if the file page block is immediately suitable for replacement, i.e., transition FILE_PAGE => NOT_USED allowed.
UNIV_INLINE void buf_flush_recv_note_modification | ( | buf_block_t * | block, |
lsn_t | start_lsn, | ||
lsn_t | end_lsn | ||
) |
This function should be called when recovery has modified a buffer page. in: end lsn of the last mtr in the set of mtr's
This function should be called when recovery has modified a buffer page.
block | in: block which is modified |
start_lsn | in: start lsn of the first mtr in a set of mtr's |
end_lsn | in: end lsn of the last mtr in the set of mtr's |
UNIV_INTERN void buf_flush_relocate_on_flush_list | ( | buf_page_t * | bpage, |
buf_page_t * | dpage | ||
) |
Relocates a buffer control block on the flush_list. Note that it is assumed that the contents of bpage has already been copied to dpage. in/out: destination block
bpage | in/out: control block being moved |
UNIV_INTERN void buf_flush_remove | ( | buf_page_t * | bpage | ) |
Remove a block from the flush list of modified blocks. in: pointer to the block in question
UNIV_INTERN ibool buf_flush_single_page_from_LRU | ( | buf_pool_t * | buf_pool | ) |
This function picks up a single dirty page from the tail of the LRU list, flushes it, removes it from page_hash and LRU list and puts it on the free list. It is called from user threads when they are unable to find a replacable page at the tail of the LRU list i.e.: when the background LRU flushing in the page_cleaner thread is not fast enough to keep pace with the workload.
UNIV_INTERN ibool buf_flush_validate | ( | buf_pool_t * | buf_pool | ) |
Validates the flush list.
UNIV_INTERN void buf_flush_wait_batch_end | ( | buf_pool_t * | buf_pool, |
buf_flush_t | type | ||
) |
Waits until a flush batch of the given type ends in: BUF_FLUSH_LRU or BUF_FLUSH_LIST
buf_pool | in: buffer pool instance |
UNIV_INTERN void buf_flush_wait_batch_end_wait_only | ( | buf_pool_t * | buf_pool, |
buf_flush_t | type | ||
) |
Waits until a flush batch of the given type ends. This is called by a thread that only wants to wait for a flush to end but doesn't do any flushing itself. in: BUF_FLUSH_LRU or BUF_FLUSH_LIST
buf_pool | in: buffer pool instance |
UNIV_INTERN void buf_flush_wait_LRU_batch_end | ( | void | ) |
Wait for any possible LRU flushes that are in progress to end.
UNIV_INTERN void buf_flush_write_complete | ( | buf_page_t * | bpage | ) |
Updates the flush system data structures when a write is completed. in: pointer to the block in question
UNIV_INTERN ulint buf_pool_get_dirty_pages_count | ( | buf_pool_t * | buf_pool, |
ulint | id | ||
) |
Check if there are any dirty pages that belong to a space id in the flush list in a particular buffer pool.
buf_pool | in: buffer pool |
ibool buf_page_cleaner_is_active |
Flag indicating if the page_cleaner is in active state.