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

Failed InnoDB initialization leaves garbage files behind

Details

    Description

      The following invocation will fail, leaving behind NUL-filled ibdata1 and ib_logfile0 in InnoDB initialization.

      ./mtr --mysqld=--innodb-log-file-size=1m --mysqld=--loose-innodb-log-files-in-group=1 innodb.innodb
      

      Note: MDEV-12061 reduced the minimum value of innodb_log_files_in_group to 1. In MariaDB Server 10.5, that parameter was deprecated, and only a single ib_logfile0 can be created.

      The actual minimum log file size limit is as follows:

      innodb_page_size minimum innodb_log_file_size
      4k 1m
      8k 1m
      16k 2m
      32k 4m
      64k 7m

      MDEV-14425 would change the minimum (logically empty) redo log file size to 12288+16 bytes.

      The log must be reasonably large to prevent overrun. Only once MDEV-14462 has been fixed, we could run with a smaller redo log without any fear of data loss. Also in that case, the log must be large enough for a single mini-transaction. A maximal mini-transaction could split a B-tree all way from the leaf to roof, modifying 2*height pages. The maximum height of a B-tree is somewhere around 32 pages when the tree is a binary tree. 2*32*innodb_page_size would be 1MiB at the default innodb_page_size=16k.

      The immediate problem here is that if an attempt to initialize InnoDB with a too small log file is made, InnoDB will leave behind NUL-filled system tablespace and log files. That needs to be fixed, to avoid confusing messages like this:

      10.2 6b066ec33285c089ce770c2d1eb50bc49787ee92

      innodb.innodb 'innodb'                   [ skipped ]  Test requires InnoDB with 16k Page size.
      line
      2021-12-15 13:36:15 140326778985536 [ERROR] InnoDB: Corrupted page [page id: space=0, page number=0] of datafile './ibdata1' could not be found in the doublewrite buffer.
      2021-12-15 13:36:15 140326778985536 [ERROR] InnoDB: Plugin initialization aborted at srv0start.cc[1911] with error Data structure corruption
      2021-12-15 13:36:15 140326778985536 [ERROR] Plugin 'InnoDB' init function returned error.
      2021-12-15 13:36:15 140326778985536 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
      ^ Found warnings in /dev/shm/10.2o/mysql-test/var/log/mysqld.1.err
      

      Attachments

        Issue Links

          Activity

            After a fix, the invocation of the test will fail like this:

            ./mtr --mysqld=--innodb-log-file-size=1m --mysqld=--loose-innodb-log-files-in-group=1 innodb.innodb
            

            10.2 72b9ee7aaefb2fc5c6a1c18d477434449e880504

            innodb.innodb 'innodb'                   [ skipped ]  Test requires InnoDB with 16k Page size.
            line
            2021-12-15 13:54:57 140423379827776 [ERROR] InnoDB: Cannot continue operation. ib_logfiles are too small for innodb_thread_concurrency=0. The combined size of ib_logfiles should be bigger than 200 kB * innodb_thread_concurrency. Please refer to https://mariadb.com/kb/en/library/innodb-system-variables/
            2021-12-15 13:54:57 140423379827776 [ERROR] InnoDB: Database creation was aborted at srv0start.cc[1944] with error Generic error. You may need to delete the ibdata1 file before trying to start up again.
            2021-12-15 13:54:57 140423379827776 [ERROR] Plugin 'InnoDB' init function returned error.
            2021-12-15 13:54:57 140423379827776 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
            ^ Found warnings in /dev/shm/10.2o/mysql-test/var/log/mysqld.1.err
            

            marko Marko Mäkelä added a comment - After a fix , the invocation of the test will fail like this: ./mtr --mysqld=--innodb-log-file-size=1m --mysqld=--loose-innodb-log-files-in-group=1 innodb.innodb 10.2 72b9ee7aaefb2fc5c6a1c18d477434449e880504 innodb.innodb 'innodb' [ skipped ] Test requires InnoDB with 16k Page size. line 2021-12-15 13:54:57 140423379827776 [ERROR] InnoDB: Cannot continue operation. ib_logfiles are too small for innodb_thread_concurrency=0. The combined size of ib_logfiles should be bigger than 200 kB * innodb_thread_concurrency. Please refer to https://mariadb.com/kb/en/library/innodb-system-variables/ 2021-12-15 13:54:57 140423379827776 [ERROR] InnoDB: Database creation was aborted at srv0start.cc[1944] with error Generic error. You may need to delete the ibdata1 file before trying to start up again. 2021-12-15 13:54:57 140423379827776 [ERROR] Plugin 'InnoDB' init function returned error. 2021-12-15 13:54:57 140423379827776 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. ^ Found warnings in /dev/shm/10.2o/mysql-test/var/log/mysqld.1.err

            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.