[MDEV-23106] Unable to recognize/import partitioned tables from physical MySQL databases. Created: 2020-07-06  Updated: 2023-06-25  Resolved: 2023-06-25

Status: Closed
Project: MariaDB Server
Component/s: Partitioning, Storage Engine - InnoDB
Affects Version/s: 10.4.13, 10.5.4
Fix Version/s: 10.8.8, 10.6.15, 10.9.8, 10.10.6, 10.11.5, 11.0.3, 11.1.2, 11.2.1

Type: Bug Priority: Major
Reporter: Juan Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: compat57, innodb, partitioning
Environment:

CentOS 7


Attachments: File MySQL-5-7-C-238-varlibmysql.tgza     File MySQL-5-7-C-238-varlibmysql.tgzb     File MySQL-5-7-C-238-varlibmysql.tgzc     File MySQL-5-7-C-238-varlibmysql.tgzd    
Issue Links:
Duplicate
is duplicated by MDEV-29253 Detect incompatible MySQL partition s... Closed
Relates
relates to MDEV-31417 ASAN errors in ha_partition::create_h... Closed

 Description   

In MySQL 5.7:

create table example (
name varchar(20) NOT NULL,
logblob blob NOT NULL,
created datetime NOT NULL,
primary key (name, created)
) engine=InnoDB default charset=utf8
partition by hash( to_days(created))
partitions 10;

Stop server & physically copy datadir, or remove MySQL binaries & replace with MariaDB binaries.
Start server.
Try to access table:

MariaDB [t38689]> select count(*) from example;
ERROR 1932 (42S02): Table 't38689.example' doesn't exist in engine

Try running mysql_upgrade:

Repairing tables
t38689.example
Error    : Table 't38689.example' doesn't exist in engine
status   : Operation failed

Problem confirmed with tables partitioned by HASH, COLUMN, KEY, RANGE, and LIST.



 Comments   
Comment by Sergei Golubchik [ 2020-07-08 ]

is it native innodb partitioning? what's the content of the datadir?

Comment by Elena Stepanova [ 2020-07-08 ]

-rw-r----- 1 elenst elenst     65 Feb 17 18:26 db.opt
-rw-r----- 1 elenst elenst   8632 Jul  8 00:56 example.frm
-rw-r----- 1 elenst elenst  98304 Jul  8 00:57 example#P#p0.ibd
-rw-r----- 1 elenst elenst  98304 Jul  8 00:57 example#P#p1.ibd
-rw-r----- 1 elenst elenst  98304 Jul  8 00:57 example#P#p2.ibd
-rw-r----- 1 elenst elenst  98304 Jul  8 00:57 example#P#p3.ibd
-rw-r----- 1 elenst elenst  98304 Jul  8 00:57 example#P#p4.ibd
-rw-r----- 1 elenst elenst  98304 Jul  8 00:57 example#P#p5.ibd
-rw-r----- 1 elenst elenst  98304 Jul  8 00:57 example#P#p6.ibd
-rw-r----- 1 elenst elenst  98304 Jul  8 00:57 example#P#p7.ibd
-rw-r----- 1 elenst elenst  98304 Jul  8 00:57 example#P#p8.ibd
-rw-r----- 1 elenst elenst  98304 Jul  8 00:57 example#P#p9.ibd

Yes, I assume it's native InnoDB partitioning. No .par file in the datadir.

Comment by Sergei Golubchik [ 2020-07-11 ]

MariaDB does not support InnoDB native partitioning

Comment by Michael Widenius [ 2023-06-01 ]

Reopened the bug as we now have a solution for this problem

Comment by Michael Widenius [ 2023-06-01 ]

The problem with MySQL partitions compared to MariaDB partitions is two fold:

  • The .frm file is slightly different.
  • MySQL does not have a .par file , which in MariaDB contains the storage engines and the partition names.

The MySQL InnoDB data on disk seams to be identical to MariaDB's, which means that in theory it is possible to 'instantly' convert a partitioned MySQL table to MariaDB.

I have now been able to provide a fix for the above issues:

  • Add support for the MySQL .frm file format
  • Automatically create a .par file if it does not exists.
  • Verified that mariadb-upgrade creates the missing a .par files.
Comment by Michael Widenius [ 2023-06-25 ]

Pushed to 10.6 tree

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