Merge lp:~akopytov/percona-xtrabackup/bug798488 into lp:percona-xtrabackup/2.0

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 278
Proposed branch: lp:~akopytov/percona-xtrabackup/bug798488
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 212 lines (+98/-17)
5 files modified
test/inc/common.sh (+20/-3)
test/run.sh (+44/-9)
test/t/xb_defaults_file.sh (+25/-0)
test/t/xb_stats.sh (+2/-5)
xtrabackup.c (+7/-0)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug798488
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+65206@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :
Revision history for this message
Stewart Smith (stewart) wrote :

On Mon, 20 Jun 2011 14:27:10 -0000, Alexey Kopytov <email address hidden> wrote:
> http://jenkins.percona.com/view/Percona%20Xtrabackup/job/percona-xtrabackup-param/26/

Possibly need to merge trunk?

http://jenkins.percona.com/view/Percona%20Xtrabackup/job/percona-xtrabackup-param/26/Host=ubuntu-lucid-32bit,xtrabackuptarget=innodb51/console

2011-06-20 14:03:18: run.sh: Cannot find 'xtrabackup_51' in PATH

(and should we have this for 1.6.2?)
--
Stewart Smith

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

Trunk is already merged. innodb51 is broken in trunk as well which is a separate issue. It's just that in trunk we have all individual tests failing, but in this branch the problem is detected by run.sh before running tests.

As for 1.6.2. The problem is not critical for the customer, and an easy workaround exists, so it should rather be Low as discussed on IRC. Will update the bug.

Revision history for this message
Stewart Smith (stewart) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test/inc/common.sh'
2--- test/inc/common.sh 2011-06-15 07:04:42 +0000
3+++ test/inc/common.sh 2011-06-20 15:49:26 +0000
4@@ -4,12 +4,12 @@
5
6 function innobackupex()
7 {
8- run_cmd `which innobackupex` $IB_ARGS $*
9+ run_cmd $IB_BIN $IB_ARGS $*
10 }
11
12 function xtrabackup()
13 {
14- run_cmd `which $XB_BIN` $XB_ARGS $*
15+ run_cmd $XB_BIN $XB_ARGS $*
16 }
17
18 function vlog
19@@ -129,7 +129,24 @@
20 function run_cmd()
21 {
22 vlog "===> $@"
23- "$@" || die "===> `basename $1` failed with exit code $?"
24+ "$@"
25+ if [ $? -ne 0 ]
26+ then
27+ die "===> `basename $1` failed with exit code $?"
28+ fi
29+}
30+
31+function run_cmd_expect_failure()
32+{
33+ vlog "===> $@"
34+ set +e
35+ "$@"
36+ local rc=$?
37+ set -e
38+ if [ $rc -eq 0 ]
39+ then
40+ die "===> `basename $1` succeeded when it was expected to fail"
41+ fi
42 }
43
44 function stop_mysqld()
45
46=== modified file 'test/run.sh'
47--- test/run.sh 2011-06-15 07:04:42 +0000
48+++ test/run.sh 2011-06-20 15:49:26 +0000
49@@ -94,10 +94,10 @@
50
51 function get_version_info()
52 {
53- init
54+ init >>$OUTFILE 2>&1
55 MYSQL_VERSION=""
56 INNODB_VERSION=""
57- run_mysqld
58+ run_mysqld >>$OUTFILE 2>&1
59 # Get MySQL and InnoDB versions
60 MYSQL_VERSION=`$MYSQL ${MYSQL_ARGS} -Nsf -e "SHOW VARIABLES LIKE 'version'"`
61 MYSQL_VERSION=${MYSQL_VERSION#"version "}
62@@ -105,7 +105,7 @@
63 MYSQL_VERSION_COMMENT=${MYSQL_VERSION_COMMENT#"version_comment "}
64 INNODB_VERSION=`$MYSQL ${MYSQL_ARGS} -Nsf -e "SHOW VARIABLES LIKE 'innodb_version'"`
65 INNODB_VERSION=${INNODB_VERSION#"innodb_version "}
66- XTRADB_VERSION=`echo $INNODB_VERSION | sed 's/[0-9]\.[0-9]\.[0-9][0-9]*\(-[0-9][0-9]*\.[0-9][0-9]*\)*$/\1/'`
67+ XTRADB_VERSION="`echo $INNODB_VERSION | sed 's/[0-9]\.[0-9]\.[0-9][0-9]*\(-[0-9][0-9]*\.[0-9][0-9]*\)*$/\1/'`"
68 if [ "${MYSQL_VERSION:0:3}" = "5.1" ]
69 then
70 if [ -z "$INNODB_VERSION" ]
71@@ -126,11 +126,26 @@
72 vlog "Uknown MySQL/InnoDB version: $MYSQL_VERSION/$INNODB_VERSION"
73 exit -1
74 fi
75- vlog "Using '$XB_BIN' as xtrabackup binary"
76- # Set the correct binary for innobackupex
77+
78+ XB_PATH="`which $XB_BIN`"
79+ if [ -z "$XB_PATH" ]
80+ then
81+ vlog "Cannot find '$XB_BIN' in PATH"
82+ return 1
83+ fi
84+ XB_BIN="$XB_PATH"
85+ vlog "Using '$`basename $XB_BIN`' as xtrabackup binary"
86+
87+ IB_BIN="`which innobackupex`"
88+ if [ -z "$IB_BIN" ]
89+ then
90+ vlog "Cannot find 'innobackupex' in PATH"
91+ return 1
92+ fi
93 IB_ARGS="$IB_ARGS --ibbackup=$XB_BIN"
94
95- export MYSQL_VERSION/ MYSQL_VERSION_COMMENT INNODB_VERSION XTRADB_VERSION XB_BIN
96+ export MYSQL_VERSION MYSQL_VERSION_COMMENT INNODB_VERSION XTRADB_VERSION \
97+ XB_BIN IB_BIN
98 }
99
100 tname=""
101@@ -163,15 +178,32 @@
102 total_count=0
103
104 export OUTFILE="$PWD/results/setup"
105-get_version_info >$OUTFILE 2>&1
106-kill_leftovers >$OUTFILE 2>&1
107-clean >$OUTFILE 2>&1
108+
109+if ! get_version_info
110+then
111+ echo "get_version_info failed. See $OUTFILE for details."
112+ exit -1
113+fi
114+
115+if [ -n "$XTRADB_VERSION" ]
116+then
117+ echo "Running against Percona Server $MYSQL_VERSION (XtraDB $INNODB_VERSION)"
118+else
119+ echo "Running against MySQL $MYSQL_VERSION (InnoDB $INNODB_VERSION)"
120+fi
121+echo "Using '`basename $XB_BIN`' as xtrabackup binary"
122+echo
123+
124+kill_leftovers >>$OUTFILE 2>&1
125+clean >>$OUTFILE 2>&1
126
127 source subunit.sh
128
129 SUBUNIT_OUT=test_results.subunit
130 rm -f $SUBUNIT_OUT
131
132+echo "========================================================================"
133+
134 for t in $tests
135 do
136 printf "%-40s" $t
137@@ -212,6 +244,9 @@
138 total_count=$((total_count+1))
139 done
140
141+echo "========================================================================"
142+echo
143+
144 kill_leftovers
145
146 if [ $result -eq 1 ]
147
148=== added file 'test/t/xb_defaults_file.sh'
149--- test/t/xb_defaults_file.sh 1970-01-01 00:00:00 +0000
150+++ test/t/xb_defaults_file.sh 2011-06-20 15:49:26 +0000
151@@ -0,0 +1,25 @@
152+#
153+# Bug #798488: xtrabackup ignores defaults-file in apply-log-only prepare mode
154+#
155+# Test xtrabackup fails with an error when --defaults-file is not the first argument
156+# on the command line (and thus would be ignored).
157+
158+. inc/common.sh
159+
160+init
161+run_mysqld
162+
163+# The following should succeed (can't use xtrabackup directly as it uses
164+# --no-defaults)
165+run_cmd $XB_BIN --defaults-file=$topdir/my.cnf --backup \
166+ --datadir=$mysql_datadir --target-dir=$topdir/backup
167+
168+rm -rf $topdir/backup
169+
170+# The following should fail (can't use xtrabackup directly as that would make
171+# the test fail)
172+
173+run_cmd_expect_failure $XB_BIN --backup --defaults-file=$topdir/my.cnf \
174+ --datadir=$mysql_datadir --target-dir=$topdir/backup
175+
176+exit 0
177
178=== modified file 'test/t/xb_stats.sh'
179--- test/t/xb_stats.sh 2011-06-10 07:55:26 +0000
180+++ test/t/xb_stats.sh 2011-06-20 15:49:26 +0000
181@@ -15,11 +15,8 @@
182 # when trying to get stats before creating the log files
183
184 vlog "===> xtrabackup --stats --datadir=$topdir/backup"
185-# Cannot use run_cmd here
186-if $XB_BIN $XB_ARGS --stats --datadir=$topdir/backup >$OUTFILE 2>&1
187-then
188- die "xtrabackup --stats was expected to fail, but it did not."
189-fi
190+run_cmd_expect_failure $XB_BIN $XB_ARGS --stats --datadir=$topdir/backup
191+
192 if ! grep "Cannot find log file ib_logfile0" $OUTFILE
193 then
194 die "Cannot find the expected error message from xtrabackup --stats"
195
196=== modified file 'xtrabackup.c'
197--- xtrabackup.c 2011-06-15 07:04:42 +0000
198+++ xtrabackup.c 2011-06-20 15:49:26 +0000
199@@ -5935,6 +5935,13 @@
200 uint count;
201 struct my_option *opt= (struct my_option *) my_long_options;
202 optend= strcend((argv)[i], '=');
203+ if (!strncmp(argv[i], "--defaults-file", optend - argv[i]))
204+ {
205+ fprintf(stderr, "xtrabackup: Error: --defaults-file "
206+ "must be specified first on the command "
207+ "line\n");
208+ exit(EXIT_FAILURE);
209+ }
210 for (count= 0; opt->name; opt++) {
211 if (!getopt_compare_strings(opt->name, (argv)[i] + 2,
212 (uint)(optend - (argv)[i] - 2))) /* match found */

Subscribers

People subscribed via source and target branches