[MDEV-24516] DISCARD/IMPORT TABLESPACE does not work for system-versioned table after adding a column Created: 2021-01-02  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Versioned Tables
Affects Version/s: 10.3, 10.4, 10.5
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-24352 General error: 1808 Schema mismatch (... Closed

 Description   

It may have to be documented as a limitation, which will be a pity: first, system_versioning_alter_history is specifically recommended for adding new columns to the table, and secondly, apparently real-life users employ DISCARD/IMPORT TABLESPACE for the purpose of backing/restoring or moving data in system-versioned tables, due to the lack of functionality in mysqldump.

--source include/have_innodb.inc
 
--let $datadir= `select @@datadir`
 
SET system_versioning_alter_history= KEEP;
CREATE TABLE t1 (a INT) ENGINE=InnoDB WITH SYSTEM VERSIONING;
ALTER TABLE t1 ADD b INT;
FLUSH TABLES t1 FOR EXPORT;
--copy_file $datadir/test/t1.cfg $MYSQLTEST_VARDIR/t1.cfg
--copy_file $datadir/test/t1.ibd $MYSQLTEST_VARDIR/t1.ibd
UNLOCK TABLES;
 
DROP TABLE t1;
CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL
) ENGINE=InnoDB WITH SYSTEM VERSIONING;
 
ALTER TABLE t1 DISCARD TABLESPACE;
--copy_file $MYSQLTEST_VARDIR/t1.cfg $datadir/test/t1.cfg
--copy_file $MYSQLTEST_VARDIR/t1.ibd $datadir/test/t1.ibd
ALTER TABLE t1 IMPORT TABLESPACE;
 
# Cleanup
DROP TABLE t1;

10.3 e59c1cef

query 'ALTER TABLE t1 IMPORT TABLESPACE' failed: 1808: Schema mismatch (Column b ordinal value mismatch, it's at 1 in the table and 3 in the tablespace meta-data file)


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