diff options
author | Jan Lindström <jan.lindstrom@skysql.com> | 2014-11-06 13:17:11 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@skysql.com> | 2014-11-06 13:17:11 +0200 |
commit | a03dd94be804a4b8b1406696920834bb2c0bedbd (patch) | |
tree | 620b6a4dc5b401b0688f31b7fafc3de617a72f29 /storage/innobase/include/buf0lru.h | |
parent | 84de27709913fa6dcb90f535d54cd866f2ba5b7f (diff) | |
download | mariadb-git-a03dd94be804a4b8b1406696920834bb2c0bedbd.tar.gz |
MDEV-6936: Buffer pool list scan optimization
Merged Facebook commit 617aef9f911d825e9053f3d611d0389e02031225
authored by Inaam Rana to InnoDB storage engine (not XtraDB)
from https://github.com/facebook/mysql-5.6
WL#7047 - Optimize buffer pool list scans and related batch processing
Reduce excessive scanning of pages when doing flush list batches. The
fix is to introduce the concept of "Hazard Pointer", this reduces the
time complexity of the scan from O(n*n) to O.
The concept of hazard pointer is reversed in this work. Academically
hazard pointer is a pointer that the thread working on it will declar
such and as long as that thread is not done no other thread is allowe
do anything with it.
In this WL we declare the pointer as a hazard pointer and then if any
thread attempts to work on it, it is allowed to do so but it has to a
the hazard pointer to the next valid value. We use hazard pointer sol
reverse traversal of lists within a buffer pool instance.
Add an event to control the background flush thread. The background f
thread wait has been converted to an os event timed wait so that it c
signalled by threads that want to kick start a background flush when
buffer pool is running low on free/dirty pages.
Diffstat (limited to 'storage/innobase/include/buf0lru.h')
-rw-r--r-- | storage/innobase/include/buf0lru.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h index ecdaef685a1..f1f6abd2d68 100644 --- a/storage/innobase/include/buf0lru.h +++ b/storage/innobase/include/buf0lru.h @@ -117,7 +117,7 @@ buf_LRU_get_free_only( buf_pool_t* buf_pool); /*!< buffer pool instance */ /******************************************************************//** Returns a free block from the buf_pool. The block is taken off the -free list. If it is empty, blocks are moved from the end of the +free list. If free list is empty, blocks are moved from the end of the LRU list to the free list. This function is called from a user thread when it needs a clean block to read in a page. Note that we only ever get a block from @@ -125,8 +125,6 @@ the free list. Even when we flush a page or find a page in LRU scan we put it to free list to be used. * iteration 0: * get a block from free list, success:done - * if there is an LRU flush batch in progress: - * wait for batch to end: retry free list * if buf_pool->try_LRU_scan is set * scan LRU up to srv_LRU_scan_depth to find a clean block * the above will put the block on free list @@ -139,7 +137,7 @@ we put it to free list to be used. * scan whole LRU list * scan LRU list even if buf_pool->try_LRU_scan is not set * iteration > 1: - * same as iteration 1 but sleep 100ms + * same as iteration 1 but sleep 10ms @return the free control block, in state BUF_BLOCK_READY_FOR_USE */ UNIV_INTERN buf_block_t* @@ -231,6 +229,15 @@ buf_LRU_free_one_page( may or may not be a hash index to the page */ __attribute__((nonnull)); +/******************************************************************//** +Adjust LRU hazard pointers if needed. */ + +void +buf_LRU_adjust_hp( +/*==============*/ + buf_pool_t* buf_pool,/*!< in: buffer pool instance */ + const buf_page_t* bpage); /*!< in: control block */ + #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG /**********************************************************************//** Validates the LRU list. |