Hello there,
The situation is as follows:
I am attempting to copy a table using the export/import tablespace method. Here are the details of the source and destination servers:
Source server (srcsrv):
Large table with few hundreds of partitions partitioned_table1.
Destination server (dstsrv):
Not patitioned table table1.
The flow:
on srcsrv:
sql> create database db1.
sql> use db1
sql> create table table1 (source /tmp/table1.sql when table1.sql is actually script that creates srcdb.partitioned_table1.sql without partitions)
sql> alter table srcdb.partitioned_table1 exchange partition p_XXX with table db1.table1 without validation;
unix: cp /var/lib/mysql/db1/table1.ibd /tmp/
sql> unlock tables;
sql> alter table srcdb.partitioned_table1 exchange partition p_XXX with table db1.table1 without validation;
By the end we have all data “back” to srcdb.partitioned_table1 and db1.table1 is empty.
on destsrv:
sql> create database db1.
sql> use db1
sql> create table table1 (source /tmp/table1.sql when table1.sql is actually script that creates srcdb.partitioned_table1.sql without partitions)
sql> alter table db1.table1 discard tablespace
unix> cp /tmp//table1.ibd /var/lib/mysql/db1/table1.ibd
sql> alter table db1.table1 import tablespace;
→ at this point of time server going down with:
[ERROR] InnoDB: Trying to access page number XXX in space XXX , space name db1/table1, which is outside the tablespace bounds. Byte offset 0, len 8192, i/o type read
. If you get this error at mysqld startup, please check that your my.cnf matches the ibdata files that you have in the MySQL server.
unix> sudo systemctl start mysqld
At this point, the server goes down with the following error:
[ERROR] InnoDB: Trying to access page number XXX in space XXX, space name db1/table1, which is outside the tablespace bounds. Byte offset 0, len 8192, i/o type read.
If you encounter this error at mysqld startup, please check that your my.cnf file matches the ibdata files you have in the MySQL server.
After the dstsrv server restarts, db1.table1 is in a healthy state, and the data is imported successfully.
If I take table1.cfg from srcsrv and use it for the import, there are no issues.
According to the documentation, there should be no need for a .cfg file for the import tablespace process, especially in my situation where it is used to speed up the data copying process and there are no chances of having incorrect metadata (since everything is created as part of the process).
Do you have any thoughts or insights on this matter?
Thanks.