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

Proposed by Valentine Gostev
Status: Rejected
Rejected by: Stewart Smith
Proposed branch: lp:~longbow/percona-xtrabackup/fix_691090
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 77 lines (+30/-6)
3 files modified
innobackupex (+6/-6)
test/t/xb_perm_basic.sh (+11/-0)
test/t/xb_perm_stream.sh (+13/-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+80666@code.launchpad.net

This proposal supersedes 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
Comments to tests added

http://jenkins.percona.com/view/Percona%20Xtrabackup/job/percona-xtrabackup-param/78/

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

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
Alexey Kopytov (akopytov) : Posted in a previous version of this proposal
review: Approve
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

Revision history for this message
Valentine Gostev (longbow) wrote : Posted in a previous version of this proposal
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
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Commented on a superseded MP by mistake, see the previous comment.

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

An example of a Jenkins runs with lots of xb_perm_* failures, when the branch does not have those tests: http://jenkins.percona.com/view/Percona%20Xtrabackup/job/percona-xtrabackup-param/80/

Revision history for this message
Stewart Smith (stewart) wrote :

Another branch was merged fixing the bug and adding tests.

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
=== modified file 'innobackupex'
--- innobackupex 2011-10-21 17:47:31 +0000
+++ innobackupex 2011-10-28 13:17:25 +0000
@@ -419,17 +419,17 @@
419 and Die "Failed to scp file '$option_remote_host:$backup_dir/xtrabackup_logfile': $!";419 and Die "Failed to scp file '$option_remote_host:$backup_dir/xtrabackup_logfile': $!";
420 unlink $tmp_logfile || Die "Failed to delete '$tmp_logfile': $!";420 unlink $tmp_logfile || Die "Failed to delete '$tmp_logfile': $!";
421421
422 system("scp $option_scp_opt '$orig_datadir/xtrabackup_checkpoints' '$option_remote_host:$backup_dir/xtrabackup_checkpoints'")422 system("scp $option_scp_opt '$option_tmpdir/xtrabackup_checkpoints' '$option_remote_host:$backup_dir/xtrabackup_checkpoints'")
423 and Die "Failed to scp file '$option_remote_host:$backup_dir/xtrabackup_checkpoints': $!";423 and Die "Failed to scp file '$option_remote_host:$backup_dir/xtrabackup_checkpoints': $!";
424 unlink "$orig_datadir/xtrabackup_checkpoints" || Die "Failed to delete '$orig_datadir/xtrabackup_checkpoints': $!";424 unlink "$option_tmpdir/xtrabackup_checkpoints" || Die "Failed to delete '$option_tmpdir/xtrabackup_checkpoints': $!";
425 } elsif ($option_stream eq 'tar') {425 } elsif ($option_stream eq 'tar') {
426 system("cd $option_tmpdir; tar chf - xtrabackup_logfile")426 system("cd $option_tmpdir; tar chf - xtrabackup_logfile")
427 and Die "Failed to stream 'xtrabackup_logfile': $!";427 and Die "Failed to stream 'xtrabackup_logfile': $!";
428 unlink $tmp_logfile || Die "Failed to delete '$tmp_logfile': $!";428 unlink $tmp_logfile || Die "Failed to delete '$tmp_logfile': $!";
429429
430 system("cd $orig_datadir; tar chf - xtrabackup_checkpoints")430 system("cd $option_tmpdir; tar chf - xtrabackup_checkpoints")
431 and Die "Failed to stream 'xtrabackup_checkpoints': $!";431 and Die "Failed to stream 'xtrabackup_checkpoints': $!";
432 unlink "$orig_datadir/xtrabackup_checkpoints" || Die "Failed to delete '$orig_datadir/xtrabackup_checkpoints': $!";432 unlink "$option_tmpdir/xtrabackup_checkpoints" || Die "Failed to delete '$option_tmpdir/xtrabackup_checkpoints': $!";
433 }433 }
434434
435 print STDERR "\n$prefix Backup created in directory '$backup_dir'\n";435 print STDERR "\n$prefix Backup created in directory '$backup_dir'\n";
@@ -758,7 +758,7 @@
758 $options = $options . " --target-dir=$backup_dir";758 $options = $options . " --target-dir=$backup_dir";
759 } else {759 } else {
760 #(datadir) for 'xtrabackup_suspended' and 'xtrabackup_checkpoints'760 #(datadir) for 'xtrabackup_suspended' and 'xtrabackup_checkpoints'
761 $options = $options . " --log-stream --target-dir=./";761 $options = $options . " --log-stream --target-dir=" . $option_tmpdir;
762 }762 }
763763
764 # prepare command line for running ibbackup764 # prepare command line for running ibbackup
@@ -1469,7 +1469,7 @@
1469 $binlog_info = $backup_dir . '/xtrabackup_binlog_info';1469 $binlog_info = $backup_dir . '/xtrabackup_binlog_info';
1470 $slave_info = $backup_dir . '/xtrabackup_slave_info';1470 $slave_info = $backup_dir . '/xtrabackup_slave_info';
1471 } else {1471 } else {
1472 $suspend_file = get_option(\%config, 'mysqld', 'datadir') . '/xtrabackup_suspended';1472 $suspend_file = $option_tmpdir . '/xtrabackup_suspended';
1473 $tmp_logfile = $option_tmpdir . '/xtrabackup_logfile';1473 $tmp_logfile = $option_tmpdir . '/xtrabackup_logfile';
1474 $mysql_stdout = $option_tmpdir . '/mysql-stdout';1474 $mysql_stdout = $option_tmpdir . '/mysql-stdout';
1475 $mysql_stderr = $option_tmpdir . '/mysql-stderr';1475 $mysql_stderr = $option_tmpdir . '/mysql-stderr';
14761476
=== added file 'test/t/xb_perm_basic.sh'
--- test/t/xb_perm_basic.sh 1970-01-01 00:00:00 +0000
+++ test/t/xb_perm_basic.sh 2011-10-28 13:17:25 +0000
@@ -0,0 +1,11 @@
1# Test for fix of https://bugs.launchpad.net/percona-xtrabackup/+bug/691090
2. inc/common.sh
3
4init
5run_mysqld
6
7chmod -R 500 $mysql_datadir
8innobackupex --no-timestamp $topdir/backup
9chmod -R 700 $mysql_datadir
10
11stop_mysqld
012
=== added file 'test/t/xb_perm_stream.sh'
--- test/t/xb_perm_stream.sh 1970-01-01 00:00:00 +0000
+++ test/t/xb_perm_stream.sh 2011-10-28 13:17:25 +0000
@@ -0,0 +1,13 @@
1# Test for fix of https://bugs.launchpad.net/percona-xtrabackup/+bug/691090
2. inc/common.sh
3
4init
5run_mysqld
6
7# Take backup
8chmod -R 500 $mysql_datadir
9mkdir -p $topdir/backup
10innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
11chmod -R 700 $mysql_datadir
12
13stop_mysqld

Subscribers

People subscribed via source and target branches