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

innodb_fast_shutdown=0 hang after incomplete startup

Details

    Description

      The following invocation will hang, because a recovered incomplete transaction exists but was not rolled back due to the fault injection innodb_log_abort_1:

      ./mtr --mysqld=--innodb-fast-shutdown=0 innodb.log_file_size
      

      The following patch fixes the hang on 10.5:

      diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
      index 9b8ce4b2fa8..ca2e4ec1a86 100644
      --- a/storage/innobase/srv/srv0start.cc
      +++ b/storage/innobase/srv/srv0start.cc
      @@ -1995,7 +1995,7 @@ void innodb_preshutdown()
           better prevent any further changes from being buffered. */
           innodb_change_buffering= 0;
       
      -    if (trx_sys.is_initialised())
      +    if (srv_was_started)
             while (trx_sys.any_active_transactions())
               os_thread_sleep(1000);
         }
      

      The flag srv_was_started implies trx_sys.is_initialised(), because innodb_init() would only assign that flag after a successful srv_start(), which includes initializing the transaction subsystem.

      MariaDB Server 10.4 is not affected by this.

      Attachments

        Activity

          The following patch that additionally checks innodb_force_recovery fixes also the tests innodb.read_only_recovery innodb.read_only_recover_committed mariabackup.apply-log-only-incr innodb.innodb_force_recovery:

          diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
          index 9b8ce4b2fa8..6f40df82f8f 100644
          --- a/storage/innobase/srv/srv0start.cc
          +++ b/storage/innobase/srv/srv0start.cc
          @@ -1995,7 +1995,7 @@ void innodb_preshutdown()
               better prevent any further changes from being buffered. */
               innodb_change_buffering= 0;
           
          -    if (trx_sys.is_initialised())
          +    if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO && srv_was_started)
                 while (trx_sys.any_active_transactions())
                   os_thread_sleep(1000);
             }
          

          marko Marko Mäkelä added a comment - The following patch that additionally checks innodb_force_recovery fixes also the tests innodb.read_only_recovery innodb.read_only_recover_committed mariabackup.apply-log-only-incr innodb.innodb_force_recovery : diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 9b8ce4b2fa8..6f40df82f8f 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1995,7 +1995,7 @@ void innodb_preshutdown() better prevent any further changes from being buffered. */ innodb_change_buffering= 0; - if (trx_sys.is_initialised()) + if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO && srv_was_started) while (trx_sys.any_active_transactions()) os_thread_sleep(1000); }

          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.