1#--source include/innodb_page_size.inc
2
3# Test --databases-exclude and --tables-exclude feature of xtrabackup 2.3.8
4select @@ignore_db_dirs;
5
6let $MYSQLD_DATADIR= `select @@datadir`;
7
8mkdir $MYSQLD_DATADIR/db3;
9mkdir $MYSQLD_DATADIR/db4;
10mkdir $MYSQLD_DATADIR/db5;
11
12CREATE TABLE t1(i INT) ENGINE INNODB;
13INSERT INTO t1 VALUES(1);
14CREATE TABLE t2(i int) ENGINE INNODB;
15
16CREATE DATABASE db2;
17USE db2;
18CREATE TABLE t1(i INT) ENGINE INNODB;
19
20USE test;
21
22echo # xtrabackup backup;
23
24let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
25--disable_result_log
26exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf  --backup "--tables-exclude=test.*2" "--databases-exclude=db2" --target-dir=$targetdir;
27--enable_result_log
28
29# check that only t1 table is in backup (t2 is excluded)
30list_files $targetdir/test *.ibd;
31# check that db2 database is not in the backup (excluded)
32--error 1
33list_files $targetdir/db2 *.ibd;
34# check that db3 database is not in the backup (excluded)
35--error 1
36list_files $targetdir/db3 *.ibd;
37# check that db4 database is not in the backup (excluded)
38--error 1
39list_files $targetdir/db4 *.ibd;
40# check that db5 database is in the backup
41list_files $targetdir/db5 *.ibd;
42
43DROP TABLE t1;
44DROP TABLE t2;
45DROP DATABASE db2;
46rmdir $MYSQLD_DATADIR/db3;
47rmdir $MYSQLD_DATADIR/db4;
48rmdir $MYSQLD_DATADIR/db5;
49rmdir $targetdir;
50