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
=== modified file 'innobackupex'
--- innobackupex 2011-12-02 08:37:09 +0000
+++ innobackupex 2011-12-08 10:32:24 +0000
@@ -12,7 +12,6 @@
12use Pod::Usage qw(pod2usage);12use Pod::Usage qw(pod2usage);
13use POSIX "strftime";13use POSIX "strftime";
14use POSIX ":sys_wait_h";14use POSIX ":sys_wait_h";
15# use POSIX "tmpnam";
16use FileHandle;15use FileHandle;
17use File::Basename;16use File::Basename;
18use File::Temp;17use File::Temp;
@@ -235,10 +234,10 @@
235 else {234 else {
236 if( $option_ibbackup_binary eq "autodetect" ){235 if( $option_ibbackup_binary eq "autodetect" ){
237 # Try to connect MySQL and get the version236 # Try to connect MySQL and get the version
238 print "option_ibbackup_binary is autodetect, trying to connect to MySQL\n";237 print STDERR "option_ibbackup_binary is autodetect, trying to connect to MySQL\n";
239 my $options = get_mysql_options();238 my $options = get_mysql_options();
240 $mysql_pid = open(*MYSQL_WRITER, "| mysql $options >$mysql_stdout 2>$mysql_stderr ");239 $mysql_pid = open(*MYSQL_WRITER, "| mysql $options >$mysql_stdout 2>$mysql_stderr ");
241 print "Connected to MySQL with pid $mysql_pid\n";240 print STDERR "Connected to MySQL with pid $mysql_pid\n";
242 sleep 1;241 sleep 1;
243 if ($mysql_pid && $mysql_pid == waitpid($mysql_pid, &WNOHANG)) {242 if ($mysql_pid && $mysql_pid == waitpid($mysql_pid, &WNOHANG)) {
244 my $reason = `cat $mysql_stderr`;243 my $reason = `cat $mysql_stderr`;
@@ -248,7 +247,7 @@
248 }247 }
249 else{248 else{
250 mysql_close();249 mysql_close();
251 print "Connected successfully\n";250 print STDERR "Connected successfully\n";
252 $option_ibbackup_binary = set_xtrabackup_version();251 $option_ibbackup_binary = set_xtrabackup_version();
253 }252 }
254 }253 }
@@ -1009,6 +1008,7 @@
1009# Check that the server is responding to queries1008# Check that the server is responding to queries
1010#1009#
1011sub mysql_ping {1010sub mysql_ping {
1011 my $alarm_handler = shift;
1012 my $mysql_pid_copy = $mysql_pid;1012 my $mysql_pid_copy = $mysql_pid;
10131013
1014 # send a dummy query to mysql child process1014 # send a dummy query to mysql child process
@@ -1018,6 +1018,12 @@
1018 print MYSQL_WRITER "select '$hello_message';\n" 1018 print MYSQL_WRITER "select '$hello_message';\n"
1019 or Die "Connection to mysql child process failed: $!";1019 or Die "Connection to mysql child process failed: $!";
10201020
1021 # Don't check server's response if running in a signal handler
1022 # because that breaks system() calls
1023 if ($alarm_handler)
1024 {
1025 return 0;
1026 }
1021 # wait for reply1027 # wait for reply
1022 eval {1028 eval {
1023 local $SIG{ALRM} = sub { die "alarm clock restart" };1029 local $SIG{ALRM} = sub { die "alarm clock restart" };
@@ -1053,7 +1059,7 @@
1053# SIGALRM handler which sends a keepalive query to the server1059# SIGALRM handler which sends a keepalive query to the server
1054#1060#
1055sub catch_sigalrm {1061sub catch_sigalrm {
1056 mysql_ping();1062 mysql_ping(1);
1057 # Reschedule SIGALRM1063 # Reschedule SIGALRM
1058 alarm $mysql_keep_alive;1064 alarm $mysql_keep_alive;
1059}1065}
@@ -1091,7 +1097,7 @@
1091 print STDERR "$now $prefix Connected to database with mysql child process (pid=$mysql_pid)\n";1097 print STDERR "$now $prefix Connected to database with mysql child process (pid=$mysql_pid)\n";
1092 print MYSQL_WRITER "SET SESSION wait_timeout = 2147000;\n" or die "Connection to mysql child process failed: $!";1098 print MYSQL_WRITER "SET SESSION wait_timeout = 2147000;\n" or die "Connection to mysql child process failed: $!";
10931099
1094 mysql_ping();1100 mysql_ping(0);
10951101
1096 start_keepalives();1102 start_keepalives();
1097}1103}
@@ -1111,7 +1117,7 @@
11111117
1112 $current_mysql_request = $request;1118 $current_mysql_request = $request;
1113 print MYSQL_WRITER "$request\n";1119 print MYSQL_WRITER "$request\n";
1114 mysql_ping();1120 mysql_ping(0);
1115 $current_mysql_request = '';1121 $current_mysql_request = '';
11161122
1117 start_keepalives();1123 start_keepalives();
@@ -1714,10 +1720,6 @@
1714 } else {1720 } else {
1715 $incremental_basedir = File::Spec->catfile($backup_root, $inc_dir);1721 $incremental_basedir = File::Spec->catfile($backup_root, $inc_dir);
1716 }1722 }
1717
1718 #print STDERR "--incremental_basedir=$incremental_basedir\n";
1719 #print STDERR "incremental backup is not supported for now.\n";
1720 #exit(1);
1721 }1723 }
1722 } else {1724 } else {
1723 # get backup directory1725 # get backup directory
17241726
=== added file 'test/t/bug514068.sh'
--- test/t/bug514068.sh 1970-01-01 00:00:00 +0000
+++ test/t/bug514068.sh 2011-12-08 10:32:24 +0000
@@ -0,0 +1,30 @@
1##################################################################
2# Bug #514068: Output to STDOUT and STDERR is not conventional #
3# Bug #741021: xtrabackup --prepare prints a few lines to stdout #
4##################################################################
5
6. inc/common.sh
7
8init
9run_mysqld
10
11innobackupex --no-timestamp $topdir/backup >$topdir/stdout 2>$topdir/stderr
12
13stop_mysqld
14# Remove datadir
15rm -r $mysql_datadir
16
17# Restore sakila
18vlog "Applying log"
19innobackupex --apply-log $topdir/backup >>$topdir/stdout 2>>$topdir/stderr
20
21vlog "Restoring MySQL datadir"
22mkdir -p $mysql_datadir
23innobackupex --copy-back $topdir/backup >>$topdir/stdout 2>>$topdir/stderr
24
25if [ "`wc -l $topdir/stdout`" -gt 0 ]
26then
27 vlog "Got the following output on stdout:"
28 cat $topdir/stdout
29 exit -1
30fi
031
=== modified file 'xtrabackup.c'
--- xtrabackup.c 2011-11-28 12:46:36 +0000
+++ xtrabackup.c 2011-12-08 10:32:24 +0000
@@ -6201,10 +6201,17 @@
6201 if ((!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {6201 if ((!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {
6202 if (!xtrabackup_print_param)6202 if (!xtrabackup_print_param)
6203 usage();6203 usage();
6204 printf("\nxtrabackup: Error: Please set parameter 'datadir'\n");6204 fprintf(stderr, "\n"
6205 "xtrabackup: Error: Please set parameter 'datadir'\n");
6205 exit(EXIT_FAILURE);6206 exit(EXIT_FAILURE);
6206 }6207 }
62076208
6209 /* Redirect stdout to stderr for not doing a streaming backup or dumping
6210 configuration for --print-param. */
6211 if (!xtrabackup_stream && !xtrabackup_print_param && dup2(2, 1) < 0) {
6212 fprintf(stderr, "Failed to redirect standard output.\n");
6213 }
6214
6208 if (xtrabackup_tables) {6215 if (xtrabackup_tables) {
6209 /* init regexp */6216 /* init regexp */
6210 char *p, *next;6217 char *p, *next;

Subscribers

People subscribed via source and target branches