# Import Table:Error: during importing table from 8.0.19 to 8.0.34

**URL:** <https://forums.percona.com/t/import-table-during-importing-table-from-8-0-19-to-8-0-34/27388>\
**Category:** Percona Server for MySQL\
**Created:** [December 25, 2023, 7:53am UTC](https://forums.percona.com/t/import-table-during-importing-table-from-8-0-19-to-8-0-34/27388 "2023-12-25T07:53:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shawn\_chen](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@shawn\_chen](https://forums.percona.com/u/shawn_chen)\
**Post date:** [December 25, 2023, 7:53am UTC](https://forums.percona.com/t/import-table-during-importing-table-from-8-0-19-to-8-0-34/27388/1 "2023-12-25T07:53:02Z")

</div>

Hi,  
Recently, when I did ‘sqlsmith’ random data testing for importing table. I found there is a ‘Index corrupt’ error when try to import table from 8.0.19 to 8.0.34.

[Issue]  
The table has instant\_add\_col, the testing case is:  
source node is 8.0.19.  
mysql\> select @@version;  
±----------+  
| @@version |  
±----------+  
| 8.0.19-10 |  
±----------+  
1 row in set (0.00 sec)

##create a base table  
create database test;use test;  
CREATE TABLE `t1` (  
`wtfcl` int DEFAULT ‘1566498914’,  
`id` int NOT NULL AUTO\_INCREMENT,  
`hebcxxwva` decimal(26,7) DEFAULT NULL,  
`cgthpdcr` datetime DEFAULT NULL,  
`wxpxct` text COLLATE utf8mb4\_bin,  
`sourjp` text COLLATE utf8mb4\_bin NOT NULL,  
`ljynqyb` varchar(65) COLLATE utf8mb4\_bin DEFAULT ‘stcvhbwjfclilvbadxhalrgqdgtbftwzfmxzkepjopomtyardbugribynpatvahrs’,  
`rnaifijo` varchar(1090) COLLATE utf8mb4\_bin DEFAULT NULL,  
`cdnorxdzg` decimal(17,6) NOT NULL DEFAULT ‘0.000000’,  
`sjlgrwnyk` int DEFAULT NULL,  
`uuid` varchar(253) COLLATE utf8mb4\_bin DEFAULT NULL,  
`cczlur` datetime NOT NULL DEFAULT ‘2001-12-30 05:40:31’,  
`qozecnqhj` varchar(1508) COLLATE utf8mb4\_bin DEFAULT NULL,  
`axaqfzhym` varchar(358) COLLATE utf8mb4\_bin NOT NULL DEFAULT ‘EJQFATPLZRWVIY’,  
`ehons` int DEFAULT ‘216839066’,  
`ydiybwo` int NOT NULL DEFAULT ‘1413713835’,  
`alfzkkmbq` int DEFAULT ‘1670056804’,  
PRIMARY KEY (`id`)  
) ENGINE=InnoDB AUTO\_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4\_bin;

##insert record  
insert into t1 values(1622753879,8,90.0681000,‘2068-08-03 21:11:19’,‘oVE^IFe%%RU-@fX{x6m’,‘r]"9&/)%0’,‘UFYQ^aVOYoFb:z"/ioKcX?1|?@uu\>a`HTHn1plo~^dfV&8ZF(6hF{AX=)\I~x4*','z-).d)20cY-\/uz{-:^_E*T8!3R',74.167600,700723041,'j5!p0Nb;:E*sVw=HM"lK{OeeVL32ui@I:Lc%L@|4@i^qY)SJh`cOi^a)cT])@-Ltdl{LO]x’,‘2093-06-15 16:32:30’,‘Ng{Zy=$M=]\47F2k$H#0\>&Y&)D[jQjsy\<xWo$HKclG9\FB`M`{Q+1vM!\<}YMwU!h+YLn0Z}Jlb97A[ag\cXE7’,‘ASz^,fL&bEvZ4$vtYqhED+U=:e(h=0!`LLG2_XA+m_;ab’,114591117,200385570,1068203744);

##instant\_add col  
alter table t1 add column`kkanp` datetime DEFAULT NULL, ALGORITHM=INSTANT;

##flush table and get cfg  
flush tables t1 for export;

dest node is 8.0.34.  
mysql\> select @@version;  
±----------+  
| @@version |  
±----------+  
| 8.0.34-26 |  
±----------+  
1 row in set (0.00 sec)

##create table on dest node and discard it, note: new table has col ‘kkanp’ which is an instant\_add\_col of origin table.  
CREATE TABLE `t1` (  
`wtfcl` int DEFAULT ‘1566498914’,  
`id` int NOT NULL AUTO\_INCREMENT,  
`hebcxxwva` decimal(26,7) DEFAULT NULL,  
`cgthpdcr` datetime DEFAULT NULL,  
`wxpxct` text CHARACTER SET utf8mb4 COLLATE utf8mb4\_bin,  
`sourjp` text CHARACTER SET utf8mb4 COLLATE utf8mb4\_bin NOT NULL,  
`ljynqyb` varchar(65) CHARACTER SET utf8mb4 COLLATE utf8mb4\_bin DEFAULT ‘stcvhbwjfclilvbadxhalrgqdgtbftwzfmxzkepjopomtyardbugribynpatvahrs’,  
`rnaifijo` varchar(1090) CHARACTER SET utf8mb4 COLLATE utf8mb4\_bin DEFAULT NULL,  
`cdnorxdzg` decimal(17,6) NOT NULL DEFAULT ‘0.000000’,  
`sjlgrwnyk` int DEFAULT NULL,  
`uuid` varchar(253) CHARACTER SET utf8mb4 COLLATE utf8mb4\_bin DEFAULT NULL,  
`cczlur` datetime NOT NULL DEFAULT ‘2001-12-30 05:40:31’,  
`qozecnqhj` varchar(1508) CHARACTER SET utf8mb4 COLLATE utf8mb4\_bin DEFAULT NULL,  
`axaqfzhym` varchar(358) CHARACTER SET utf8mb4 COLLATE utf8mb4\_bin NOT NULL DEFAULT ‘EJQFATPLZRWVIY’,  
`ehons` int DEFAULT ‘216839066’,  
`ydiybwo` int NOT NULL DEFAULT ‘1413713835’,  
`alfzkkmbq` int DEFAULT ‘1670056804’,  
`kkanp` datetime DEFAULT NULL,  
PRIMARY KEY (`id`)  
) ENGINE=InnoDB AUTO\_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4\_bin;

alter table t1 discard tablespace;

##copy the ‘t1.ibd’ and ‘t1.cfg’ to the datadir of dest node and import table  
alter table t1 import tablespace;

then, an error occurs:  
mysql\> alter table t1 import tablespace;  
ERROR 1817 (HY000): Index corrupt: Clustered index validation failed, due to data file corruption.

[Analysis]  
For debug version, I can get a coredump at:  
Assertion failure: rec.h:649:n\_null.  
n\_null of func ‘rec\_init\_offsets\_comp\_ordinary’ is given by ‘index-\>get\_nullable\_before\_instant\_add\_drop()’. So I think this bug is related to the value of n\_instant\_nullable of the first index of table.

The table-\>first\_index-\>n\_instant\_nullable will be set to cfg.m\_n\_instant\_nullable during importing (func: row\_import::set\_instant\_info). And cfg.m\_n\_instant\_nullable is set only when cfg version equal or larger than ‘IB\_EXPORT\_CFG\_VERSION\_V5’. As the cfg version of 8.0.19 is IB\_EXPORT\_CFG\_VERSION\_V4, so the cfg.m\_n\_instant\_nullable is set to 0, which cause the index corrpution error in the end.

[Possible Solution]  
The solution is simple, as we can get the default\_value of each instant\_col during row\_import\_read\_default\_values, we can get the n\_nullable\_of\_instant\_col. And the n\_nullable is the number total nullable col of new table. The correct cfg.m\_n\_instant\_nullable should be: n\_nullable of new table minus n\_nullable\_of\_instant\_col.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [December 26, 2023, 1:36pm UTC](https://forums.percona.com/t/import-table-during-importing-table-from-8-0-19-to-8-0-34/27388/2 "2023-12-26T13:36:31Z")

</div>

Hello @shawn_chen,  
MySQL’s INSTANT ALTER has had troubled issues. In fact, 8.0.29 is not even downloadable due to an extreme data-loss bug with INSTANT. It is therefore not recommended, (might not even be supported) to import a tablespace which used INSTANT from before 8.0.30 (version the bug was fixed).
