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

DISCARD/IMPORT TABLESPACE does not work with DATA DIRECTORY

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.11.19, 11.4.13, 11.8.9, 12.3.3, 13.0.2, 13.1.1
    • None
    • None

    Description

      Reproduction scenario:

      On source system:
      CREATE TABLE t (i INT PRIMARY KEY) DATA DIRECTORY='<external directory>';
      FLUSH TABLES t FOR EXPORT;

      on target system:

      CREATE TABLE t (i INT PRIMARY KEY) DATA DIRECTORY='<external directory>';
      ALTER TABLE t DISCARD TABLESPACE;
      # copy over t.ibd and t.cfg from <external directory>/<dbname> in source system to same directory in target system
      ALTER TABLE t IMPORT TABLESPACE;
      
      

      Last statement results in this error message:

      ERROR 1296 (HY000): Got error 37 'Data structure corruption' from <external directory>/<dbname>/t.ibd

      The cause of the error is that DISCARD TABLESPACE deletes the .isl file in the data directory, which causes an inconsistent state. The additional problem from deleting the file is that it's the only persistent location of the DATA DIRECTORY path. In this case, as can be seen from the error message, the server knows the intended location of the import file, but that's only because the path is stored in memory (in the dict_table_t struct). Causing the table to be evicted from the cache or restarting the server after DISCARD DATABASE will leave the server in a state where it knows from metadata that the table should look for its files in a custom location, but doesn't know where that location is.

      The workaround is to manually restore the .isl file after running DISCARD TABLESPACE

      Attachments

        Issue Links

          Activity

            People

              andrzej.jarzabek Andrzej Jarzabek
              andrzej.jarzabek Andrzej Jarzabek
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.