Merge lp:~akopytov/percona-xtrabackup/bug514068-1.6 into lp:percona-xtrabackup/1.6

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 310
Proposed branch: lp:~akopytov/percona-xtrabackup/bug514068-1.6
Merge into: lp:percona-xtrabackup/1.6
Diff against target: 387 lines (+99/-60)
10 files modified
innobackupex (+13/-11)
test/t/bug514068.sh (+30/-0)
test/t/bug817132.sh (+3/-3)
test/t/ib_csm_csv.sh (+9/-9)
test/t/ib_specialchar.sh (+9/-9)
test/t/xb_basic.sh (+9/-9)
test/t/xb_parallel.sh (+9/-9)
test/t/xb_stats.sh (+1/-1)
test/t/xb_stream.sh (+8/-8)
xtrabackup.c (+8/-1)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug514068-1.6
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+84905@code.launchpad.net

Description of the change

Fixes for bug #514068 and sporadic failures in Jenkins.

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) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innobackupex'
2--- innobackupex 2011-12-02 08:36:03 +0000
3+++ innobackupex 2011-12-08 09:19:24 +0000
4@@ -12,7 +12,6 @@
5 use Pod::Usage qw(pod2usage);
6 use POSIX "strftime";
7 use POSIX ":sys_wait_h";
8-# use POSIX "tmpnam";
9 use FileHandle;
10 use File::Basename;
11 use File::Temp;
12@@ -235,10 +234,10 @@
13 else {
14 if( $option_ibbackup_binary eq "autodetect" ){
15 # Try to connect MySQL and get the version
16- print "option_ibbackup_binary is autodetect, trying to connect to MySQL\n";
17+ print STDERR "option_ibbackup_binary is autodetect, trying to connect to MySQL\n";
18 my $options = get_mysql_options();
19 $mysql_pid = open(*MYSQL_WRITER, "| mysql $options >$mysql_stdout 2>$mysql_stderr ");
20- print "Connected to MySQL with pid $mysql_pid\n";
21+ print STDERR "Connected to MySQL with pid $mysql_pid\n";
22 sleep 1;
23 if ($mysql_pid && $mysql_pid == waitpid($mysql_pid, &WNOHANG)) {
24 my $reason = `cat $mysql_stderr`;
25@@ -248,7 +247,7 @@
26 }
27 else{
28 mysql_close();
29- print "Connected successfully\n";
30+ print STDERR "Connected successfully\n";
31 $option_ibbackup_binary = set_xtrabackup_version();
32 }
33 }
34@@ -996,6 +995,7 @@
35 # Check that the server is responding to queries
36 #
37 sub mysql_ping {
38+ my $alarm_handler = shift;
39 my $mysql_pid_copy = $mysql_pid;
40
41 # send a dummy query to mysql child process
42@@ -1005,6 +1005,12 @@
43 print MYSQL_WRITER "select '$hello_message';\n"
44 or Die "Connection to mysql child process failed: $!";
45
46+ # Don't check server's response if running in a signal handler
47+ # because that breaks system() calls
48+ if ($alarm_handler)
49+ {
50+ return 0;
51+ }
52 # wait for reply
53 eval {
54 local $SIG{ALRM} = sub { die "alarm clock restart" };
55@@ -1040,7 +1046,7 @@
56 # SIGALRM handler which sends a keepalive query to the server
57 #
58 sub catch_sigalrm {
59- mysql_ping();
60+ mysql_ping(1);
61 # Reschedule SIGALRM
62 alarm $mysql_keep_alive;
63 }
64@@ -1077,7 +1083,7 @@
65 $now = current_time();
66 print STDERR "$now $prefix Connected to database with mysql child process (pid=$mysql_pid)\n";
67
68- mysql_ping();
69+ mysql_ping(0);
70
71 start_keepalives();
72 }
73@@ -1097,7 +1103,7 @@
74
75 $current_mysql_request = $request;
76 print MYSQL_WRITER "$request\n";
77- mysql_ping();
78+ mysql_ping(0);
79 $current_mysql_request = '';
80
81 start_keepalives();
82@@ -1700,10 +1706,6 @@
83 } else {
84 $incremental_basedir = File::Spec->catfile($backup_root, $inc_dir);
85 }
86-
87- #print STDERR "--incremental_basedir=$incremental_basedir\n";
88- #print STDERR "incremental backup is not supported for now.\n";
89- #exit(1);
90 }
91 } else {
92 # get backup directory
93
94=== added file 'test/t/bug514068.sh'
95--- test/t/bug514068.sh 1970-01-01 00:00:00 +0000
96+++ test/t/bug514068.sh 2011-12-08 09:19:24 +0000
97@@ -0,0 +1,30 @@
98+##################################################################
99+# Bug #514068: Output to STDOUT and STDERR is not conventional #
100+# Bug #741021: xtrabackup --prepare prints a few lines to stdout #
101+##################################################################
102+
103+. inc/common.sh
104+
105+init
106+run_mysqld
107+
108+innobackupex --no-timestamp $topdir/backup >$topdir/stdout 2>$topdir/stderr
109+
110+stop_mysqld
111+# Remove datadir
112+rm -r $mysql_datadir
113+
114+# Restore sakila
115+vlog "Applying log"
116+innobackupex --apply-log $topdir/backup >>$topdir/stdout 2>>$topdir/stderr
117+
118+vlog "Restoring MySQL datadir"
119+mkdir -p $mysql_datadir
120+innobackupex --copy-back $topdir/backup >>$topdir/stdout 2>>$topdir/stderr
121+
122+if [ "`wc -l $topdir/stdout`" -gt 0 ]
123+then
124+ vlog "Got the following output on stdout:"
125+ cat $topdir/stdout
126+ exit -1
127+fi
128
129=== modified file 'test/t/bug817132.sh'
130--- test/t/bug817132.sh 2011-09-12 10:05:36 +0000
131+++ test/t/bug817132.sh 2011-12-08 09:19:24 +0000
132@@ -18,7 +18,7 @@
133 load_dbase_data sakila
134
135 mkdir -p $topdir/backup
136-innobackupex $topdir/backup > $OUTFILE 2>&1
137+innobackupex $topdir/backup
138 backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
139 vlog "Backup created in directory $backup_dir"
140
141@@ -28,14 +28,14 @@
142
143 # Restore sakila
144 vlog "Applying log"
145-innobackupex --apply-log $backup_dir >> $OUTFILE 2>&1
146+innobackupex --apply-log $backup_dir
147 vlog "Restoring MySQL datadir"
148 mkdir -p $mysql_datadir
149
150 # The following would fail before #817132 was fixed.
151 # Cannot use innobackupex here, because that would specify
152 # --ibbackup explicitly (see $IB_ARGS).
153-run_cmd $IB_BIN --defaults-file=$topdir/my.cnf --user=root --socket=$mysql_socket --copy-back $backup_dir >> $OUTFILE 2>&1
154+run_cmd $IB_BIN --defaults-file=$topdir/my.cnf --user=root --socket=$mysql_socket --copy-back $backup_dir
155
156 run_mysqld
157 # Check sakila
158
159=== modified file 'test/t/ib_csm_csv.sh'
160--- test/t/ib_csm_csv.sh 2011-09-14 12:48:27 +0000
161+++ test/t/ib_csm_csv.sh 2011-12-08 09:19:24 +0000
162@@ -20,7 +20,7 @@
163 mkdir -p $topdir/backup
164
165 vlog "Starting backup"
166-innobackupex $topdir/backup > $OUTFILE 2>&1
167+innobackupex $topdir/backup
168 full_backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{print $2}'`
169 vlog "Full backup done to directory $full_backup_dir"
170
171@@ -30,10 +30,10 @@
172
173 vlog "Preparing backup"
174 # Prepare backup
175-echo "###########" >> $OUTFILE
176-echo "# PREPARE #" >> $OUTFILE
177-echo "###########" >> $OUTFILE
178-innobackupex --apply-log $full_backup_dir >> $OUTFILE 2>&1
179+vlog "###########"
180+vlog "# PREPARE #"
181+vlog "###########"
182+innobackupex --apply-log $full_backup_dir
183 vlog "Data prepared for restore"
184
185 # Destroying mysql data
186@@ -43,10 +43,10 @@
187
188 # Restore backup
189 vlog "Copying files"
190-echo "###########" >> $OUTFILE
191-echo "# RESTORE #" >> $OUTFILE
192-echo "###########" >> $OUTFILE
193-innobackupex --copy-back $full_backup_dir >> $OUTFILE 2>&1
194+vlog "###########"
195+vlog "# RESTORE #"
196+vlog "###########"
197+innobackupex --copy-back $full_backup_dir
198 vlog "Data restored"
199
200 run_mysqld --innodb_file_per_table
201
202=== modified file 'test/t/ib_specialchar.sh'
203--- test/t/ib_specialchar.sh 2011-06-10 06:11:56 +0000
204+++ test/t/ib_specialchar.sh 2011-12-08 09:19:24 +0000
205@@ -14,7 +14,7 @@
206 vlog "mysql password has been changed to contain special char"
207
208 vlog "Starting innobackupex wrapper"
209-innobackupex --password='$PASSWD' $topdir/backup > $OUTFILE 2>&1
210+innobackupex --password='$PASSWD' $topdir/backup
211 backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
212
213 run_cmd ${MYSQLADMIN} ${MYSQL_ARGS} -p'$PASSWD' password ''
214@@ -26,17 +26,17 @@
215 rm -r $mysql_datadir
216 # Restore sakila
217 vlog "Applying log"
218-echo "###########" >> $OUTFILE
219-echo "# PREPARE #" >> $OUTFILE
220-echo "###########" >> $OUTFILE
221-innobackupex --apply-log $backup_dir >> $OUTFILE 2>&1
222+vlog "###########"
223+vlog "# PREPARE #"
224+vlog "###########"
225+innobackupex --apply-log $backup_dir
226 vlog "Restoring MySQL datadir"
227 mkdir -p $mysql_datadir
228 vlog "Performing copyback"
229-echo "###########" >> $OUTFILE
230-echo "# PREPARE #" >> $OUTFILE
231-echo "###########" >> $OUTFILE
232-innobackupex --copy-back $backup_dir >> $OUTFILE 2>&1
233+vlog "###########"
234+vlog "# PREPARE #"
235+vlog "###########"
236+innobackupex --copy-back $backup_dir
237
238 vlog "Starting database server"
239 # using --skip-grant-tables to override root password restored from backup
240
241=== modified file 'test/t/xb_basic.sh'
242--- test/t/xb_basic.sh 2011-06-10 06:11:56 +0000
243+++ test/t/xb_basic.sh 2011-12-08 09:19:24 +0000
244@@ -6,7 +6,7 @@
245 load_dbase_data sakila
246
247 mkdir -p $topdir/backup
248-innobackupex $topdir/backup > $OUTFILE 2>&1
249+innobackupex $topdir/backup
250 backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
251 vlog "Backup created in directory $backup_dir"
252
253@@ -16,16 +16,16 @@
254 #init_mysql_dir
255 # Restore sakila
256 vlog "Applying log"
257-echo "###########" >> $OUTFILE
258-echo "# PREPARE #" >> $OUTFILE
259-echo "###########" >> $OUTFILE
260-innobackupex --apply-log $backup_dir >> $OUTFILE 2>&1
261+vlog "###########"
262+vlog "# PREPARE #"
263+vlog "###########"
264+innobackupex --apply-log $backup_dir
265 vlog "Restoring MySQL datadir"
266 mkdir -p $mysql_datadir
267-echo "###########" >> $OUTFILE
268-echo "# RESTORE #" >> $OUTFILE
269-echo "###########" >> $OUTFILE
270-innobackupex --copy-back $backup_dir >> $OUTFILE 2>&1
271+vlog "###########"
272+vlog "# RESTORE #"
273+vlog "###########"
274+innobackupex --copy-back $backup_dir
275
276 run_mysqld
277 # Check sakila
278
279=== modified file 'test/t/xb_parallel.sh'
280--- test/t/xb_parallel.sh 2011-06-10 06:11:56 +0000
281+++ test/t/xb_parallel.sh 2011-12-08 09:19:24 +0000
282@@ -8,7 +8,7 @@
283 # Take backup
284 vlog "Creating the backup directory: $topdir/backup"
285 mkdir -p $topdir/backup
286-innobackupex $topdir/backup --parallel=8 > $OUTFILE 2>&1
287+innobackupex $topdir/backup --parallel=8
288 backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
289
290 #echo "Backup dir in $backup_dir"
291@@ -18,16 +18,16 @@
292 rm -r $mysql_datadir
293 # Restore sakila
294 vlog "Applying log"
295-echo "###########" >> $OUTFILE
296-echo "# PREPARE #" >> $OUTFILE
297-echo "###########" >> $OUTFILE
298-innobackupex --apply-log $backup_dir >> $OUTFILE 2>&1
299+vlog "###########"
300+vlog "# PREPARE #"
301+vlog "###########"
302+innobackupex --apply-log $backup_dir
303 vlog "Restoring MySQL datadir"
304 mkdir -p $mysql_datadir
305-echo "###########" >> $OUTFILE
306-echo "# RESTORE #" >> $OUTFILE
307-echo "###########" >> $OUTFILE
308-innobackupex --copy-back $backup_dir >> $OUTFILE 2>&1
309+vlog "###########"
310+vlog "# RESTORE #"
311+vlog "###########"
312+innobackupex --copy-back $backup_dir
313
314 run_mysqld
315 # Check sakila
316
317=== modified file 'test/t/xb_stats.sh'
318--- test/t/xb_stats.sh 2011-06-10 06:11:56 +0000
319+++ test/t/xb_stats.sh 2011-12-08 09:19:24 +0000
320@@ -16,7 +16,7 @@
321
322 vlog "===> xtrabackup --stats --datadir=$topdir/backup"
323 # Cannot use run_cmd here
324-if $XB_BIN $XB_ARGS --stats --datadir=$topdir/backup >$OUTFILE 2>&1
325+if $XB_BIN $XB_ARGS --stats --datadir=$topdir/backup
326 then
327 die "xtrabackup --stats was expected to fail, but it did not."
328 fi
329
330=== modified file 'test/t/xb_stream.sh'
331--- test/t/xb_stream.sh 2011-06-14 13:33:54 +0000
332+++ test/t/xb_stream.sh 2011-12-08 09:19:24 +0000
333@@ -7,7 +7,7 @@
334
335 # Take backup
336 mkdir -p $topdir/backup
337-innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar 2> $OUTFILE
338+innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
339
340 stop_mysqld
341 # Remove datadir
342@@ -18,15 +18,15 @@
343 cd $backup_dir
344 $TAR -ixvf out.tar
345 cd - >/dev/null 2>&1
346-echo "###########" >> $OUTFILE
347-echo "# PREPARE #" >> $OUTFILE
348-echo "###########" >> $OUTFILE
349-innobackupex --apply-log $backup_dir >> $OUTFILE 2>&1
350+vlog "###########"
351+vlog "# PREPARE #"
352+vlog "###########"
353+innobackupex --apply-log $backup_dir
354 vlog "Restoring MySQL datadir"
355 mkdir -p $mysql_datadir
356-echo "###########" >> $OUTFILE
357-echo "# RESTORE #" >> $OUTFILE
358-echo "###########" >> $OUTFILE
359+vlog "###########"
360+vlog "# RESTORE #"
361+vlog "###########"
362 innobackupex --copy-back $backup_dir
363
364 run_mysqld
365
366=== modified file 'xtrabackup.c'
367--- xtrabackup.c 2011-11-28 12:43:46 +0000
368+++ xtrabackup.c 2011-12-08 09:19:24 +0000
369@@ -6036,10 +6036,17 @@
370 if ((!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {
371 if (!xtrabackup_print_param)
372 usage();
373- printf("\nxtrabackup: Error: Please set parameter 'datadir'\n");
374+ fprintf(stderr, "\n"
375+ "xtrabackup: Error: Please set parameter 'datadir'\n");
376 exit(EXIT_FAILURE);
377 }
378
379+ /* Redirect stdout to stderr for not doing a streaming backup or dumping
380+ configuration for --print-param. */
381+ if (!xtrabackup_stream && !xtrabackup_print_param && dup2(2, 1) < 0) {
382+ fprintf(stderr, "Failed to redirect standard output.\n");
383+ }
384+
385 if (xtrabackup_tables) {
386 /* init regexp */
387 char *p, *next;

Subscribers

People subscribed via source and target branches