diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
|
--- a/storage/innobase/buf/buf0flu.cc
|
+++ b/storage/innobase/buf/buf0flu.cc
|
@@ -966,10 +966,12 @@ static bool buf_flush_check_neighbor(const page_id_t id, ulint fold, bool lru)
|
/** Check which neighbors of a page can be flushed from the buf_pool.
|
@param space tablespace
|
@param id page identifier of a dirty page
|
+@param contiguous whether to consider contiguous areas of pages
|
@param lru true=buf_pool.LRU; false=buf_pool.flush_list
|
@return last page number that can be flushed */
|
static page_id_t buf_flush_check_neighbors(const fil_space_t &space,
|
- page_id_t &id, bool lru)
|
+ page_id_t &id, bool contiguous,
|
+ bool lru)
|
{
|
ut_ad(id.page_no() < space.size);
|
/* When flushed, dirty blocks are searched in neighborhoods of this
|
@@ -983,6 +985,13 @@ static page_id_t buf_flush_check_neighbors(const fil_space_t &space,
|
high.set_page_no(std::min(high.page_no(),
|
static_cast<uint32_t>(space.committed_size - 1)));
|
|
+ if (!contiguous)
|
+ {
|
+ high= std::max(id + 1, high);
|
+ id= low;
|
+ return high;
|
+ }
|
+
|
/* Determine the contiguous dirty area around id. */
|
const ulint id_fold= id.fold();
|
|
@@ -1090,13 +1099,15 @@ static ulint buf_flush_try_neighbors(const page_id_t page_id, bool lru,
|
/* Flush the freed ranges while flushing the neighbors */
|
buf_flush_freed_pages(space);
|
|
+ const auto neighbors = srv_flush_neighbors;
|
+
|
page_id_t id = page_id;
|
- page_id_t high = (srv_flush_neighbors != 1
|
+ page_id_t high = (!neighbors
|
|| UT_LIST_GET_LEN(buf_pool.LRU)
|
< BUF_LRU_OLD_MIN_LEN
|
|| !space->is_rotational())
|
? id + 1 /* Flush the minimum. */
|
- : buf_flush_check_neighbors(*space, id, lru);
|
+ : buf_flush_check_neighbors(*space, id, neighbors == 1, lru);
|
|
ut_ad(page_id >= id);
|
ut_ad(page_id < high);
|