Skip to content

Commit

Permalink
* Bug fix: Fix for aborting by UUV if errstr is empty (rare cases)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshinorim committed Sep 16, 2011
1 parent c3d2a88 commit 19e4332
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 34 deletions.
60 changes: 28 additions & 32 deletions lib/MHA/Server.pm
Expand Up @@ -230,12 +230,10 @@ sub connect_and_get_status {
$self->{not_slave} = 1;
}
elsif ($sstatus) {
$log->error(
sprintf(
"Checking slave status failed on %s. err= %s",
$self->get_hostinfo(), $status{Errstr}
)
);
my $msg =
sprintf( "Checking slave status failed on %s.", $self->get_hostinfo() );
$msg .= " err=$status{Errstr}" if ( $status{Errstr} );
$log->error($msg);
croak;
}
else {
Expand Down Expand Up @@ -363,7 +361,10 @@ sub current_slave_position {
my $dbhelper = $self->{dbhelper};
my %status = $dbhelper->check_slave_status();
if ( $status{Status} ) {
$log->error( "checking slave status failed. err= " . $status{Errstr} );
my $msg =
sprintf( "Checking slave status failed on %s.", $self->get_hostinfo() );
$msg .= " err=$status{Errstr}" if ( $status{Errstr} );
$log->error($msg);
return;
}
$self->{Master_Log_File} = $status{Master_Log_File};
Expand Down Expand Up @@ -437,7 +438,10 @@ sub wait_until_relay_log_applied {
my $dbhelper = $self->{dbhelper};
my %status = $dbhelper->wait_until_relay_log_applied();
if ( $status{Status} ) {
$log->error("Got error: $status{Errstr}");
my $msg =
sprintf( "Checking slave status failed on %s.", $self->get_hostinfo() );
$msg .= " err=$status{Errstr}" if ( $status{Errstr} );
$log->error($msg);
}
return $status{Status};
}
Expand Down Expand Up @@ -614,12 +618,10 @@ sub wait_until_slave_starts($$) {
for ( my $i = 0 ; $i < $retry_count ; $i++ ) {
my %status = $dbhelper->check_slave_status();
if ( $status{Status} ) {
$log->error(
sprintf(
"Checking slave status failed on %s. err=%s",
$self->get_hostinfo(), $status{Errstr}
)
);
my $msg =
sprintf( "Checking slave status failed on %s.", $self->get_hostinfo() );
$msg .= " err=$status{Errstr}" if ( $status{Errstr} );
$log->error($msg);
return 1;
}
if ( $type eq "IO" ) {
Expand Down Expand Up @@ -666,12 +668,10 @@ sub wait_until_slave_stops {
for ( my $i = 0 ; $i < $retry_count ; $i++ ) {
my %status = $dbhelper->check_slave_status();
if ( $status{Status} ) {
$log->error(
sprintf(
"Checking slave status failed on %s. err=%s",
$self->get_hostinfo(), $status{Errstr}
)
);
my $msg =
sprintf( "Checking slave status failed on %s.", $self->get_hostinfo() );
$msg .= " err=$status{Errstr}" if ( $status{Errstr} );
$log->error($msg);
return 1;
}
if ( $type eq "IO" ) {
Expand Down Expand Up @@ -778,12 +778,10 @@ sub is_sql_thread_error {
my $dbhelper = $self->{dbhelper};
my %status = $dbhelper->check_slave_status();
if ( $status{Status} ) {
$log->error(
sprintf(
"Checking slave status failed on %s. err=%s",
$self->get_hostinfo(), $status{Errstr}
)
);
my $msg =
sprintf( "Checking slave status failed on %s.", $self->get_hostinfo() );
$msg .= " err=$status{Errstr}" if ( $status{Errstr} );
$log->error($msg);
return 1;
}
return 0 if ( $status{Slave_SQL_Running} eq "Yes" );
Expand All @@ -809,12 +807,10 @@ sub start_sql_thread_if {
my $dbhelper = $self->{dbhelper};
my %status = $dbhelper->check_slave_status();
if ( $status{Status} ) {
$log->error(
sprintf(
"Checking slave status failed on %s. err=%s",
$self->get_hostinfo(), $status{Errstr}
)
);
my $msg =
sprintf( "Checking slave status failed on %s.", $self->get_hostinfo() );
$msg .= " err=$status{Errstr}" if ( $status{Errstr} );
$log->error($msg);
return 1;
}
return 0 if ( $status{Slave_SQL_Running} eq "Yes" );
Expand Down
5 changes: 3 additions & 2 deletions lib/MHA/ServerManager.pm
Expand Up @@ -882,8 +882,9 @@ sub read_slave_status($) {

# This should not happen so die if it happens
if ( $status{Status} ) {
$log->error(
sprintf( "Checking slave status failed. err= " . $status{Errstr} ) );
my $msg = "Checking slave status failed.";
$msg .= " err=$status{Errstr}" if ( $status{Errstr} );
$log->error($msg);
croak;
}

Expand Down

0 comments on commit 19e4332

Please sign in to comment.