| 1 |
#--source include/innodb_page_size.inc |
| 2 |
|
| 3 |
# Test --databases-exclude and --tables-exclude feature of xtrabackup 2.3.8 |
| 4 |
select @@ignore_db_dirs; |
| 5 |
|
| 6 |
let $MYSQLD_DATADIR= `select @@datadir`; |
| 7 |
|
| 8 |
mkdir $MYSQLD_DATADIR/db3; |
| 9 |
mkdir $MYSQLD_DATADIR/db4; |
| 10 |
mkdir $MYSQLD_DATADIR/db5; |
| 11 |
|
| 12 |
CREATE TABLE t1(i INT) ENGINE INNODB; |
| 13 |
INSERT INTO t1 VALUES(1); |
| 14 |
CREATE TABLE t2(i int) ENGINE INNODB; |
| 15 |
|
| 16 |
CREATE DATABASE db2; |
| 17 |
USE db2; |
| 18 |
CREATE TABLE t1(i INT) ENGINE INNODB; |
| 19 |
|
| 20 |
USE test; |
| 21 |
|
| 22 |
BEGIN; |
| 23 |
INSERT INTO db2.t1 VALUES(20); |
| 24 |
INSERT INTO test.t1 VALUES(20); |
| 25 |
INSERT INTO test.t2 VALUES(20); |
| 26 |
|
| 27 |
echo # xtrabackup backup; |
| 28 |
|
| 29 |
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; |
| 30 |
--disable_result_log |
| 31 |
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 "--tables-exclude=test.*2" "--databases-exclude=db2" --target-dir=$targetdir --innodb_log_checkpoint_now=1; |
| 32 |
--enable_result_log |
| 33 |
|
| 34 |
COMMIT; |
| 35 |
|
| 36 |
# check that only t1 table is in backup (t2 is excluded) |
| 37 |
list_files $targetdir/test *.new; |
| 38 |
list_files $targetdir/test *.ibd; |
| 39 |
# check that db2 database is not in the backup (excluded) |
| 40 |
--error 1 |
| 41 |
list_files $targetdir/db2 *.ibd; |
| 42 |
# check that db3 database is not in the backup (excluded) |
| 43 |
--error 1 |
| 44 |
list_files $targetdir/db3 *.ibd; |
| 45 |
# check that db4 database is not in the backup (excluded) |
| 46 |
--error 1 |
| 47 |
list_files $targetdir/db4 *.ibd; |
| 48 |
# check that db5 database is in the backup |
| 49 |
list_files $targetdir/db5 *.ibd; |
| 50 |
|
| 51 |
DROP TABLE t1; |
| 52 |
DROP TABLE t2; |
| 53 |
DROP DATABASE db2; |
| 54 |
rmdir $MYSQLD_DATADIR/db3; |
| 55 |
rmdir $MYSQLD_DATADIR/db4; |
| 56 |
rmdir $MYSQLD_DATADIR/db5; |
| 57 |
|
| 58 |
--let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log |
| 59 |
--disable_result_log |
| 60 |
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --export --prepare --target-dir="$targetdir" > $backup_log; |
| 61 |
--enable_result_log |
| 62 |
|
| 63 |
--let SEARCH_FILE=$backup_log |
| 64 |
--let SEARCH_PATTERN=Operating system error number |
| 65 |
--source include/search_pattern_in_file.inc |
| 66 |
--let SEARCH_PATTERN=Could not find a valid tablespace file for |
| 67 |
--source include/search_pattern_in_file.inc |
| 68 |
--remove_file $backup_log |
| 69 |
|
| 70 |
rmdir $targetdir; |