Merge lp:~longbow/percona-xtrabackup/fix_691090 into lp:percona-xtrabackup/2.0

Proposed by Valentine Gostev
Status: Superseded
Proposed branch: lp:~longbow/percona-xtrabackup/fix_691090
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 123 lines (+76/-6)
3 files modified
innobackupex (+6/-6)
test/t/xb_perm_basic.sh (+34/-0)
test/t/xb_perm_stream.sh (+36/-0)
To merge this branch: bzr merge lp:~longbow/percona-xtrabackup/fix_691090
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Needs Fixing
Stewart Smith (community) Needs Fixing
Review via email: mp+79396@code.launchpad.net

This proposal has been superseded by a proposal from 2011-10-26.

Description of the change

xtrabackup_suspended and xtrabackup_checkpoints now always created in tmp_dir.

To post a comment you must log in.
Revision history for this message
Stewart Smith (stewart) wrote :

Please also update the documentation as the documentation for the behavior of --suspend-at-end and --stream doesn't exist (and it should).

review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) wrote :

I would also like to see a separate test case rather than a modification of existing one(s).

review: Needs Fixing
318. By Valentine Gostev

Files xtrabackup_checkpoints and xtrabackup_suspended should be kept in tmp
dir, since user running innobackupex may not have permissions to write mysql
datadir.

Modified xb_basic and xb_stream tests to make datadir readonly while
innobackupex is running.

Revision history for this message
Alexey Kopytov (akopytov) wrote :

The problem with the tests is that if innobackupex fails for whatever reasons with permissions on $mysql_datadir modified, that directory cannot be removed, because the current user has no write access. So it stays there forever.

What's worse is that a Jenkins run for this MP has already poisoned slaves. There are failures like this: http://jenkins.percona.com/view/Percona%20Xtrabackup/job/percona-xtrabackup-param/80/BUILD_TYPE=release,Host=el6-64,xtrabackuptarget=xtradb55/testReport/junit/%28root%29/t_xb_perm_stream/sh/. And there are phantom xb_perm_* test failures even when the branch being tests does not have those tests!

review: Needs Fixing

Unmerged revisions

318. By Valentine Gostev

Files xtrabackup_checkpoints and xtrabackup_suspended should be kept in tmp
dir, since user running innobackupex may not have permissions to write mysql
datadir.

Modified xb_basic and xb_stream tests to make datadir readonly while
innobackupex is running.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innobackupex'
2--- innobackupex 2011-10-21 17:47:31 +0000
3+++ innobackupex 2011-10-26 05:47:24 +0000
4@@ -419,17 +419,17 @@
5 and Die "Failed to scp file '$option_remote_host:$backup_dir/xtrabackup_logfile': $!";
6 unlink $tmp_logfile || Die "Failed to delete '$tmp_logfile': $!";
7
8- system("scp $option_scp_opt '$orig_datadir/xtrabackup_checkpoints' '$option_remote_host:$backup_dir/xtrabackup_checkpoints'")
9+ system("scp $option_scp_opt '$option_tmpdir/xtrabackup_checkpoints' '$option_remote_host:$backup_dir/xtrabackup_checkpoints'")
10 and Die "Failed to scp file '$option_remote_host:$backup_dir/xtrabackup_checkpoints': $!";
11- unlink "$orig_datadir/xtrabackup_checkpoints" || Die "Failed to delete '$orig_datadir/xtrabackup_checkpoints': $!";
12+ unlink "$option_tmpdir/xtrabackup_checkpoints" || Die "Failed to delete '$option_tmpdir/xtrabackup_checkpoints': $!";
13 } elsif ($option_stream eq 'tar') {
14 system("cd $option_tmpdir; tar chf - xtrabackup_logfile")
15 and Die "Failed to stream 'xtrabackup_logfile': $!";
16 unlink $tmp_logfile || Die "Failed to delete '$tmp_logfile': $!";
17
18- system("cd $orig_datadir; tar chf - xtrabackup_checkpoints")
19+ system("cd $option_tmpdir; tar chf - xtrabackup_checkpoints")
20 and Die "Failed to stream 'xtrabackup_checkpoints': $!";
21- unlink "$orig_datadir/xtrabackup_checkpoints" || Die "Failed to delete '$orig_datadir/xtrabackup_checkpoints': $!";
22+ unlink "$option_tmpdir/xtrabackup_checkpoints" || Die "Failed to delete '$option_tmpdir/xtrabackup_checkpoints': $!";
23 }
24
25 print STDERR "\n$prefix Backup created in directory '$backup_dir'\n";
26@@ -758,7 +758,7 @@
27 $options = $options . " --target-dir=$backup_dir";
28 } else {
29 #(datadir) for 'xtrabackup_suspended' and 'xtrabackup_checkpoints'
30- $options = $options . " --log-stream --target-dir=./";
31+ $options = $options . " --log-stream --target-dir=" . $option_tmpdir;
32 }
33
34 # prepare command line for running ibbackup
35@@ -1469,7 +1469,7 @@
36 $binlog_info = $backup_dir . '/xtrabackup_binlog_info';
37 $slave_info = $backup_dir . '/xtrabackup_slave_info';
38 } else {
39- $suspend_file = get_option(\%config, 'mysqld', 'datadir') . '/xtrabackup_suspended';
40+ $suspend_file = $option_tmpdir . '/xtrabackup_suspended';
41 $tmp_logfile = $option_tmpdir . '/xtrabackup_logfile';
42 $mysql_stdout = $option_tmpdir . '/mysql-stdout';
43 $mysql_stderr = $option_tmpdir . '/mysql-stderr';
44
45=== added file 'test/t/xb_perm_basic.sh'
46--- test/t/xb_perm_basic.sh 1970-01-01 00:00:00 +0000
47+++ test/t/xb_perm_basic.sh 2011-10-26 05:47:24 +0000
48@@ -0,0 +1,34 @@
49+. inc/common.sh
50+
51+init
52+run_mysqld
53+load_dbase_schema sakila
54+load_dbase_data sakila
55+
56+mkdir -p $topdir/backup
57+chmod -R 500 $mysql_datadir
58+innobackupex --no-timestamp $topdir/backup
59+chmod -R 700 $mysql_datadir
60+backup_dir=$topdir/backup
61+vlog "Backup created in directory $backup_dir"
62+
63+stop_mysqld
64+# Remove datadir
65+rm -r $mysql_datadir
66+#init_mysql_dir
67+# Restore sakila
68+vlog "Applying log"
69+vlog "###########"
70+vlog "# PREPARE #"
71+vlog "###########"
72+innobackupex --apply-log $backup_dir
73+vlog "Restoring MySQL datadir"
74+mkdir -p $mysql_datadir
75+vlog "###########"
76+vlog "# RESTORE #"
77+vlog "###########"
78+innobackupex --copy-back $backup_dir
79+
80+run_mysqld
81+# Check sakila
82+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
83
84=== added file 'test/t/xb_perm_stream.sh'
85--- test/t/xb_perm_stream.sh 1970-01-01 00:00:00 +0000
86+++ test/t/xb_perm_stream.sh 2011-10-26 05:47:24 +0000
87@@ -0,0 +1,36 @@
88+. inc/common.sh
89+
90+init
91+run_mysqld
92+load_dbase_schema sakila
93+load_dbase_data sakila
94+
95+# Take backup
96+chmod -R 500 $mysql_datadir
97+mkdir -p $topdir/backup
98+innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
99+chmod -R 700 $mysql_datadir
100+
101+stop_mysqld
102+# Remove datadir
103+rm -r $mysql_datadir
104+# Restore sakila
105+vlog "Applying log"
106+backup_dir=$topdir/backup
107+cd $backup_dir
108+$TAR -ixvf out.tar
109+cd - >/dev/null 2>&1
110+vlog "###########"
111+vlog "# PREPARE #"
112+vlog "###########"
113+innobackupex --apply-log $backup_dir
114+vlog "Restoring MySQL datadir"
115+mkdir -p $mysql_datadir
116+vlog "###########"
117+vlog "# RESTORE #"
118+vlog "###########"
119+innobackupex --copy-back $backup_dir
120+
121+run_mysqld
122+# Check sakila
123+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila

Subscribers

People subscribed via source and target branches