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

Server hang with innodb_undo_log_truncate=ON

    XMLWordPrintable

Details

    Description

      The fix of MDEV-27414 turns out to be incomplete. The server can still hang, with a deadlock between buf_pool_t::release_freed_page() and trx_purge_truncate_history(). In the latter, we'd better actively wait for the former to complete:

      diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
      index b834c5d070d..e162456e63f 100644
      --- a/storage/innobase/trx/trx0purge.cc
      +++ b/storage/innobase/trx/trx0purge.cc
      @@ -768,11 +768,12 @@ TRANSACTIONAL_TARGET static void trx_purge_truncate_history()
               auto block= reinterpret_cast<buf_block_t*>(bpage);
               if (!bpage->lock.x_lock_try())
               {
      +        rescan:
                 /* Let buf_pool_t::release_freed_page() proceed. */
                 mysql_mutex_unlock(&buf_pool.flush_list_mutex);
      -          std::this_thread::yield();
      +          mysql_mutex_lock(&buf_pool.mutex);
                 mysql_mutex_lock(&buf_pool.flush_list_mutex);
      -        rescan:
      +          mysql_mutex_unlock(&buf_pool.mutex);
                 bpage= UT_LIST_GET_LAST(buf_pool.flush_list);
                 continue;
               }
      

      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.