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

InnoDB change buffer housekeeping can cause redo log overrun and possibly deadlocks

Details

    Description

      As reported in MDEV-13485, the function ibuf_remove_free_page() may be called while the caller is holding several mutexes or rw-locks. Because of this, this housekeeping loop may cause performance glitches for operations that involve tables that are stored in the InnoDB system tablespace. Deadlocks are also theoretically possible.

      The worst impact of all is that due to the mutexes being held, calls to log_free_check() must be skipped during this housekeeping. This means that the cyclic InnoDB redo log may be overwritten. If the system crashes during this, it would be unable to recover.

      The entry point to the problematic code is ibuf_free_excess_pages(). It would make sense to call it before acquiring any mutexes or rw-locks, in any DDL operation and in any 'pessimistic' operation that involves the system tablespace.

      Attachments

        Issue Links

          Activity

            bb-10.2-marko
            I intend to backport this to 10.0 as well.

            marko Marko Mäkelä added a comment - bb-10.2-marko I intend to backport this to 10.0 as well.

            For the record, I cannot repeat the equivalent of the 10.2 test in 10.0:

            ./mtr --mysqld=--loose-innodb-sync-debug --mem --noreorder innodb_zip.innodb-zip,4k,innodb innodb_zip.wl5522_debug_zip,4k,innodb innodb_zip.wl5522_zip,4k,innodb
            ./mtr --mysqld=--innodb-page-size=4k --mysqld=--loose-innodb-sync-debug --mem --noreorder innodb_zip.innodb-zip innodb.innodb-wl5522-debug-zip innodb.innodb-wl5522-zip
            

            The reason is that only innodb_zip.innodb-zip in 10.0 allows the innodb_page_size=4k combination.

            marko Marko Mäkelä added a comment - For the record, I cannot repeat the equivalent of the 10.2 test in 10.0: ./mtr --mysqld=--loose-innodb-sync-debug --mem --noreorder innodb_zip.innodb-zip,4k,innodb innodb_zip.wl5522_debug_zip,4k,innodb innodb_zip.wl5522_zip,4k,innodb ./mtr --mysqld=--innodb-page-size=4k --mysqld=--loose-innodb-sync-debug --mem --noreorder innodb_zip.innodb-zip innodb.innodb-wl5522-debug-zip innodb.innodb-wl5522-zip The reason is that only innodb_zip.innodb-zip in 10.0 allows the innodb_page_size=4k combination.
            marko Marko Mäkelä added a comment - bb-10.0-marko

            10.0 ok to push, 10.2 can you try to avoid unnecessary code duplication.

            jplindst Jan Lindström (Inactive) added a comment - 10.0 ok to push, 10.2 can you try to avoid unnecessary code duplication.

            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.