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

LP:643463 - slow XtraDB shutdown due to 10 second sleep in purge thread

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Trivial
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      Shutting down XtraDB can take up to 10 seconds, even when there is no actual
      work to do during shutdown.

      An easy way to see this is to run a quick innodb test in the mysql-test-run.pl
      test suite:

      ./mtr innodb-consistent

      This takes >10 seconds, even though the actual test runs instantaneous.

      The problem is this code in srv/srv0srv.c:

      srv_purge_thread(...)
      {
      ulint sleep_ms= 10000; /* initial: 10 sec. */
      ...

      loop:
      if (srv_shutdown_state > 0)

      { ... }

      os_thread_sleep( sleep_ms * 1000 );
      ...
      goto loop;

      So right after startup, the purge thread sleeps for 10 seconds, so server
      cannot shut down for at least 10 seconds after startup.

      Of course, in a production server, the purge thread sleep could have adjusted
      itself to less than 10 seconds, and a busy server anyway will probably need
      much more than 10 seconds to shut down cleanly.

      But for development and testing, it is annoying to have to wait for 10 seconds
      for shutdown.

      Suggested fix:

      Change the os_thread_sleep() into a sleep that can be interrupted by
      shutdown. For example a wait with os_event_wait_time() on an event created
      specifically for this. (Note that currently os_event_wait_time() waits
      infinitely on non-windows, but it looks easy to fix this using
      pthread_cond_timedwait()). Then signal the purge thread sleep to wakeup early
      during server shutdown.

      Attachments

        Activity

          People

            knielsen Kristian Nielsen
            knielsen Kristian Nielsen
            Votes:
            0 Vote for this issue
            Watchers:
            0 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.