xtrabackup makes invalid backup
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona XtraBackup moved to https://jira.percona.com/projects/PXB |
New
|
Undecided
|
Unassigned |
Bug Description
if table created with DATA DIRECTORY, xtrabackup makes invalid backup.
mysql> use test;
Database changed
mysql> CREATE TABLE t1 (c1 INT PRIMARY KEY) DATA DIRECTORY = '/tmp/foo';
Query OK, 0 rows affected (0.42 sec)
mysql> insert into t1 values(1);
Query OK, 1 row affected (0.05 sec)
mysql> insert into t1 values(2);
Query OK, 1 row affected (0.11 sec)
# ls -l /var/lib/
total 20
-rw-rw---- 1 mysql mysql 65 Feb 29 14:49 db.opt
-rw-rw---- 1 mysql mysql 8556 Feb 29 14:49 t1.frm
-rw-rw---- 1 mysql mysql 20 Feb 29 14:49 t1.isl
# cat /var/lib/
/tmp/foo/
# ls -l /tmp/foo/test/
total 96
-rw-rw---- 1 mysql mysql 98304 Feb 29 14:50 t1.ibd
# innobackupex --user=root --password=xxxx /tmp/backup
160229 14:55:26 innobackupex: Starting the backup operation
...
160229 14:55:54 completed OK!
# innobackupex --user=root --password=xxxx --apply-log /tmp/backup/
160229 15:00:14 innobackupex: Starting the apply-log operation
...
160229 15:00:20 completed OK!
.isl file is there:
# ls -l /tmp/backup/
total 116
-rw-r----- 1 root root 65 Feb 29 14:55 db.opt
-rw-r----- 1 root root 8556 Feb 29 14:55 t1.frm
-rw-r----- 1 root root 98304 Feb 29 14:55 t1.ibd
-rw-r----- 1 root root 20 Feb 29 14:55 t1.isl
content same:
# cat /tmp/backup/
/tmp/foo/
tring run mysqld on backup directory:
# mysqld --datadir=
...
2016-02-29 15:03:58 3392 [ERROR] InnoDB: A tablespace for test/t1 has been found in multiple places;
2016-02-29 15:03:58 3392 [ERROR] InnoDB: Default location; ./test/t1.ibd, LSN=0, Space ID=6, Flags=1024
2016-02-29 15:03:58 3392 [ERROR] InnoDB: Dictionary location; /tmp/foo/
2016-02-29 15:03:58 3392 [ERROR] InnoDB: Will not open the tablespace for 'test/t1'
2016-02-29 15:03:58 3392 [ERROR] InnoDB: Tablespace open failed for '"test"."t1"', ignored.
...
if i switch to test database in another client, log gets this:
...
2016-02-29 15:05:23 3420 [ERROR] InnoDB: Failed to find tablespace for table '"test"."t1"' in the cache. Attempting to load the tablespace with space id 6.
2016-02-29 15:05:23 3420 [ERROR] InnoDB: A tablespace for test/t1 has been found in multiple places;
2016-02-29 15:05:23 3420 [ERROR] InnoDB: Default location; ./test/t1.ibd, LSN=0, Space ID=6, Flags=1024
2016-02-29 15:05:23 3420 [ERROR] InnoDB: Dictionary location; /tmp/foo/
2016-02-29 15:05:23 3420 [ERROR] InnoDB: Will not open the tablespace for 'test/t1'
2016-02-29 15:05:23 7fbf490a4700 InnoDB: cannot calculate statistics for table "test"."t1" because the .ibd file is missing. For help, please refer to http://
...
Simply remove .isl file and it will fix this specific issue. More interesting question is do we want --copy-back (which you didn't use) to copy tablespace to it's original location as pointed by .isl file? I think in some cases we want, but in other cases we don't. Maybe we should make it optional?