------------------------------------------------------------ revno: 8772 committer: Laurynas Biveinis branch nick: mysql-5.7-percona-patches timestamp: Thu 2014-10-30 21:27:12 +0200 message: Fix bug 71411 (buf_flush_LRU() does not return correct number in case of compressed pages). - The unzip_LRU-evicted pages were not accounted as evicted for InnoDB metrics in buf_free_from_unzip_LRU_list_batch. - buf_flush_LRU_list_batch only returned flushed, not evicted pages as processed ones. Return the sum of both instead. - Tweak source comments to clarify where "LRU-flushed pages" actually mean "LRU-flushed and evicted pages." - Remove unused function buf_flush_LRU_lists. diff: === modified file 'storage/innobase/buf/buf0flu.cc' --- storage/innobase/buf/buf0flu.cc 2014-08-26 15:37:03 +0000 +++ storage/innobase/buf/buf0flu.cc 2014-10-30 19:27:12 +0000 @@ -95,8 +95,9 @@ and commited with state==PAGE_CLEANER_STATE_FINISHED. The consistency is protected by the 'state' */ ulint n_flushed_lru; - /*!< number of flushed pages - by LRU scan flushing */ + /*!< number of flushed and evicted + pages by LRU scan flushing */ + ulint n_flushed_list; /*!< number of flushed pages by flush_list flushing */ @@ -1465,6 +1466,14 @@ ut_ad(buf_pool_mutex_own(buf_pool)); + if (count) { + MONITOR_INC_VALUE_CUMULATIVE( + MONITOR_LRU_BATCH_EVICT_TOTAL_PAGE, + MONITOR_LRU_BATCH_EVICT_COUNT, + MONITOR_LRU_BATCH_EVICT_PAGES, + count); + } + if (scanned) { MONITOR_INC_VALUE_CUMULATIVE( MONITOR_LRU_BATCH_SCANNED, @@ -1482,7 +1491,8 @@ It attempts to make 'max' blocks available in the free list. Note that it is a best effort attempt and it is not guaranteed that after a call to this function there will be 'max' blocks in the free list. -@return number of blocks for which the write request was queued. */ +@return sum of evicted blocks and blocks for which the write request was +queued. */ static ulint buf_flush_LRU_list_batch( @@ -1574,15 +1584,14 @@ scanned); } - return(count); + return(count + evict_count); } /*******************************************************************//** Flush and move pages from LRU or unzip_LRU list to the free list. Whether LRU or unzip_LRU is used depends on the state of the system. -@return number of blocks for which either the write request was queued -or in case of unzip_LRU the number of blocks actually moved to the -free list */ +@return sum of blocks for which either the write request was queued, either +they were evicted from LRU or unzip_LRU. */ static ulint buf_do_LRU_batch( @@ -1698,7 +1707,8 @@ pages: to avoid deadlocks, this function must be written so that it cannot end up waiting for these latches! NOTE 2: in the case of a flush list flush, the calling thread is not allowed to own any latches on pages! -@return number of blocks for which the write request was queued */ +@return sum of blocks for which either the write request was queued, either +they were evicted from LRU or unzip_LRU in case of LRU flush. */ static ulint buf_flush_batch( @@ -2094,7 +2104,7 @@ The depth to which we scan each buffer pool is controlled by dynamic config parameter innodb_LRU_scan_depth. @param buf_pool buffer pool instance -@return total pages flushed */ +@return total pages flushed and evicted */ static ulint buf_flush_LRU_list( @@ -2136,32 +2146,6 @@ } /*********************************************************************//** -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. -@return total pages flushed */ - -ulint -buf_flush_LRU_lists(void) -/*=====================*/ -{ - ulint n_flushed = 0; - - for (ulint i = 0; i < srv_buf_pool_instances; i++) { - - n_flushed += buf_flush_LRU_list(buf_pool_from_array(i)); - } - - if (n_flushed) { - buf_flush_stats(0, n_flushed); - } - - return(n_flushed); -} - -/*********************************************************************//** Wait for any possible LRU flushes that are in progress to end. */ void @@ -2581,7 +2565,8 @@ /** Wait until all flush requests are finished. -@param n_flushed_lru number of pages flushed from the end of the LRU list. +@param n_flushed_lru number of pages flushed and evicted from the end of the + LRU list. @param n_flushed_list number of pages flushed from the end of the flush_list. @return true if all flush_list flushing batch were success. */ === modified file 'storage/innobase/include/buf0flu.h' --- storage/innobase/include/buf0flu.h 2014-07-07 11:14:44 +0000 +++ storage/innobase/include/buf0flu.h 2014-10-30 19:27:12 +0000 @@ -228,17 +228,6 @@ buf_flush_page_cleaner_init(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. -@return total pages flushed */ - -ulint -buf_flush_LRU_lists(void); -/*=====================*/ -/*********************************************************************//** Wait for any possible LRU flushes that are in progress to end. */ void