1 # Test of mysqlhotcopy (perl script)
5 --source include/not_windows.inc
6 --source include/not_embedded.inc
7 --source include/have_dbi_dbd-mysql.inc
11 # Fail the test if the mysqlhotcopy script is missing.
12 # If the tool's location changes, mysql-test-run.pl must be updated to
13 # reflect this (look for "MYSQLHOTCOPY").
14 die due
to missing mysqlhotcopy tool;
17 # NOTE (johnemb, 2011-01-26):
18 # In this test mysqlhotcopy (a perl script) is executed as a standalone
19 # executable, i.e. not necessarily using the perl interpreter in PATH,
20 # because that is how the documentation demonstrates it.
22 # We include have_dbi_dbd-mysql.inc above so that the test will
23 # be skipped if Perl modules required by the mysqlhotcopy tool are not
24 # found when the script is run this way.
27 let $MYSQLD_DATADIR= `SELECT @@datadir`;
29 DROP DATABASE IF EXISTS hotcopy_test;
31 CREATE DATABASE hotcopy_test;
33 eval CREATE
TABLE t1 (c1
int, c2 varchar(20)) ENGINE=$engine;
34 eval CREATE
TABLE t2 (c1
int, c2 varchar(20)) ENGINE=$engine;
35 eval CREATE
TABLE t3 (c1
int, c2 varchar(20)) ENGINE=$engine;
37 INSERT INTO t1 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
38 INSERT INTO t2 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
39 INSERT INTO t3 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
41 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
42 --list_files $MYSQLD_DATADIR/hotcopy_test
44 # backup into another database in the same directory
45 --replace_result $MASTER_MYSOCK MASTER_MYSOCK
46 --exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
48 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
49 --list_files $MYSQLD_DATADIR/hotcopy_save
56 # restore data into the original database with mysqlhotcopy
57 if(`SELECT engine=
'MyISAM' FROM information_schema.tables WHERE
table_name=
't1'`)
63 --replace_result $MASTER_MYSOCK MASTER_MYSOCK
64 --exec $MYSQLHOTCOPY --quiet --addtodest -S $MASTER_MYSOCK -u root hotcopy_save hotcopy_test
74 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
75 --list_files $MYSQLD_DATADIR/hotcopy_test
77 --replace_result $MASTER_MYSOCK MASTER_MYSOCK
78 --exec $MYSQLHOTCOPY --quiet --addtodest -S $MASTER_MYSOCK -u root hotcopy_save hotcopy_test
85 # backup of db into a directory
87 --replace_result $MASTER_MYSOCK MASTER_MYSOCK $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
88 --exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test $MYSQLTEST_VARDIR/tmp
89 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
90 --list_files $MYSQLTEST_VARDIR/tmp/hotcopy_test
91 #--exec rm -rf $MYSQLTEST_VARDIR/tmp/hotcopy_test
92 --remove_files_wildcard $MYSQLTEST_VARDIR/tmp/hotcopy_test *
93 --rmdir $MYSQLTEST_VARDIR/tmp/hotcopy_test
95 # backup without full index files
96 # reproduction of bug#53556, "--list_files" shows MYI files, which is wrong.
97 DROP DATABASE hotcopy_save;
98 --replace_result $MASTER_MYSOCK MASTER_MYSOCK
99 --exec $MYSQLHOTCOPY --quiet --noindices -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
100 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
101 --list_files $MYSQLD_DATADIR/hotcopy_save
103 # test of option "allowold"
104 DROP DATABASE hotcopy_save;
105 --replace_result $MASTER_MYSOCK MASTER_MYSOCK
106 --exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
107 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
108 --list_files $MYSQLD_DATADIR/hotcopy_save
109 --replace_result $MASTER_MYSOCK MASTER_MYSOCK
110 --error 9,11,110,2304
111 --exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
112 --replace_result $MASTER_MYSOCK MASTER_MYSOCK
113 --exec $MYSQLHOTCOPY --quiet --allowold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
114 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
115 --list_files $MYSQLD_DATADIR/hotcopy_save
117 # test of option "keepold"
118 --replace_result $MASTER_MYSOCK MASTER_MYSOCK
119 --exec $MYSQLHOTCOPY --quiet --keepold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
120 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
121 --list_files $MYSQLD_DATADIR/hotcopy_save_old
122 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
123 --list_files $MYSQLD_DATADIR/hotcopy_save
125 # test of option "suffix"
126 --replace_result $MASTER_MYSOCK MASTER_MYSOCK
127 --exec $MYSQLHOTCOPY --quiet --suffix=_cpy -S $MASTER_MYSOCK -u root hotcopy_test
128 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
129 --list_files $MYSQLD_DATADIR/hotcopy_test_cpy
130 DROP DATABASE hotcopy_test_cpy;
132 DROP DATABASE hotcopy_test;
133 DROP DATABASE hotcopy_save;
134 DROP DATABASE hotcopy_save_old;