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
=== modified file 'innobackupex'
--- innobackupex 2013-05-22 10:25:21 +0000
+++ innobackupex 2013-06-14 07:29:28 +0000
@@ -2860,19 +2860,20 @@
2860 $sql_thread_started = 0;2860 $sql_thread_started = 0;
2861 get_mysql_slave_status($con);2861 get_mysql_slave_status($con);
28622862
2863 if (defined($con->{slave_status}->{Read_Master_Log_Pos})) {2863 if (defined($con->{slave_status}->{Read_Master_Log_Pos}) and
2864 defined($con->{slave_status}->{Slave_SQL_Running})) {
2864 $host_is_slave = 1;2865 $host_is_slave = 1;
2865 }2866 }
28662867
2867 if ($con->{slave_status}->{Slave_SQL_Running} =~ m/Yes/ ) {
2868 $sql_thread_started = 1;
2869 }
2870
2871 if ( !$host_is_slave ) {2868 if ( !$host_is_slave ) {
2872 print STDERR "$prefix: Not checking slave open temp tables for --safe-slave-backup because host is not a slave\n";2869 print STDERR "$prefix: Not checking slave open temp tables for --safe-slave-backup because host is not a slave\n";
2873 return;2870 return;
2874 }2871 }
28752872
2873 if ($con->{slave_status}->{Slave_SQL_Running} =~ m/Yes/ ) {
2874 $sql_thread_started = 1;
2875 }
2876
2876 if ($sql_thread_started) {2877 if ($sql_thread_started) {
2877 mysql_query($con, 'STOP SLAVE SQL_THREAD');2878 mysql_query($con, 'STOP SLAVE SQL_THREAD');
2878 }2879 }
28792880
=== added file 'test/t/bug1190716.sh'
--- test/t/bug1190716.sh 1970-01-01 00:00:00 +0000
+++ test/t/bug1190716.sh 2013-06-14 07:29:28 +0000
@@ -0,0 +1,11 @@
1##########################################################################
2# Bug #1190716: innobackupex --safe-slave-backup hangs when used on master
3##########################################################################
4
5. inc/common.sh
6
7start_server
8
9innobackupex --no-timestamp --safe-slave-backup $topdir/backup
10
11grep -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: