mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 05:29:30 +00:00
PT-148 Fixed Use of uninitialized value in printf
This commit is contained in:
@@ -1906,7 +1906,8 @@ sub lost_connection {
|
||||
my ($self, $e) = @_;
|
||||
return 0 unless $e;
|
||||
return $e =~ m/MySQL server has gone away/
|
||||
|| $e =~ m/Lost connection to MySQL server/;
|
||||
|| $e =~ m/Lost connection to MySQL server/
|
||||
|| $e =~ m/Server shutdown in progress/;
|
||||
}
|
||||
|
||||
sub dbh {
|
||||
@@ -1925,6 +1926,11 @@ sub name {
|
||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
||||
}
|
||||
|
||||
sub description {
|
||||
my ($self) = @_;
|
||||
return sprintf("%s -> %s:%s", $self->name(), $self->{dsn}->{h}, $self->{dsn}->{P} || 'socket');
|
||||
}
|
||||
|
||||
sub get_id {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
@@ -1956,9 +1962,20 @@ sub is_cluster_node {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
|
||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
||||
|
||||
my $dbh;
|
||||
if ($cxn->isa('DBI::db')) {
|
||||
$dbh = $cxn;
|
||||
PTDEBUG && _d($sql); #don't invoke name() if it's not a Cxn!
|
||||
}
|
||||
else {
|
||||
$dbh = $cxn->dbh();
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
}
|
||||
|
||||
my $row = $dbh->selectrow_arrayref($sql);
|
||||
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user