Failed recover of table if backup was taken while altering tablespace
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Percona XtraBackup moved to https://jira.percona.com/projects/PXB | Status tracked in 2.4 | |||||
2.4 |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Hi,
Here is reproduce steps:
I have table:
CREATE TABLE `sbtest1` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`k` int(10) unsigned NOT NULL DEFAULT '0',
`c` char(120) NOT NULL DEFAULT '',
`pad` char(60) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `k_1` (`k`)
) ENGINE=InnoDB AUTO_INCREMENT=
mysql> select count(*) from sbtest1;
+----------+
| count(*) |
+----------+
| 4240148 |
+----------+
1 row in set (2,40 sec)
Which you can easily populate using:
sysbench --test=
Create General Tablespace:
mysql> create tablespace sbtest1 add datafile '/var/lib/
Query OK, 0 rows affected (0,12 sec)
Then alter sbtest1 table's tablespace:
mysql> alter table sbtest1 tablespace=sbtest1;
Query OK, 0 rows affected (36,78 sec)
Records: 0 Duplicates: 0 Warnings: 0
Of course we want our per table file back. Run following parallel with backup command:
alter table sbtest1 tablespace=
./xtrabackup --defaults-
Then prepare full backup:
./xtrabackup --defaults-
Some interesting output:
InnoDB: Ignoring data file './dbtest/
InnoDB: Ignoring data file './dbtest/
InnoDB: xtrabackup: Last MySQL binlog file position 581966806, file name mysql-bin.000004
InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
InnoDB: Cannot open datafile for read-only: './sbtest1.ibd' OS error: 71
InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
InnoDB: Could not find a valid tablespace file for `sbtest1`
InnoDB: Shutdown completed; log sequence number 2383808274
160111 12:02:35 completed OK!
Shutdown MySQL + remove /var/lib/mysql/ files copy-back all files from database + start MySQL:
systemctl stop mysqld.service
mv /var/lib/mysql /var/lib/
[root@mysql-57 full]# rsync -avrP * /var/lib/mysql/
[root@mysql-57 ~]# chown -R mysql:mysql /var/lib/mysql/
systemctl start mysqld.service
Look for table's data:
mysql> select count(*) from sbtest1;
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (0,00 sec)
Maybe related to Upstream bugs:
http:// bugs.mysql. com/bug. php?id= 80183 bugs.mysql. com/bug. php?id= 80181
http://