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

buf_page_free() fails to drop the adaptive hash index

    XMLWordPrintable

    Details

      Description

      In a recent test run on 10.6, we got an assertion failure on shutdown:

      10.6 e6a06113880fe3842fe7068d42bcae8bb02ab024

      Thread 1 received signal SIGUSR1, User defined signal 1.
      0x0000000070000002 in syscall_traced ()
      (rr) c
      Continuing.
      2022-01-13 12:10:28 0 [Note] /data/Server_bin/10.6M_asan/bin/mysqld (initiated by: root[root] @ localhost [127.0.0.1]): Normal shutdown
      2022-01-13 12:10:28 0 [Warning] Aborted connection 80 to db: 'mysql' user: 'root' host: 'localhost' (KILLED)
      2022-01-13 12:10:28 0 [Warning] Aborted connection 15 to db: 'mysql' user: 'root' host: 'localhost' (KILLED)
      2022-01-13 12:10:28 15 [Warning] Aborted connection 15 to db: 'mysql' user: 'root' host: 'localhost' (This connection closed normally)
      2022-01-13 12:10:29 80 [Warning] Aborted connection 80 to db: 'mysql' user: 'root' host: 'localhost' (This connection closed normally)
      2022-01-13 12:10:29 0 [Note] InnoDB: FTS optimize thread exiting.
      2022-01-13 12:10:29 0 [Note] InnoDB: Starting shutdown...
      2022-01-13 12:10:29 0 [Note] InnoDB: Dumping buffer pool(s) to /data/rqg/1642089155/22/1/data/ib_buffer_pool
      2022-01-13 12:10:29 0 [Note] InnoDB: Buffer pool(s) dump completed at 220113 12:10:29
      mysqld: /data/Server/10.6M/storage/innobase/btr/btr0sea.cc:942: void buf_pool_t::clear_hash_index(): Assertion `s >= buf_page_t::UNFIXED || s == buf_page_t::REMOVE_HASH' failed.
      [New Thread 95798.194791]
      

      This assertion is stricter since MDEV-27058. Previously, it did not assert that the page has not been marked as free. I think that the following (untested) patch for 10.6 should fix the cause of this bug:

      diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
      index 11d820be305..93934dd2b5b 100644
      --- a/storage/innobase/buf/buf0buf.cc
      +++ b/storage/innobase/buf/buf0buf.cc
      @@ -2238,6 +2238,10 @@ void buf_page_free(fil_space_t *space, uint32_t page, mtr_t *mtr)
         }
       
         block->page.lock.x_lock();
      +#ifdef BTR_CUR_HASH_ADAPT
      +  if (block->index)
      +    btr_search_drop_page_hash_index(block);
      +#endif /* BTR_CUR_HASH_ADAPT */
         block->page.set_freed(block->page.state());
         mtr->memo_push(block, MTR_MEMO_PAGE_X_FIX);
       }
      

      The 10.5 version is slightly different:

      diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
      index 37f99a94cee..7be40ac38e7 100644
      --- a/storage/innobase/buf/buf0buf.cc
      +++ b/storage/innobase/buf/buf0buf.cc
      @@ -2500,6 +2500,11 @@ void buf_page_free(fil_space_t *space, uint32_t page, mtr_t *mtr,
             rw_lock_x_lock_inline(&block->lock, 0, file, line);
             buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
       
      +#ifdef BTR_CUR_HASH_ADAPT
      +      if (block->index)
      +        btr_search_drop_page_hash_index(block);
      +#endif /* BTR_CUR_HASH_ADAPT */
      +
             block->page.status= buf_page_t::FREED;
             return;
           }
      

      Matthias Leich, can you please test these?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marko Marko Mäkelä
              Reporter:
              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.