summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/tokudb_backup/t/tokudb_backup_exclude.test
blob: a0ff5152f669ac99557daac7f9d6362e4a28fb42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# This test is to specifically test the TokuDB backup excluse functionality.
# This is _not_ an illustration of how to exclude tables from a TokuDB backup,
# if you exclude TokuDB database files in this way, you will have a useless
# backup.
source include/have_tokudb_backup.inc;

disable_query_log;

set @old_backup_exclude = @@session.tokudb_backup_exclude;

enable_query_log;

# This should create 20 files prefixed with '_test_t1'
create table t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c)) engine='tokudb';
create table t1a(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c)) engine='tokudb';
create table t1b(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c)) engine='tokudb';
create table t1c(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c)) engine='tokudb';

# This should not filter any files
disable_query_log;
--exec mkdir $MYSQLTEST_VARDIR/tmp/backup
--eval set session tokudb_backup_dir='$MYSQLTEST_VARDIR/tmp/backup'
enable_query_log;

select @@session.tokudb_backup_last_error;
select @@session.tokudb_backup_last_error_string;

# 20 files should be in the backup set
--exec ls $MYSQLTEST_VARDIR/tmp/backup/mysql_data_dir | grep -c _test_t1

--exec rm -rf $MYSQLTEST_VARDIR/tmp/backup


# This should filter all files for the t1a and t1c tables
set session tokudb_backup_exclude='(t1a|t1c)+';

disable_query_log;
--exec mkdir $MYSQLTEST_VARDIR/tmp/backup
--eval set session tokudb_backup_dir='$MYSQLTEST_VARDIR/tmp/backup'
enable_query_log;

select @@session.tokudb_backup_last_error;
select @@session.tokudb_backup_last_error_string;

# 10 files should be in the backup set
--exec ls $MYSQLTEST_VARDIR/tmp/backup/mysql_data_dir | grep -c _test_t1

--exec rm -rf $MYSQLTEST_VARDIR/tmp/backup

# This should filter all files for the t1a, t1b, and t1c tables
set session tokudb_backup_exclude='t1[abc]+';

disable_query_log;
--exec mkdir $MYSQLTEST_VARDIR/tmp/backup
--eval set session tokudb_backup_dir='$MYSQLTEST_VARDIR/tmp/backup'
enable_query_log;

select @@session.tokudb_backup_last_error;
select @@session.tokudb_backup_last_error_string;

# 5 files should be in the backup set
--exec ls $MYSQLTEST_VARDIR/tmp/backup/mysql_data_dir | grep -c _test_t1

--exec rm -rf $MYSQLTEST_VARDIR/tmp/backup

drop table t1;
drop table t1a;
drop table t1b;
drop table t1c;