diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index cc510f3c461..2b12b0c9b7e 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2022,7 +2022,8 @@ static bool buf_flush_start(buf_pool_t *buf_pool, buf_flush_t flush_type) { /** End a buffer flush batch for LRU or flush list @param[in] buf_pool buffer pool instance @param[in] flush_type BUF_FLUSH_LRU or BUF_FLUSH_LIST */ -static void buf_flush_end(buf_pool_t *buf_pool, buf_flush_t flush_type) { +static void buf_flush_end(buf_pool_t *buf_pool, buf_flush_t flush_type, + ulint page_count) { mutex_enter(&buf_pool->flush_state_mutex); buf_pool->init_flush[flush_type] = false; @@ -2037,14 +2038,16 @@ static void buf_flush_end(buf_pool_t *buf_pool, buf_flush_t flush_type) { mutex_exit(&buf_pool->flush_state_mutex); - if (!srv_read_only_mode) { - if (dblwr::is_enabled()) { - dblwr::force_flush(flush_type, buf_pool_index(buf_pool)); + if (page_count) { + if (!srv_read_only_mode) { + if (dblwr::is_enabled()) { + dblwr::force_flush(flush_type, buf_pool_index(buf_pool)); + } else { + buf_flush_sync_datafiles(); + } } else { - buf_flush_sync_datafiles(); + os_aio_simulated_wake_handler_threads(); } - } else { - os_aio_simulated_wake_handler_threads(); } } @@ -2082,7 +2085,7 @@ bool buf_flush_do_batch(buf_pool_t *buf_pool, buf_flush_t type, ulint min_n, ulint page_count = buf_flush_batch(buf_pool, type, min_n, lsn_limit); - buf_flush_end(buf_pool, type); + buf_flush_end(buf_pool, type, page_count); if (n_processed != nullptr) { *n_processed = page_count;