~percona-dev/percona-xtrabackup/release-1.6.1

« back to all changes in this revision

Viewing changes to test/t/tar4ibd_symlink.sh

  • Committer: Stewart Smith
  • Date: 2011-05-26 18:27:44 UTC
  • mfrom: (245.1.1 release-1.6)
  • Revision ID: stewart@flamingspork.com-20110526182744-d0isofoxzafe70c1
merge bug387587 fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
########################################################################
 
2
# Tests for tar4ibd + symlinks (bug #387587)
 
3
########################################################################
 
4
 
 
5
. inc/common.sh
 
6
 
 
7
init
 
8
run_mysqld --innodb_file_per_table
 
9
load_dbase_schema sakila
 
10
load_dbase_data sakila
 
11
 
 
12
# Copy some .ibd files to a temporary location and replace them with symlinks
 
13
 
 
14
mv $topdir/mysql/sakila/actor.ibd $topdir
 
15
ln -s $topdir/actor.ibd $topdir/mysql/sakila
 
16
 
 
17
mv $topdir/mysql/sakila/customer.ibd $topdir
 
18
ln -s $topdir/customer.ibd $topdir/customer_link.ibd
 
19
ln -s $topdir/customer_link.ibd $topdir/mysql/sakila/customer.ibd
 
20
 
 
21
# Take backup
 
22
mkdir -p $topdir/backup
 
23
run_cmd ${IB_BIN} --socket=$mysql_socket --stream=tar $topdir/backup > $topdir/backup/out.tar 2> $OUTFILE
 
24
 
 
25
stop_mysqld
 
26
 
 
27
# Remove datadir
 
28
rm -r $mysql_datadir
 
29
 
 
30
# Remove the temporary files referenced by symlinks
 
31
rm -f $topdir/actor.ibd
 
32
rm -f $topdir/customer.ibd
 
33
rm -f $topdir/customer_link.ibd
 
34
 
 
35
# Restore sakila
 
36
vlog "Applying log"
 
37
backup_dir=$topdir/backup
 
38
cd $backup_dir
 
39
$TAR -ixvf out.tar
 
40
cd - >/dev/null 2>&1 
 
41
 
 
42
run_cmd ${IB_BIN} --apply-log $backup_dir >> $OUTFILE 2>&1
 
43
 
 
44
vlog "Restoring MySQL datadir"
 
45
mkdir -p $mysql_datadir
 
46
 
 
47
run_cmd ${IB_BIN} --copy-back $backup_dir >> $OUTFILE 2>&1
 
48
 
 
49
run_mysqld
 
50
 
 
51
# Check sakila
 
52
run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT COUNT(*) FROM actor" sakila
 
53
run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT COUNT(*) FROM customer" sakila
 
54
stop_mysqld
 
55
clean