Merge lp:~akopytov/percona-xtrabackup/bug1190716 into lp:percona-xtrabackup/2.1

Proposed by Alexey Kopytov
Status: Merged
Merged at revision: 610
Proposed branch: lp:~akopytov/percona-xtrabackup/bug1190716
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 45 lines (+17/-5)
2 files modified
innobackupex (+6/-5)
test/t/bug1190716.sh (+11/-0)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug1190716
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Registry Administrators Pending
Review via email: mp+169354@code.launchpad.net

Description of the change

    Bug #1190716: innobackupex --safe-slave-backup hangs when used on
                  master

    The problem was in uninitialized value usage in wait_for_safe_slave()
    when the server is not a replication slave, i.e. when no values in
    $con->{slave_status} are defined.

    Fixed by moving the check for $con->{slave_status}->{Slave_SQL_Running}
    after the check for $host_is_slave and checking if Slave_SQL_Running is
    defined when setting $host_is_slave for extra-safety.

http://jenkins.percona.com/view/XtraBackup/job/percona-xtrabackup-2.1-param/333/

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Approved with a re-push to fix -

"$sql_thread_started = 1" is indented differently from the rest of wait_for_safe_slave().

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 2013-05-22 10:25:21 +0000
3+++ innobackupex 2013-06-14 07:29:28 +0000
4@@ -2860,19 +2860,20 @@
5 $sql_thread_started = 0;
6 get_mysql_slave_status($con);
7
8- if (defined($con->{slave_status}->{Read_Master_Log_Pos})) {
9+ if (defined($con->{slave_status}->{Read_Master_Log_Pos}) and
10+ defined($con->{slave_status}->{Slave_SQL_Running})) {
11 $host_is_slave = 1;
12 }
13
14- if ($con->{slave_status}->{Slave_SQL_Running} =~ m/Yes/ ) {
15- $sql_thread_started = 1;
16- }
17-
18 if ( !$host_is_slave ) {
19 print STDERR "$prefix: Not checking slave open temp tables for --safe-slave-backup because host is not a slave\n";
20 return;
21 }
22
23+ if ($con->{slave_status}->{Slave_SQL_Running} =~ m/Yes/ ) {
24+ $sql_thread_started = 1;
25+ }
26+
27 if ($sql_thread_started) {
28 mysql_query($con, 'STOP SLAVE SQL_THREAD');
29 }
30
31=== added file 'test/t/bug1190716.sh'
32--- test/t/bug1190716.sh 1970-01-01 00:00:00 +0000
33+++ test/t/bug1190716.sh 2013-06-14 07:29:28 +0000
34@@ -0,0 +1,11 @@
35+##########################################################################
36+# Bug #1190716: innobackupex --safe-slave-backup hangs when used on master
37+##########################################################################
38+
39+. inc/common.sh
40+
41+start_server
42+
43+innobackupex --no-timestamp --safe-slave-backup $topdir/backup
44+
45+grep -q "Not checking slave open temp tables for --safe-slave-backup because host is not a slave" $OUTFILE

Subscribers

People subscribed via source and target branches

to all changes: