Details
-
Bug
-
Status: Done
-
Medium
-
Resolution: Fixed
-
5.7.36-39 (Q4 2021)
-
None
-
None
-
Yes
Description
In version 5.7.13 ALTER TABLE IMPORT TABLESPACE was improved, to support importing table with different DATA DIRECTORY=. https://bugs.launchpad.net/percona-server/+bug/1548597
In 5.7.29 this functionality stopped working, but I'm not seeing anything related in release notes, so not sure whether this is intended, or not.
How to repeat:
USE test; CREATE TABLE `move` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; insert into move values(1); flush tables move for export; -- copy move.ibd and move.cfg to a different location -- cp data/test/move.{ibd,cfg} . unlock tables; drop table move; CREATE TABLE `move` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 data directory='/tmp/test/'; alter table move discard tablespace; -- copy move.ibd and move.cfg to /tmp/test/test/ -- cp move.{ibd,cfg} /tmp/test/test/ alter table move import tablespace;
Results with different versions:
5.7.28: works
show create table move; +-------+----------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+----------------------------------------------------------------------------------------------------------------------------------------+ | move | CREATE TABLE `move` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='/tmp/test/' | +-------+----------------------------------------------------------------------------------------------------------------------------------------+
5.7.29:
ERROR 1808 (HY000): Schema mismatch (Table data_dir flag don't match, server table has data_dir flag = 1 and the meta-data file has data_dir flag = 0)
5.7.36:
ERROR 1808 (HY000): Schema mismatch (Table location flags do not match. The source table does not use a DATA DIRECTORY but the destination table does.)