diff options
author | Jan Lindström <jplindst@mariadb.org> | 2014-10-24 18:58:04 +0300 |
---|---|---|
committer | Jan Lindström <jplindst@mariadb.org> | 2014-10-24 18:58:04 +0300 |
commit | 78e31f0a2edd620cc0f642f592a9168f40a5e333 (patch) | |
tree | a1cdd58f0c4adba9d950a2ef5e27bc01eee8f5bf /storage/xtradb/buf | |
parent | 7e71dfa9f5e2ee9c44cdbc265b23a741a51b3f95 (diff) | |
download | mariadb-git-78e31f0a2edd620cc0f642f592a9168f40a5e333.tar.gz |
MDEV-6931: Page cleaner should do LRU flushing regardless of server activity
Merge Facebook commit 926a077b14b73c14094de7fc7aa913241b801b4d
authored by Inaam Rana from https://github.com/facebook/mysql-5.6.
This is fix for upstream bugs
http://bugs.mysql.com/bug.php?id=71988
http://bugs.mysql.com/bug.php?id=70500
page_cleaner should work whether or not there is server activity.
Its iterations become a noop when there is no work to do but we
should not tie it to the server activity.
The page_cleaner thread does spurious background flushing
because of conditional sleep between iterations. The solution
is not to make sleep dependent on server activity etc.
Diffstat (limited to 'storage/xtradb/buf')
-rw-r--r-- | storage/xtradb/buf/buf0flu.cc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc index d1656a4dd48..827e01e2096 100644 --- a/storage/xtradb/buf/buf0flu.cc +++ b/storage/xtradb/buf/buf0flu.cc @@ -2694,14 +2694,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( srv_current_thread_priority = srv_cleaner_thread_priority; - /* The page_cleaner skips sleep if the server is - idle and there are no pending IOs in the buffer pool - and there is work to do. */ - if (srv_check_activity(last_activity) - || buf_get_n_pending_read_ios() - || n_flushed == 0) { - page_cleaner_sleep_if_needed(next_loop_time); - } + page_cleaner_sleep_if_needed(next_loop_time); page_cleaner_sleep_time = page_cleaner_adapt_flush_sleep_time(); @@ -2709,6 +2702,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( next_loop_time = ut_time_ms() + page_cleaner_sleep_time; server_active = srv_check_activity(last_activity); + if (server_active || ut_time_ms() - last_activity_time < 1000) { @@ -2719,7 +2713,8 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( } /* Flush pages from flush_list if required */ - n_flushed += page_cleaner_flush_pages_if_needed(); + page_cleaner_flush_pages_if_needed(); + n_flushed = 0; } else { n_flushed = page_cleaner_do_flush_batch( PCT_IO(100), @@ -2733,6 +2728,9 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( n_flushed); } } + + /* Flush pages from end of LRU if required */ + n_flushed = buf_flush_LRU_tail(); } ut_ad(srv_shutdown_state > 0); |