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

            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 ]

            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.
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Jan Lindström [ jplindst ]
            Status In Progress [ 3 ] In Review [ 10002 ]

            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.

            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.
            jplindst Jan Lindström (Inactive) made changes -
            Assignee Jan Lindström [ jplindst ] Marko Mäkelä [ marko ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            marko Marko Mäkelä made changes -
            Fix Version/s 10.0.33 [ 22552 ]
            Fix Version/s 10.0 [ 16000 ]
            marko Marko Mäkelä made changes -
            Fix Version/s 10.1.27 [ 22609 ]
            Fix Version/s 10.2.9 [ 22611 ]
            Fix Version/s 10.3.2 [ 22533 ]
            marko Marko Mäkelä made changes -
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 82249 ] MariaDB v4 [ 152697 ]
            marko Marko Mäkelä made changes -

            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.