Merge lp:~sergei.glushchenko/percona-xtrabackup/2.2-ST45575-xb-bug1376874 into lp:percona-xtrabackup/2.2

Proposed by Sergei Glushchenko on 2014-10-07
Status: Merged
Approved by: Alexey Kopytov on 2014-10-08
Approved revision: 5032
Merged at revision: 5033
Proposed branch: lp:~sergei.glushchenko/percona-xtrabackup/2.2-ST45575-xb-bug1376874
Merge into: lp:percona-xtrabackup/2.2
Diff against target: 62 lines (+44/-3)
2 files modified
storage/innobase/xtrabackup/innobackupex.pl (+23/-3)
storage/innobase/xtrabackup/test/t/bug1376874.sh (+21/-0)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-xtrabackup/2.2-ST45575-xb-bug1376874
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) 2014-10-07 Approve on 2014-10-08
Review via email: mp+237382@code.launchpad.net

Description of the change

Restrict mix of following options:

    1. --decompress, --decrypt
    2. --copy_back
    3. --move_back
    4. --apply_log

http://jenkins.percona.com/view/PXB%202.2/job/percona-xtrabackup-2.2-param/226/

To post a comment you must log in.
Alexey Kopytov (akopytov) wrote :

Sergei,

Looks good, except you don't have to use $prefix with die() -- it is added automatically, see *CORE::GLOBAL::die().

review: Needs Fixing

This code was changed from print STDERR ... and I just missed that "$prefix" part. Fixed.

I also ran another Jenkins build http://jenkins.percona.com/view/PXB%202.2/job/percona-xtrabackup-2.2-param/228/

Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'storage/innobase/xtrabackup/innobackupex.pl'
2--- storage/innobase/xtrabackup/innobackupex.pl 2014-10-05 12:02:02 +0000
3+++ storage/innobase/xtrabackup/innobackupex.pl 2014-10-08 13:20:03 +0000
4@@ -3829,9 +3829,29 @@
5 "options are mutually exclusive";
6 }
7
8- if ($option_copy_back && $option_move_back) {
9- print STDERR "$prefix --copy-back and --move-back options are " .
10- "mutually exclusive";
11+ my @mixed_options = ();
12+
13+ if ($option_decompress) {
14+ push(@mixed_options, "--decompress");
15+ } elsif ($option_decrypt) {
16+ push(@mixed_options, "--decrypt");
17+ }
18+
19+ if ($option_copy_back) {
20+ push(@mixed_options, "--copy-back");
21+ }
22+
23+ if ($option_move_back) {
24+ push(@mixed_options, "--move-back");
25+ }
26+
27+ if ($option_apply_log) {
28+ push(@mixed_options, "--apply-log");
29+ }
30+
31+ if (scalar(@mixed_options) > 1) {
32+ die join(' and ', @mixed_options) .
33+ " are mutually exclusive";
34 }
35
36 if ($option_compress == 0) {
37
38=== added file 'storage/innobase/xtrabackup/test/t/bug1376874.sh'
39--- storage/innobase/xtrabackup/test/t/bug1376874.sh 1970-01-01 00:00:00 +0000
40+++ storage/innobase/xtrabackup/test/t/bug1376874.sh 2014-10-08 13:20:03 +0000
41@@ -0,0 +1,21 @@
42+########################################################################
43+# Bug 1376874: --apply-log and --decompress aren't mutually exclusive
44+# Test checks different combinatinos of options
45+########################################################################
46+
47+run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} --decompress --apply-log backup
48+run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} --decompress --copy-back backup
49+run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} --decompress --move-back backup
50+
51+run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} --decrypt=test --apply-log backup
52+run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} --decrypt=test --copy-back backup
53+run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} --decrypt=test --move-back backup
54+
55+run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} --apply-log --copy-back backup
56+run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} --apply-log --move-back backup
57+
58+run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} --copy-back --move-back backup
59+
60+COUNT=$(grep -E -c -- "--[^ ]+ and --[^ ]+ are mutually exclusive" $OUTFILE)
61+echo $COUNT
62+[ "$COUNT" == "9" ]

Subscribers

People subscribed via source and target branches