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

Temporary files are left behind after in-place ALTER fails

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.0.19
    • Fix Version/s: None
    • Labels:
      None

      Description

      MariaDB [test]> CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb;
      Query OK, 0 rows affected (0.09 sec)
      
      MariaDB [test]> SET debug_dbug='d,innodb_alter_commit_crash_before_commit';
      Query OK, 0 rows affected (0.00 sec)
      
      MariaDB [test]> INSERT INTO t1 VALUES(1, 1);
      Query OK, 1 row affected (0.16 sec)
      
      MariaDB [test]> INSERT INTO t1 VALUES(2, 2);
      Query OK, 1 row affected (0.08 sec)
      
      MariaDB [test]> ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
      ERROR 2013 (HY000): Lost connection to MySQL server during query
      
      .. restart server & reconnect.. 
      
      MariaDB [test]> ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
      Query OK, 0 rows affected (0.20 sec)
      Records: 0  Duplicates: 0  Warnings: 0
      
      MariaDB [test]> SHOW CREATE TABLE t1;
      +-------+----------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                           |
      +-------+----------------------------------------------------------------------------------------------------------------------------------------+
      | t1    | CREATE TABLE `t1` (
        `f1` int(11) NOT NULL,
        `f2` int(11) NOT NULL,
        PRIMARY KEY (`f2`,`f1`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+----------------------------------------------------------------------------------------------------------------------------------------+
      1 row in set (0.03 sec)
      
      MariaDB [test]> SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
      +----------+---------------------------+------+--------+-------+-------------+------------+---------------+
      | TABLE_ID | NAME                      | FLAG | N_COLS | SPACE | FILE_FORMAT | ROW_FORMAT | ZIP_PAGE_SIZE |
      +----------+---------------------------+------+--------+-------+-------------+------------+---------------+
      ...
      |       19 | test/#sql-ib18-1827491244 |    1 |      5 |     5 | Antelope    | Compact    |             0 |
      |       20 | test/t1                   |    1 |      5 |     6 | Antelope    | Compact    |             0 |
      +----------+---------------------------+------+--------+-------+-------------+------------+---------------+
      9 rows in set (0.00 sec)
      
      MariaDB [test]> \! ls data1/test
      #sql-426c_3.frm  #sql-ib18-1827491244.ibd  t1.frm  t1.ibd
      
      

      Its a side effect of the following fix :
      https://github.com/mysql/mysql-server/commit/ee194ca48f1fe028bf64b861c993b12f4957e2a0

      These leftover temp files can later be dropped using DROP TABLE by naming the frm file, but
      I think there is some room for automatically dropping these temporary files.

      Originally reported here : https://bugzilla.suse.com/show_bug.cgi?id=928172

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                jplindst Jan Lindström
                Reporter:
                nirbhay_c Nirbhay Choubey
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: