diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 820133d..d021589 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2306,6 +2306,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( { ulint next_loop_time = ut_time_ms() + 1000; ulint n_flushed = 0; + ulint n_processed = 0; ulint last_activity = srv_get_activity_count(); ut_ad(!srv_read_only_mode); @@ -2328,21 +2329,21 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( and there is work to do. */ if (srv_check_activity(last_activity) || buf_get_n_pending_read_ios() - || n_flushed == 0) { + || n_processed == 0) { page_cleaner_sleep_if_needed(next_loop_time); } next_loop_time = ut_time_ms() + 1000; + /* Flush pages from end of LRU if required */ + n_processed = buf_flush_LRU_tail(); + if (srv_check_activity(last_activity)) { last_activity = srv_get_activity_count(); - /* Flush pages from end of LRU if required */ - n_flushed = buf_flush_LRU_tail(); - /* Flush pages from flush_list if required */ - n_flushed += page_cleaner_flush_pages_if_needed(); + n_flushed = page_cleaner_flush_pages_if_needed(); } else { n_flushed = page_cleaner_do_flush_batch( PCT_IO(100), LSN_MAX); @@ -2355,6 +2356,8 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( n_flushed); } } + + n_processed += n_flushed; } ut_ad(srv_shutdown_state > 0);