mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-21 10:17:18 +00:00
PT-148 Fixed Use of uninitialized value in printf
This commit is contained in:
@@ -2,6 +2,7 @@ Changelog for Percona Toolkit
|
|||||||
|
|
||||||
v3.0.4
|
v3.0.4
|
||||||
|
|
||||||
|
* Fixed bug PT-148 : pt-osc Use of uninitialized value in printf
|
||||||
* Fixed bug PT-144 : Constraint name is too long (> 64 chars)
|
* Fixed bug PT-144 : Constraint name is too long (> 64 chars)
|
||||||
* Fixed bug PT-143 : pt-archiver SELECT query fails because of primary key
|
* Fixed bug PT-143 : pt-archiver SELECT query fails because of primary key
|
||||||
* Fixed bug PT-142 : pt-online-schema-change find_child_tables slow
|
* Fixed bug PT-142 : pt-online-schema-change find_child_tables slow
|
||||||
|
@@ -4498,7 +4498,8 @@ sub lost_connection {
|
|||||||
my ($self, $e) = @_;
|
my ($self, $e) = @_;
|
||||||
return 0 unless $e;
|
return 0 unless $e;
|
||||||
return $e =~ m/MySQL server has gone away/
|
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 {
|
sub dbh {
|
||||||
@@ -4517,6 +4518,11 @@ sub name {
|
|||||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
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 {
|
sub get_id {
|
||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
|
@@ -2410,7 +2410,8 @@ sub lost_connection {
|
|||||||
my ($self, $e) = @_;
|
my ($self, $e) = @_;
|
||||||
return 0 unless $e;
|
return 0 unless $e;
|
||||||
return $e =~ m/MySQL server has gone away/
|
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 {
|
sub dbh {
|
||||||
@@ -2429,6 +2430,11 @@ sub name {
|
|||||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
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 {
|
sub get_id {
|
||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
@@ -2460,9 +2466,20 @@ sub is_cluster_node {
|
|||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
$cxn ||= $self;
|
$cxn ||= $self;
|
||||||
|
|
||||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||||
|
|
||||||
|
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);
|
PTDEBUG && _d($cxn->name, $sql);
|
||||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
}
|
||||||
|
|
||||||
|
my $row = $dbh->selectrow_arrayref($sql);
|
||||||
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2754,7 +2754,8 @@ sub lost_connection {
|
|||||||
my ($self, $e) = @_;
|
my ($self, $e) = @_;
|
||||||
return 0 unless $e;
|
return 0 unless $e;
|
||||||
return $e =~ m/MySQL server has gone away/
|
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 {
|
sub dbh {
|
||||||
@@ -2773,6 +2774,11 @@ sub name {
|
|||||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
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 {
|
sub get_id {
|
||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
@@ -2804,9 +2810,20 @@ sub is_cluster_node {
|
|||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
$cxn ||= $self;
|
$cxn ||= $self;
|
||||||
|
|
||||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||||
|
|
||||||
|
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);
|
PTDEBUG && _d($cxn->name, $sql);
|
||||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
}
|
||||||
|
|
||||||
|
my $row = $dbh->selectrow_arrayref($sql);
|
||||||
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1906,7 +1906,8 @@ sub lost_connection {
|
|||||||
my ($self, $e) = @_;
|
my ($self, $e) = @_;
|
||||||
return 0 unless $e;
|
return 0 unless $e;
|
||||||
return $e =~ m/MySQL server has gone away/
|
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 {
|
sub dbh {
|
||||||
@@ -1925,6 +1926,11 @@ sub name {
|
|||||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
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 {
|
sub get_id {
|
||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
@@ -1956,9 +1962,20 @@ sub is_cluster_node {
|
|||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
$cxn ||= $self;
|
$cxn ||= $self;
|
||||||
|
|
||||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||||
|
|
||||||
|
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);
|
PTDEBUG && _d($cxn->name, $sql);
|
||||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
}
|
||||||
|
|
||||||
|
my $row = $dbh->selectrow_arrayref($sql);
|
||||||
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
21
bin/pt-kill
21
bin/pt-kill
@@ -5300,7 +5300,8 @@ sub lost_connection {
|
|||||||
my ($self, $e) = @_;
|
my ($self, $e) = @_;
|
||||||
return 0 unless $e;
|
return 0 unless $e;
|
||||||
return $e =~ m/MySQL server has gone away/
|
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 {
|
sub dbh {
|
||||||
@@ -5319,6 +5320,11 @@ sub name {
|
|||||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
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 {
|
sub get_id {
|
||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
@@ -5350,9 +5356,20 @@ sub is_cluster_node {
|
|||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
$cxn ||= $self;
|
$cxn ||= $self;
|
||||||
|
|
||||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||||
|
|
||||||
|
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);
|
PTDEBUG && _d($cxn->name, $sql);
|
||||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
}
|
||||||
|
|
||||||
|
my $row = $dbh->selectrow_arrayref($sql);
|
||||||
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -3948,6 +3948,11 @@ sub name {
|
|||||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
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 {
|
sub get_id {
|
||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
@@ -8486,7 +8491,7 @@ sub main {
|
|||||||
if ( scalar @$slaves ) {
|
if ( scalar @$slaves ) {
|
||||||
print "Found " . scalar(@$slaves) . " slaves:\n";
|
print "Found " . scalar(@$slaves) . " slaves:\n";
|
||||||
foreach my $cxn ( @$slaves ) {
|
foreach my $cxn ( @$slaves ) {
|
||||||
printf("%s -> %s:%s\n", $cxn->name(), $cxn->{dsn}->{h}, $cxn->{dsn}->{P});
|
print $cxn->description()."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ( ($o->get('recursion-method') || '') ne 'none') {
|
elsif ( ($o->get('recursion-method') || '') ne 'none') {
|
||||||
@@ -8523,7 +8528,7 @@ sub main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($found) {
|
if ($found) {
|
||||||
printf("Skipping slave %s -> %s:%s\n", $slave->name(), $slave->{dsn}->{h}, $slave->{dsn}->{P});
|
print "Skipping slave ". $slave->description()."\n";
|
||||||
} else {
|
} else {
|
||||||
push @$filtered_slaves, $slave;
|
push @$filtered_slaves, $slave;
|
||||||
}
|
}
|
||||||
@@ -8535,7 +8540,7 @@ sub main {
|
|||||||
} else{
|
} else{
|
||||||
print "Will check slave lag on:\n";
|
print "Will check slave lag on:\n";
|
||||||
foreach my $cxn ( @$slave_lag_cxns ) {
|
foreach my $cxn ( @$slave_lag_cxns ) {
|
||||||
printf("%s -> %s:%s\n", $cxn->name(), $cxn->{dsn}->{h}, $cxn->{dsn}->{P});
|
print $cxn->description()."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3680,6 +3680,11 @@ sub name {
|
|||||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
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 {
|
sub get_id {
|
||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
@@ -3711,9 +3716,20 @@ sub is_cluster_node {
|
|||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
$cxn ||= $self;
|
$cxn ||= $self;
|
||||||
|
|
||||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||||
|
|
||||||
|
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);
|
PTDEBUG && _d($cxn->name, $sql);
|
||||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
}
|
||||||
|
|
||||||
|
my $row = $dbh->selectrow_arrayref($sql);
|
||||||
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2579,7 +2579,8 @@ sub lost_connection {
|
|||||||
my ($self, $e) = @_;
|
my ($self, $e) = @_;
|
||||||
return 0 unless $e;
|
return 0 unless $e;
|
||||||
return $e =~ m/MySQL server has gone away/
|
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 {
|
sub dbh {
|
||||||
@@ -2598,6 +2599,11 @@ sub name {
|
|||||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
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 {
|
sub get_id {
|
||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
@@ -2629,9 +2635,20 @@ sub is_cluster_node {
|
|||||||
my ($self, $cxn) = @_;
|
my ($self, $cxn) = @_;
|
||||||
|
|
||||||
$cxn ||= $self;
|
$cxn ||= $self;
|
||||||
|
|
||||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||||
|
|
||||||
|
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);
|
PTDEBUG && _d($cxn->name, $sql);
|
||||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
}
|
||||||
|
|
||||||
|
my $row = $dbh->selectrow_arrayref($sql);
|
||||||
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -228,6 +228,11 @@ sub name {
|
|||||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
# This returns the server_id.
|
# This returns the server_id.
|
||||||
# For cluster nodes, since server_id is unreliable, we use a combination of
|
# For cluster nodes, since server_id is unreliable, we use a combination of
|
||||||
# variables to create an id string that is unique.
|
# variables to create an id string that is unique.
|
||||||
|
Reference in New Issue
Block a user