Merge lp:~akopytov/percona-xtrabackup/bug1002688-1.6 into lp:percona-xtrabackup/1.6

Proposed by Alexey Kopytov on 2012-05-22
Status: Merged
Approved by: Laurynas Biveinis on 2012-05-23
Approved revision: 339
Merged at revision: 339
Proposed branch: lp:~akopytov/percona-xtrabackup/bug1002688-1.6
Merge into: lp:percona-xtrabackup/1.6
Diff against target: 97 lines (+72/-3)
2 files modified
innobackupex (+4/-3)
test/t/bug1002688.sh (+68/-0)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug1002688-1.6
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) 2012-05-22 Approve on 2012-05-23
Review via email: mp+106857@code.launchpad.net

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innobackupex'
2--- innobackupex 2012-04-17 12:44:49 +0000
3+++ innobackupex 2012-05-22 16:52:20 +0000
4@@ -564,7 +564,7 @@
5 "file $copy_dir_dst/$_ exists";
6 }
7
8- print STDERR "$prefix Copying file '$copy_dir_dst/$_'\n";
9+ print STDERR "$prefix Copying '$File::Find::name' to '$dst_path'\n";
10 copy($File::Find::name, $dst_path) or Die "copy failed: $!";
11 }
12 }
13@@ -584,8 +584,9 @@
14 # use rsync when --rsync is specified
15 #
16 sub copy_dir_recursively {
17- $copy_dir_src = shift;
18- $copy_dir_dst = shift;
19+ # Clean paths and remove trailing slashes if any
20+ $copy_dir_src = File::Spec->canonpath(shift);
21+ $copy_dir_dst = File::Spec->canonpath(shift);
22 $copy_dir_exclude_regexp = shift;
23 $copy_dir_overwrite = shift;
24
25
26=== added file 'test/t/bug1002688.sh'
27--- test/t/bug1002688.sh 1970-01-01 00:00:00 +0000
28+++ test/t/bug1002688.sh 2012-05-22 16:52:20 +0000
29@@ -0,0 +1,68 @@
30+############################################################################
31+# Bug #1002688: innobackupex incremental apply-log copies to wrong directory
32+############################################################################
33+. inc/common.sh
34+
35+init
36+run_mysqld --innodb_file_per_table
37+load_sakila
38+
39+# Full backup
40+# backup root directory
41+vlog "Starting backup"
42+
43+full_backup_dir=$topdir/full_backup
44+innobackupex --no-timestamp $full_backup_dir
45+
46+# Changing data
47+
48+run_cmd $MYSQL $MYSQL_ARGS -e "CREATE DATABASE newdb"
49+run_cmd $MYSQL $MYSQL_ARGS -e \
50+ "CREATE TABLE actor_copy ENGINE=MyISAM SELECT * FROM sakila.actor" newdb
51+
52+# Saving the checksum of original table
53+checksum_a=`checksum_table newdb actor_copy`
54+test -n "$checksum_a" || die "Failed to checksum table actor_copy"
55+
56+vlog "Making incremental backup"
57+
58+# Incremental backup
59+inc_backup_dir=$topdir/incremental_backup
60+innobackupex --incremental --no-timestamp \
61+ --incremental-basedir=$full_backup_dir $inc_backup_dir
62+vlog "Incremental backup created in directory $inc_backup_dir"
63+
64+vlog "Preparing backup"
65+innobackupex --apply-log --redo-only $full_backup_dir
66+vlog "Log applied to full backup"
67+
68+innobackupex --apply-log --redo-only --incremental-dir=$inc_backup_dir/ \
69+ $full_backup_dir
70+vlog "Delta applied to full backup"
71+
72+innobackupex --apply-log $full_backup_dir
73+vlog "Data prepared for restore"
74+
75+# Destroying mysql data
76+stop_mysqld
77+rm -rf $mysql_datadir/*
78+vlog "Data destroyed"
79+
80+# Restore backup
81+vlog "Copying files to their original locations"
82+innobackupex --copy-back $full_backup_dir
83+vlog "Data restored"
84+
85+run_mysqld --innodb_file_per_table
86+
87+vlog "Checking checksums"
88+checksum_b=`checksum_table newdb actor_copy`
89+
90+vlog "Old checksum: $checksum_a"
91+vlog "New checksum: $checksum_b"
92+
93+if [ "$checksum_a" != "$checksum_b" ]
94+then
95+ vlog "Checksums do not match"
96+ exit -1
97+fi

Subscribers

People subscribed via source and target branches