From a6df44f9741a41f57b216b3d1432937803a36022 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Mon, 5 Nov 2012 10:54:17 -0800 Subject: [PATCH] Bug#67476: Innodb_buffer_pool_read_ahead_evicted is inaccurate If a page being read into the buffer pool is made "young" (moved to the head of the LRU), its time of first access it not properly recorded (that is, it remains with a value of zero). When the page eventually gets evicted, the page is counted as a read-ahead page that was evicted without having been accessed by queries. The solution is to ensure that the first access time is recorded even if the page is moved to the head of the LRU. --- storage/innobase/buf/buf0buf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c index d7c87c5..7a572d0 100644 --- a/storage/innobase/buf/buf0buf.c +++ b/storage/innobase/buf/buf0buf.c @@ -1691,7 +1691,8 @@ buf_page_set_accessed_make_young( read under mutex protection, or 0 if unknown */ { - buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); + buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); + ulint time_ms = access_time ? 0UL : ut_time_ms(); ut_ad(!buf_pool_mutex_own(buf_pool)); ut_a(buf_page_in_file(bpage)); @@ -1699,9 +1700,9 @@ buf_page_set_accessed_make_young( if (buf_page_peek_if_too_old(bpage)) { buf_pool_mutex_enter(buf_pool); buf_LRU_make_block_young(bpage); + buf_page_set_accessed(bpage, time_ms); buf_pool_mutex_exit(buf_pool); } else if (!access_time) { - ulint time_ms = ut_time_ms(); buf_pool_mutex_enter(buf_pool); buf_page_set_accessed(bpage, time_ms); buf_pool_mutex_exit(buf_pool); -- 1.8.0