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

SET GLOBAL innodb_undo_log_truncate=ON does not free space when no undo logs exist

Details

    Description

      The following simple test demonstrates that innodb_undo_log_truncate=ON fails to truncate undo tablespaces:

      --source include/have_innodb.inc
      --source include/have_sequence.inc
       
      SET GLOBAL innodb_fast_shutdown=0, innodb_undo_log_truncate=OFF;
       
      CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
      INSERT INTO t SELECT seq, NULL FROM seq_1_to_500000;
       
      --source include/restart_mysqld.inc
      SET GLOBAL innodb_fast_shutdown=0, innodb_undo_log_truncate=ON;
      --source include/restart_mysqld.inc
       
      DROP TABLE t;
      

      Invocation:

      ./mtr --mysqld=--innodb-undo-tablespaces=2 name_of_test
      wc -c var/mysqld.1/data/undo*
      

      10.5 bb9da13baf5e5a4a435408fc05fd46253a00ea69

      10485760 var/mysqld.1/data/undo001
      13631488 var/mysqld.1/data/undo002
      24117248 total
      

      The expected outcome would be that all undo tablespaces have been truncated to their default soft limit size (innodb_max_undo_log_size=10M). Instead of that, we will observe that one of the undo tablespace files is larger.

      I think that the undo tablespace truncation needs to work also while InnoDB is running (mostly idle, with some writes every now and then) and the parameter innodb_purge_rseg_truncate_frequency caused a call to trx_purge_truncate_history() to be skipped during the last purge batch that made the undo logs logically empty but failed to reclaim the space.

      I originally noticed this when testing an upgrade from a server that is affected by MDEV-31234.

      Attachments

        Issue Links

          Activity

            marko Marko Mäkelä created issue -
            marko Marko Mäkelä made changes -
            Field Original Value New Value
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Vladislav Lesin [ vlad.lesin ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            vlad.lesin Vladislav Lesin made changes -
            Status In Review [ 10002 ] Stalled [ 10000 ]
            vlad.lesin Vladislav Lesin made changes -
            Assignee Vladislav Lesin [ vlad.lesin ] Marko Mäkelä [ marko ]
            marko Marko Mäkelä made changes -
            Fix Version/s 10.5.22 [ 29011 ]
            Fix Version/s 10.6.15 [ 29013 ]
            Fix Version/s 10.9.8 [ 29015 ]
            Fix Version/s 10.10.6 [ 29017 ]
            Fix Version/s 10.11.5 [ 29019 ]
            Fix Version/s 11.0.3 [ 28920 ]
            Fix Version/s 11.1.2 [ 28921 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.9 [ 26905 ]
            Fix Version/s 10.10 [ 27530 ]
            Fix Version/s 10.11 [ 27614 ]
            Fix Version/s 11.0 [ 28320 ]
            Fix Version/s 11.1 [ 28549 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            marko Marko Mäkelä made changes -
            Summary SET GLOBAL innodb_undo_log_truncate=ON has no effect on logically empty undo logs SET GLOBAL innodb_undo_log_truncate=ON does not free space when no undo logs exist

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              1 Vote for this issue
              Watchers:
              8 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.