Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-23909

innodb_flush_neighbors=2 is treated like innodb_flush_neighbors=0

    XMLWordPrintable

Details

    Description

      In MDEV-15053, the code to handle the configuration parameter innodb_flush_neighbors was changed. We only test whether the parameter is 1, hence, the values 0 and 2 are being treated equally. The function buf_flush_try_neighbors() used to check for all 3 values.

      Starting with MDEV-15053, the function buf_flush_check_neighbors() will always limit the page number range to be contiguous when it is being invoked. We should adjust the call and add another parameter to indicate whether the range needs to be contiguous:

      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);
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.