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

Purge thread fails to exit on shutdown

    XMLWordPrintable

Details

    Description

      When there is a huge transaction in the undo log, the purge subsystem may get stuck and fail to shut down. This was reproduced with the following on MariaDB 10.4:

      diff --git a/mysql-test/suite/innodb/include/innodb-page-compression.inc b/mysql-test/suite/innodb/include/innodb-page-compression.inc
      index 0e7ae8cf029..83e5387cdf4 100644
      --- a/mysql-test/suite/innodb/include/innodb-page-compression.inc
      +++ b/mysql-test/suite/innodb/include/innodb-page-compression.inc
      @@ -11,7 +11,7 @@ create table innodb_page_compressed9 (c1 int not null auto_increment primary key
       
       --disable_query_log
       begin;
      -let $i = 2000;
      +let $i = 5000;
       while ($i)
       {
           insert into innodb_normal(b) values(REPEAT('Aa',50));
      

      With this change, the attempt to restart the server would actually time out in the shutdown, like this:

      10.4

      innodb.innodb-page_compression_snappy 'innodb' [ fail ]  Found warnings/errors in server log file!
              Test ended at 2019-03-15 11:15:05
      line
      2019-03-15 11:14:48 0 [Warning] /dev/shm/10.4/sql/mysqld: Thread 5 (user : '') did not exit
      2019-03-15 11:14:48 0 [Warning] /dev/shm/10.4/sql/mysqld: Thread 4 (user : '') did not exit
      2019-03-15 11:14:48 0 [Warning] /dev/shm/10.4/sql/mysqld: Thread 3 (user : '') did not exit
      2019-03-15 11:14:48 0 [Warning] /dev/shm/10.4/sql/mysqld: Thread 2 (user : '') did not exit
      2019-03-15 11:14:48 0 [Warning] /dev/shm/10.4/sql/mysqld: Thread 1 (user : '') did not exit
      ^ Found warnings in /dev/shm/10.4/mysql-test/var/log/mysqld.1.err
      ok
      

      The cause is that a purge thread would remain stuck in trx_purge_attach_undo_recs(). Apparently the innodb_purge_batch_size does not work correctly, or the n_pages_handled is not being incremented correctly. In any case, we should exit the loop on non-slow shutdown even before reaching the batch size.

      Attachments

        Issue Links

          Activity

            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.