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

DISCARD TABLESPACE removes DATA DIRECTORY

Details

    Description

      root@spaceman:/home/snen# mariadb
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 40654
      Server version: 11.4.4-MariaDB-deb11-log mariadb.org binary distribution
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [(none)]> use my_db;
      Database changed
      MariaDB [my_db]> CREATE TABLE `t`(
          -> `id` int(10) unsigned DEFAULT NULL
          -> ) ENGINE=InnoDB DATA DIRECTORY='/ssdext/mysql_arch_tables';
      Query OK, 0 rows affected (0,006 sec)
       
      MariaDB [my_db]> SHOW CREATE TABLE `t` \G
      *************************** 1. row ***************************
             Table: t
      Create Table: CREATE TABLE `t` (
        `id` int(10) unsigned DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci DATA DIRECTORY='/ssdext/mysql_arch_tables/'
      1 row in set (0,001 sec)
       
      MariaDB [my_db]> ALTER TABLE `t` DISCARD TABLESPACE;
      Query OK, 0 rows affected (0,010 sec)
       
      MariaDB [my_db]> SHOW CREATE TABLE `t` \G
      *************************** 1. row ***************************
             Table: t
      Create Table: CREATE TABLE `t` (
        `id` int(10) unsigned DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
      1 row in set (0,001 sec)

      It does not allow to move the table to another location by "DISCARD TABLESPACE", copy *.cfg and *.ibd to new location and "IMPORT TABLESPACE;"

      Attachments

        Activity

          thiru As discussed, after discard tablespace restarting server do not show data_directory info in show create table statement

          MariaDB [my_db]> SHOW CREATE TABLE t\G
          *************************** 1. row ***************************
                 Table: t
          Create Table: CREATE TABLE `t` (
            `id` int(10) unsigned DEFAULT NULL
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci DATA DIRECTORY='/tmp/mysql_arch_tables/'
          1 row in set (0.001 sec)
           
          MariaDB [my_db]> ALTER TABLE t DISCARD TABLESPACE;
          Query OK, 0 rows affected (0.002 sec)
           
          MariaDB [my_db]>
          [ restarted server ]
          MariaDB [my_db]> SHOW CREATE TABLE t\G
          *************************** 1. row ***************************
                 Table: t
          Create Table: CREATE TABLE `t` (
            `id` int(10) unsigned DEFAULT NULL
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
          1 row in set (0.000 sec)
           
          MariaDB [my_db]>  
          

          ramesh Ramesh Sivaraman added a comment - thiru As discussed, after discard tablespace restarting server do not show data_directory info in show create table statement MariaDB [my_db]> SHOW CREATE TABLE t\G *************************** 1. row *************************** Table : t Create Table : CREATE TABLE `t` ( `id` int (10) unsigned DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE =utf8mb4_general_ci DATA DIRECTORY= '/tmp/mysql_arch_tables/' 1 row in set (0.001 sec)   MariaDB [my_db]> ALTER TABLE t DISCARD TABLESPACE; Query OK, 0 rows affected (0.002 sec)   MariaDB [my_db]> [ restarted server ] MariaDB [my_db]> SHOW CREATE TABLE t\G *************************** 1. row *************************** Table : t Create Table : CREATE TABLE `t` ( `id` int (10) unsigned DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE =utf8mb4_general_ci 1 row in set (0.000 sec)   MariaDB [my_db]>

          This problem happens from 10.5 onwards.

          thiru Thirunarayanan Balathandayuthapani added a comment - This problem happens from 10.5 onwards.

          People

            thiru Thirunarayanan Balathandayuthapani
            snen Dmitry Savolainen
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.