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

Crash when restarting server after IMPORT TABLESPACE

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Confirmed (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.1, 10.2, 10.3, 10.4, 10.4.11
    • Fix Version/s: 10.1, 10.2, 10.3, 10.4
    • Labels:
      None
    • Environment:
      Tested on Arch Linux and Ubuntu 18.04 with MariaDB repo

      Description

      After importing a tablespace (created with mariabackup --prepare --export or FLUSH TABLE ... FOR EXPORT), if the server is restarted before writing to the new table, reading the table crashes the server.

      Started with empty datadir, nothing set in my.cnf.

      mariadb> create database test;
      Query OK, 1 row affected (0.001 sec)
      mariadb> create database test2;
      Query OK, 1 row affected (0.000 sec)
      mariadb> create table test.foo(id int not null primary key);
      Query OK, 0 rows affected (0.185 sec)
      mariadb> create table test2.foo(id int not null primary key);
      Query OK, 0 rows affected (0.143 sec)
      mariadb> insert into test.foo values (1);
      Query OK, 1 row affected (0.031 sec)
      mariadb> alter table test2.foo discard tablespace;
      Query OK, 0 rows affected (0.045 sec)
      mariadb> flush table test.foo for export;
      Query OK, 0 rows affected (0.001 sec)
      -- Copy test/foo.cfg and test/foo.ibd to test2/
      mariadb> unlock tables;
      Query OK, 0 rows affected (0.000 sec)
      mariadb> alter table test2.foo import tablespace;
      Query OK, 0 rows affected (0.200 sec)
      mariadb> select * from test2.foo;
      +----+
      | id |
      +----+
      |  1 |
      +----+
      1 row in set (0.001 sec)
      mariadb> exit
      -- Restart MariaDB server
      mariadb> select * from test2.foo;
      ERROR 2013 (HY000): Lost connection to MySQL server during query
      

      The server log (attached) shows:

      2019-12-30  9:12:54 0 [Note] /usr/bin/mysqld: ready for connections.
      Version: '10.4.11-MariaDB'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Arch Linux
      2019-12-30 09:13:02 0x7f91f41ae700  InnoDB: Assertion failure in file /build/mariadb/src/mariadb-10.4.11/storage/innobase/btr/btr0btr.cc line 204
      InnoDB: Failing assertion: mach_read_from_4(seg_header + FSEG_HDR_SPACE) == space
      

      It seems like doing any write to the new table prevents the issue.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kevg Eugene Kosov
              Reporter:
              seally1186 Michael Chang
              Votes:
              4 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated: