Comment 0 for bug 721339

Revision history for this message
Valentine Gostev (longbow) wrote : innobackupex partial backup corrupts skipped tables

innobackupex from trunk
DB server: Percona Server 5.1.54-12.5 rev 188

When we create a partial backup with innobackupex, it creates the same directory structure like in mysql datadir, but puts only tables' files accoring to REGEXP.
Also it copies ibdata1 file. If we restore backup with --copy-back, InnoDB tables which were not backuped will become unavailable:

mysql> use include
Database changed
mysql> create table t1 (a varchar(20)) ENGINE=MyISAM;
Query OK, 0 rows affected (0.01 sec)

mysql> create table t2 (a varchar(20)) ENGINE=InnoDB;
Query OK, 0 rows affected (0.00 sec)

mysql> create table m1 (a varchar(20)) ENGINE=MyISAM;
Query OK, 0 rows affected (0.00 sec)

mysql> create table m2 (a varchar(20)) ENGINE=InnoDB;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into t1 values (1),(2),(3);
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0

mysql> insert into t2 values (1),(2),(3);
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0

mysql> insert into m1 values (1),(2),(3);
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0

mysql> insert into m2 values (1),(2),(3);
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0

root@dev302:~# innobackupex --include="^include[.]t" /root/backup > /dev/null 2>&1
root@dev302:~# innobackupex --apply-log /root/backup/2011-02-18_18-40-41/ > /dev/null 2>&1
root@dev302:~# ls -lah backup/2011-02-18_18-40-41/
total 23M
drwxr-xr-x 5 root root 4.0K Feb 18 18:41 .
drwxr-xr-x 3 root root 4.0K Feb 18 18:40 ..
-rw-r--r-- 1 root root 342 Feb 18 18:40 backup-my.cnf
-rw-r--r-- 1 root root 5.0M Feb 18 18:41 ib_logfile0
-rw-r--r-- 1 root root 5.0M Feb 18 18:41 ib_logfile1
-rw-r--r-- 1 root root 10M Feb 18 18:41 ibdata1
drwx------ 2 root root 4.0K Feb 18 18:41 include
drwxr-xr-x 2 root root 4.0K Feb 18 18:41 mysql
-rw-r--r-- 1 root root 0 Feb 18 18:40 mysql-stderr
-rw-r--r-- 1 root root 312 Feb 18 18:41 mysql-stdout
drwx------ 2 root root 4.0K Feb 18 18:40 test
-rw-r--r-- 1 root root 10 Feb 18 18:41 xtrabackup_binary
-rw-r--r-- 1 root root 1 Feb 18 18:41 xtrabackup_binlog_info
-rw-r--r-- 1 root root 75 Feb 18 18:41 xtrabackup_checkpoints
-rw-r--r-- 1 root root 2.0M Feb 18 18:41 xtrabackup_logfile
root@dev302:~# innobackupex --copy-back /root/backup/2011-02-18_18-40-41/ > /dev/null 2>&1

mysql> select * from m2;
ERROR 1146 (42S02): Table 'include.m2' doesn't exist

Way to fix: innobackupex should not backup ibdata1 file if we use it with --include option.