Merge lp:~akopytov/percona-xtrabackup/bug514068-1.7 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: 343
Proposed branch: lp:~akopytov/percona-xtrabackup/bug514068-1.7
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 150 lines (+51/-12)
3 files modified
innobackupex (+13/-11)
test/t/bug514068.sh (+30/-0)
xtrabackup.c (+8/-1)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug514068-1.7
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+84917@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:37:09 +0000
3+++ innobackupex 2011-12-08 10:32: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@@ -1009,6 +1008,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@@ -1018,6 +1018,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@@ -1053,7 +1059,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@@ -1091,7 +1097,7 @@
65 print STDERR "$now $prefix Connected to database with mysql child process (pid=$mysql_pid)\n";
66 print MYSQL_WRITER "SET SESSION wait_timeout = 2147000;\n" or die "Connection to mysql child process failed: $!";
67
68- mysql_ping();
69+ mysql_ping(0);
70
71 start_keepalives();
72 }
73@@ -1111,7 +1117,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@@ -1714,10 +1720,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 10:32: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 'xtrabackup.c'
130--- xtrabackup.c 2011-11-28 12:46:36 +0000
131+++ xtrabackup.c 2011-12-08 10:32:24 +0000
132@@ -6201,10 +6201,17 @@
133 if ((!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {
134 if (!xtrabackup_print_param)
135 usage();
136- printf("\nxtrabackup: Error: Please set parameter 'datadir'\n");
137+ fprintf(stderr, "\n"
138+ "xtrabackup: Error: Please set parameter 'datadir'\n");
139 exit(EXIT_FAILURE);
140 }
141
142+ /* Redirect stdout to stderr for not doing a streaming backup or dumping
143+ configuration for --print-param. */
144+ if (!xtrabackup_stream && !xtrabackup_print_param && dup2(2, 1) < 0) {
145+ fprintf(stderr, "Failed to redirect standard output.\n");
146+ }
147+
148 if (xtrabackup_tables) {
149 /* init regexp */
150 char *p, *next;

Subscribers

People subscribed via source and target branches