[MDEV-28488] InnoDB (compressed table) exported tablespace results in corrupted indexes Created: 2022-05-06  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.7.3, 10.6
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Minor
Reporter: sjon Assignee: Thirunarayanan Balathandayuthapani
Resolution: Unresolved Votes: 0
Labels: TABLESPACES, compression, import, innodb
Environment:

linux


Attachments: File tableset.tar.gz    
Issue Links:
Relates
relates to MDEV-26131 SEGV in ha_innobase::discard_or_impor... Closed

 Description   

I have table that passes mysqlcheck just fine. After exporting the tablespace, and importing it in another database, the table becomes corrupted.

test.tableset
Warning  : InnoDB: The B-tree of index PRIMARY is corrupted.
Warning  : InnoDB: Index 'suffix' contains 5 entries, should be 18446744073709551615.
error    : Corrupt

After recreating a fresh table this doesn't occur so the ibd might very well be corrupt - but that would indicate another issue as the server does not seem hindered by this corruption while operating normally.

I've attached the exported tablespace with the cfg; the structure of this table is:

CREATE TABLE `tableset` (
  `setid` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `prefix` varchar(12) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `frontend` enum('Y','N') CHARACTER SET latin1 NOT NULL DEFAULT 'N',
  `datestr` int(10) unsigned NOT NULL DEFAULT 0,
  `interval` enum('monthly','weekly') CHARACTER SET latin1 NOT NULL DEFAULT 'monthly',
  `version` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `updatewindow` varchar(11) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `source` enum('pcreeks','perceel','perceel-bag','adres-bag','adres-bag-onbebouwd','pcreeks-rws','pcreeks-convert','perceel-convert') CHARACTER SET latin1 NOT NULL,
  `deliverysource` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT 'none',
  `status` enum('empty','ready','match-id','disabled') CHARACTER SET latin1 NOT NULL DEFAULT 'ready',
  `symsearch_version` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
  `comments` varchar(30) CHARACTER SET latin1 NOT NULL DEFAULT '',
  PRIMARY KEY (`setid`),
  UNIQUE KEY `suffix` (`prefix`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=DYNAMIC `PAGE_COMPRESSED`=1;



 Comments   
Comment by Marko Mäkelä [ 2022-05-06 ]

I tried importing the tableset.ibd from tableset.tar.gz as follows:

CREATE TABLE tableset …;
ALTER TABLE tableset DISCARD TABLESPACE;

tar xzf tableset.tar.gz  -C /path/to/datadir/test tableset.ibd

ALTER TABLE tableset IMPORT TABLESPACE;

I got the following response to the client:

ERROR 1815 (HY000): Internal error: Drop all secondary indexes before importing table test/tableset when .cfg file is missing.

and the following to the error log:

2022-05-06 18:03:00 3 [Note] InnoDB: Discarding tablespace of table `test`.`tableset`: Generic error

If I copy also the .cfg file to the data directory, the import will succeed. It looks like the check that was implemented in MDEV-26131 might be too strict.

Comment by sjon [ 2022-05-06 ]

Thanks Marko, can you confirm that the imported table is corrupt after importing it with the cfg file? Mysqlcheck throws a very weird error (for each index)

Generated at Thu Feb 08 10:01:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.