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

Atomic DDL: .frm file is removed and orphan InnoDB tablespace is left behind upon crash recovery

    XMLWordPrintable

    Details

      Description

      In the test run, a server crash was induced while CREATE TABLE IF NOT EXISTS tt11 AS SELECT ... was being executed.

      After the crash, the original datadir contained both .frm and .ibd files:

      $ ls -l workdirs/worker7/vardir1_65/data_orig/test/tt11*
      -rw-rw---- 1 mdbe mdbe   462 Apr 24 14:17 workdirs/worker7/vardir1_65/data_orig/test/tt11.frm
      -rw-rw---- 1 mdbe mdbe 65536 Apr 24 14:17 workdirs/worker7/vardir1_65/data_orig/test/tt11.ibd
      

      Upon recovery on this datadir, InnoDB complains in the error log:

      bb-10.6-monty 8a94dabc9 with trigger patch

      2021-04-24 14:17:06 0 [ERROR] InnoDB: Table `test`.`tt11` does not exist in the InnoDB internal data dictionary though MariaDB is trying to drop it. Have you copied the .frm file of the table to the MariaDB database directory from another database? Please refer to https://mariadb.com/kb/en/innodb-troubleshooting/ for how to resolve the issue.
      2021-04-24 14:17:06 0 [Note] DDL_LOG: Crash recovery executed 1 entries
      

      After the recovery the .frm file is no longer there, but .ibd still is:

      $ ls -l workdirs/worker7/vardir1_65/data/test/tt11*
      -rw-rw---- 1 mdbe mdbe 65536 Apr 24 14:17 workdirs/worker7/vardir1_65/data/test/tt11.ibd
      

      And the table cannot be either dropped or created:

      MariaDB [test]> create table tt11 (a int);
      ERROR 1813 (HY000): Tablespace for table '`test`.`tt11`' exists. Please DISCARD the tablespace before IMPORT
      MariaDB [test]> drop table tt11;
      ERROR 1051 (42S02): Unknown table 'test.tt11'
      MariaDB [test]> create table tt11 (a int);
      ERROR 1813 (HY000): Tablespace for table '`test`.`tt11`' exists. Please DISCARD the tablespace before IMPORT
      

      The "before" and "after" datadirs, logs and rr profiles are available.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marko Marko Mäkelä
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration