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

'Data structure corruption' IMPORT TABLESPACE doesn't work

    XMLWordPrintable

Details

    Description

      Following the steps provided here https://mariadb.com/kb/en/innodb-file-per-table-tablespaces/#copying-transportable-tablespaces for moving individual MariaDB tables to different disk/path lead to error :-

       
      MariaDB [test]> ALTER TABLE test.t1 IMPORT TABLESPACE;
      ERROR 1296 (HY000): Got error 38 'Data structure corruption' from /tmp/test/t1.ibd
      
      

      Test case

       
      Server version: 10.6.1-MariaDB MariaDB Server
       
      MariaDB [(none)]> create database test;
      Query OK, 1 row affected (0.000 sec)
       
      MariaDB [(none)]> use test;
      Database changed
       
       
       
      MariaDB [test]>  CREATE TABLE test.t1 (
         id INT PRIMARY KEY AUTO_INCREMENT,
         name VARCHAR(50)
      ) ENGINE=InnoDB;
       
       
      MariaDB [test]>  FLUSH TABLES test.t1 FOR EXPORT;
       
      From another session 
       
      [root@master_node_8 test]# cp /var/lib/mysql/test/t1.ibd /tmp/
      [root@master_node_8 test]# cp /var/lib/mysql/test/t1.cfg /tmp/
       
       
      MariaDB [test]>   UNLOCK TABLES;
       
      MariaDB [test]>   drop table t1;
       
       
      MMariaDB [test]>  CREATE TABLE test.t1 (
         id INT PRIMARY KEY AUTO_INCREMENT,
         name VARCHAR(50)
      ) ENGINE=InnoDB
      DATA DIRECTORY = "/tmp/";
       
       
      MariaDB [test]>   ALTER TABLE test.t1 DISCARD TABLESPACE;
       
      [root@master_node_8 test]# cp /tmp/t1.ibd /tmp/test
      [root@master_node_8 test]# cp /tmp/t1.cfg /tmp/test
       
       
      [root@master_node_8 test]# chown -R mysql:mysql /tmp/test/
       
      [root@master_node_8 tmp]# cd /tmp/test/
       
      [root@master_node_8 test]# ls -ltrh
      total 100K
      -rw-r----- 1 mysql mysql 388 Feb 25 09:06 t1.cfg
      -rw-r----- 1 mysql mysql 96K Feb 25 09:07 t1.ibd
       
       
      [root@master_node_8 test]# chmod 660 /tmp/test/t1.*
       
      [root@master_node_8 test]# ls -ltrh
      total 100K
      -rw-rw---- 1 mysql mysql 96K Feb 25 09:39 t1.ibd
      -rw-rw---- 1 mysql mysql 388 Feb 25 09:39 t1.cfg
       
      [root@master_node_8 test]# stat t1*
        File: t1.cfg
        Size: 388             Blocks: 8          IO Block: 4096   regular file
      Device: 803h/2051d      Inode: 34507896    Links: 1
      Access: (0660/-rw-rw----)  Uid: (   27/   mysql)   Gid: (   27/   mysql)
      Access: 2022-02-25 09:39:03.349786167 +0530
      Modify: 2022-02-25 09:39:03.349786167 +0530
      Change: 2022-02-25 09:39:24.191711591 +0530
       Birth: -
        File: t1.ibd
        Size: 98304           Blocks: 192        IO Block: 4096   regular file
      Device: 803h/2051d      Inode: 34507895    Links: 1
      Access: (0660/-rw-rw----)  Uid: (   27/   mysql)   Gid: (   27/   mysql)
      Access: 2022-02-25 09:39:02.466789327 +0530
      Modify: 2022-02-25 09:39:02.466789327 +0530
      Change: 2022-02-25 09:39:24.191711591 +0530
       Birth: -
       
       
       
      MariaDB [test]> ALTER TABLE test.t1 IMPORT TABLESPACE;
      ERROR 1296 (HY000): Got error 37 'Data structure corruption' from /tmp/test/t1.ibd
       
       
      
      

      Attachments

        Activity

          People

            marko Marko Mäkelä
            pramod.mahto@mariadb.com Pramod Mahto
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.