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

Assertion fold == id.fold() failed in buf_flush_check_neighbor()

    XMLWordPrintable

Details

    Description

      The setting innodb_flush_neighbors is broken on 64-bit platforms ever since the code was refactored in MDEV-23399 to avoid recomputing page_id_t::fold() in buf_flush_check_neighbors(). The following fixes the problem that was repeatable when attempting to flush pages in the temporary tablespace around page number 0x200002:

      diff --git a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h
      --- a/storage/innobase/include/buf0types.h
      +++ b/storage/innobase/include/buf0types.h
      @@ -162,7 +162,10 @@ class page_id_t
       
         /** Retrieve the fold value.
         @return fold value */
      -  ulint fold() const { return (space() << 20) + space() + page_no(); }
      +  ulint fold() const
      +  {
      +    return sizeof(ulint) == 8 ? m_id : (space() << 20) + space() + page_no();
      +  }
       
         /** Reset the page number only.
         @param[in]	page_no	page number */
      

      The problem is that the return type of page_id_t::space() is uint32_t, and therefore on 64-bit systems the fold value would not be the nonzero value (((ulint)0xfffffffe)<<20)+0xfffffffe+0x200002 (as it could be assumed on a quick read of the code), but 0, because that is what (((uint32_t)0xfffffffe)<<20)+0xfffffffe+0x200002 evaluates to.

      Furthermore, there is some indication that despite MDEV-17380, neighbour flushing was attempted on a NVMe device (major number: 259, minor number 0).

      The performance of the above patch will have to be tested.

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.