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: 76 lines (+29/-6)
3 files modified
innobackupex (+6/-6)
test/t/xb_perm_basic.sh (+11/-0)
test/t/xb_perm_stream.sh (+12/-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 Pending
Review via email: mp+80426@code.launchpad.net

This proposal supersedes a proposal from 2011-10-26.

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.

previsously modified tests were added as separate tests

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

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 : Posted in a previous version of this proposal

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

review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

I don't see any point in using the sakila database in the test cases. It is rather big, so it just increases test suite execution time while contributing nothing to test coverage.

In fact, the bug is about placing auxiliary files in datadir. So you don't even have to create any database in test cases. Just start mysqld, change datadir permissions and try to back up. There's no need for prepare/restore/etc. It's not what the bug was about.

I.e. just testing that innobackupex does not fail in the backup mode would be sufficient.

review: Needs Fixing
Revision history for this message
Valentine Gostev (longbow) wrote : Posted in a previous version of this proposal

If we care about test execution time, previous approach was better way

Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

I prefer tests to be orthogonal, i.e. have a single and clearly defined objective. Having test cases that try to test multiple things at a time leads to a mess when some functionality is changed and you have to modify/adjust them.

Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

By the way, don't forget to reference the bug number in the test case comments.

Revision history for this message
Valentine Gostev (longbow) wrote : Posted in a previous version of this proposal

In general I agree, but making a separate test case anyway causes additional time expenses (unpacking tarball with server + system db install) compared to reloading sakila. See updated diff

Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

Reducing a test execution time when the functionality is unaffected is
okay. Optimizing tests at the cost of their functionality is usually not
okay.

Server tarballs are currently not unpacked for every test. Instead, the
existing server installation is reused.

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

Please add comments referencing the bug number (see my previous comment about this).

And while you are at it, you don't have to call stop_mysqld at the end of tests now, it is called from run.sh anyway.

review: Needs Fixing
Revision history for this message
Stewart Smith (stewart) wrote : Posted in a previous version of this proposal

On Wed, 26 Oct 2011 07:16:23 -0000, Valentine Gostev <email address hidden> wrote:
> In general I agree, but making a separate test case anyway causes
> additional time expenses (unpacking tarball with server + system db
> install) compared to reloading sakila. See updated diff

we can fix execution time a number of ways in the future - having the
small, specific test cases though makes dev a lot easier.

e.g. the problem with the mysql test suite is that there are way too
many giant tests that test 143 things, making the first step of solving
a test failure being rewriting a test for the part of the test that
actuall fails and not the 100 other things that pass.
--
Stewart Smith

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 : Posted in a previous version of this proposal

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 07:13:20 +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 07:13:20 +0000
48@@ -0,0 +1,11 @@
49+. inc/common.sh
50+
51+init
52+run_mysqld
53+
54+mkdir -p $topdir/backup
55+chmod -R 500 $mysql_datadir
56+innobackupex --no-timestamp $topdir/backup
57+chmod -R 700 $mysql_datadir
58+
59+stop_mysqld
60
61=== added file 'test/t/xb_perm_stream.sh'
62--- test/t/xb_perm_stream.sh 1970-01-01 00:00:00 +0000
63+++ test/t/xb_perm_stream.sh 2011-10-26 07:13:20 +0000
64@@ -0,0 +1,12 @@
65+. inc/common.sh
66+
67+init
68+run_mysqld
69+
70+# Take backup
71+chmod -R 500 $mysql_datadir
72+mkdir -p $topdir/backup
73+innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
74+chmod -R 700 $mysql_datadir
75+
76+stop_mysqld

Subscribers

People subscribed via source and target branches