[MDEV-26243] Tablespace is missing for a table while doing IMPORT TABLESPACE Created: 2021-07-26  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Eugene Kosov (Inactive) Assignee: Vladislav Lesin
Resolution: Unresolved Votes: 0
Labels: alter, import, innodb


 Description   

--source include/have_innodb.inc
 
--let $MYSQLD_DATADIR= SELECT @@datadir
--let $SOURCE_IBD=SELECT CONCAT("$MYSQLD_DATADIR", "test/t1.ibd")
--let $TARGET_IBD=SELECT CONCAT("$MYSQLD_DATADIR", "test/imp_t1.ibd")
SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION' ;
SET DEFAULT_STORAGE_ENGINE= 'InnoDB' ;
USE test ;
--disable_abort_on_error
CREATE TABLE t1 (
col_varchar_255_utf8 varchar(255)  CHARACTER SET utf8,
col_text_utf8 text  CHARACTER SET utf8,
col_int int) ENGINE=innodb ;
INSERT /*! IGNORE */ INTO t1 VALUES
 ('devil', 'characteristic', 3) ,
 ('fiction', 'bishop', 7) ,
 ('w', 'moderate', 1835925504) ,
 ('bkzrqlzlsgtlxhhtytdoapcgvseyjcaghquzjbbswhmmyvoeatphtlsrplbjjclcoruqlnpgkviwgqgcidiimlccjuvyepfbmsdxtpacxirfmtfyjsjkegpzfostkjltlgbjvlifrxfyaezxbdzjctezrzdridqvkpdhbonajxtqbnwugdowris', 'increasing', 9) ,
 ('k', 'cause', NULL) ,
 ('ceiling', 'shove', 1445003264) ,
 ('q', 'shout', 619905024) ,
 ('s', 'staff', NULL) ,
 ('ego', 'will', -776011776) ,
 ('index', 'stumble', NULL)  ;
FLUSH TABLES table0_innodb, table1_innodb, t1 FOR EXPORT  ;
UNLOCK TABLES ;
CREATE TABLE IF NOT EXISTS imp_t1 LIKE t1  ;
ALTER TABLE imp_t1 ADD KEY IF NOT EXISTS idx ( col_int ) ;
ALTER TABLE imp_t1 DISCARD TABLESPACE ;
ALTER TABLE imp_t1 IMPORT TABLESPACE ;
--echo 'copy ibd file around'
--copy_file $SOURCE_IBD $TARGET_IBD
ALTER TABLE imp_t1 IMPORT TABLESPACE ;
DROP TABLE imp_t1;

Output:

ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
'copy ibd file around'
innodb.1 'innodb'                        [ fail ]
        Test ended at 2021-07-26 14:01:36
 
CURRENT_TEST: innodb.1
mysqltest: At line 32: Path 'SELECT CONCAT("SELECT @@datadir", "test/imp_t1.ibd")' is not a subdirectory of MYSQLTEST_VARDIR '/home/kevgs/work/m/bb-10.2-kevgs/build/mysql-test/var'or MYSQL_TMP_DIR '/home/kevgs/work/m/bb-10.2-kevgs/build/mysql-test/var/tmp'
 
Warnings from just before the error:
Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/imp_t1.cfg', will attempt to import without schema verification 
Warning 1816 ALTER TABLE '`test`.`imp_t1`' IMPORT TABLESPACE failed with error 44 : 'Tablespace not found'
 
 - saving '/home/kevgs/work/m/bb-10.2-kevgs/build/mysql-test/var/log/innodb.1-innodb/' to '/home/kevgs/work/m/bb-10.2-kevgs/build/mysql-test/var/log/innodb.1-innodb/'
***Warnings generated in error logs during shutdown after running tests: innodb.1
 
2021-07-26 14:01:35 140407949309696 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2021-07-26 14:01:35 140407949309696 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-07-26 14:01:35 140407949309696 [ERROR] InnoDB: Trying to import a tablespace, but could not open the tablespace file ./test/imp_t1.ibd


Generated at Thu Feb 08 09:43:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.