[MDEV-30296] mysqldump does not maintain consistency of merge/underlying tables Created: 2022-12-24  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None


 Description   

mysqldump may write CREATE statements related to a MERGE table before underlying tables which it unions. The merge table remains invalid until the underlying tables are created, so the dump can become unloadable.

create table t (a int) engine=MyISAM;
create table mt (a int) engine=MERGE union (t);
create trigger tr after insert on mt for each row set @a= 1;
 
--exec $MYSQL_DUMP test > $MYSQL_TMP_DIR/test.dump
drop table mt, t;
--exec $MYSQL test < $MYSQL_TMP_DIR/test.dump
 
# Cleanup
drop table mt;
drop table t;

10.3 0ca3aaa7

ERROR 1168 (HY000) at line 38: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
mysqltest: At line 7: exec of '/mnt8t/bld/10.3-nightly/bin/mysql --defaults-file=/mnt8t/bld/10.3-nightly/mysql-test/var/my.cnf test < /mnt8t/bld/10.3-nightly/mysql-test/var/tmp/test.dump' failed, error: 256, status: 1, errno: 11

The line 38 in the dump is

/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger tr after insert on mt for each row set @a= 1 */;;

By this time, the MERGE table mt has already been created, but the underlying table t hasn't.



 Comments   
Comment by Oleksandr Byelkin [ 2023-09-26 ]

I have no idea other then create triggers after tables and views...

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