/usr/lib/mysql-testsuite/include/mysqlhotcopy.inc is in percona-xtradb-cluster-testsuite-5.5 5.5.34-25.9+dfsg-0ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | # Test of mysqlhotcopy (perl script)
# Author: Horst Hunger
# Created: 2010-05-10
--source include/not_windows.inc
--source include/not_embedded.inc
--source include/have_dbi_dbd-mysql.inc
if (!$MYSQLHOTCOPY)
{
# Fail the test if the mysqlhotcopy script is missing.
# If the tool's location changes, mysql-test-run.pl must be updated to
# reflect this (look for "MYSQLHOTCOPY").
die due to missing mysqlhotcopy tool;
}
# NOTE (johnemb, 2011-01-26):
# In this test mysqlhotcopy (a perl script) is executed as a standalone
# executable, i.e. not necessarily using the perl interpreter in PATH,
# because that is how the documentation demonstrates it.
#
# We include have_dbi_dbd-mysql.inc above so that the test will
# be skipped if Perl modules required by the mysqlhotcopy tool are not
# found when the script is run this way.
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--disable_warnings
DROP DATABASE IF EXISTS hotcopy_test;
--enable_warnings
CREATE DATABASE hotcopy_test;
USE hotcopy_test;
eval CREATE TABLE t1 (c1 int, c2 varchar(20)) ENGINE=$engine;
eval CREATE TABLE t2 (c1 int, c2 varchar(20)) ENGINE=$engine;
eval CREATE TABLE t3 (c1 int, c2 varchar(20)) ENGINE=$engine;
INSERT INTO t1 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
INSERT INTO t2 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
INSERT INTO t3 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_test
# backup into another database in the same directory
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_save
USE hotcopy_save;
SELECT * FROM t1;
SELECT * FROM t2;
SELECT * FROM t3;
# restore data into the original database with mysqlhotcopy
if(`SELECT engine= 'MyISAM' FROM information_schema.tables WHERE table_name='t1'`)
{
USE hotcopy_test;
DELETE FROM t1;
SELECT * FROM t1;
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet --addtodest -S $MASTER_MYSOCK -u root hotcopy_save hotcopy_test
USE hotcopy_save;
SELECT * FROM t1;
SELECT * FROM t2;
SELECT * FROM t3;
}
USE hotcopy_test;
DROP TABLE t2;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_test
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet --addtodest -S $MASTER_MYSOCK -u root hotcopy_save hotcopy_test
FLUSH TABLES;
SELECT * FROM t1;
SELECT * FROM t2;
SELECT * FROM t3;
# backup of db into a directory
USE hotcopy_test;
--replace_result $MASTER_MYSOCK MASTER_MYSOCK $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test $MYSQLTEST_VARDIR/tmp
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--list_files $MYSQLTEST_VARDIR/tmp/hotcopy_test
#--exec rm -rf $MYSQLTEST_VARDIR/tmp/hotcopy_test
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp/hotcopy_test *
--rmdir $MYSQLTEST_VARDIR/tmp/hotcopy_test
# backup without full index files
# reproduction of bug#53556, "--list_files" shows MYI files, which is wrong.
DROP DATABASE hotcopy_save;
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet --noindices -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_save
# test of option "allowold"
DROP DATABASE hotcopy_save;
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_save
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--error 9,11,2304
--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet --allowold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_save
# test of option "keepold"
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet --keepold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_save_old
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_save
# test of option "suffix"
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet --suffix=_cpy -S $MASTER_MYSOCK -u root hotcopy_test
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_test_cpy
DROP DATABASE hotcopy_test_cpy;
DROP DATABASE hotcopy_test;
DROP DATABASE hotcopy_save;
DROP DATABASE hotcopy_save_old;
|