Build percona-toolkit-2.2.2

This commit is contained in:
Brian Fraser
2013-04-19 20:26:48 -03:00
parent 2e8ad61453
commit 871e217f3b
39 changed files with 606 additions and 81 deletions

View File

@@ -1313,6 +1313,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-align 2.2.1
pt-align 2.2.2
=cut

View File

@@ -42,7 +42,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -60,6 +60,7 @@ our $VERSION = '2.2.1';
# ###########################################################################
{
package Lmo::Utils;
use strict;
use warnings qw( FATAL all );
require Exporter;
@@ -67,7 +68,12 @@ our (@ISA, @EXPORT, @EXPORT_OK);
BEGIN {
@ISA = qw(Exporter);
@EXPORT = @EXPORT_OK = qw(_install_coderef _unimport_coderefs _glob_for _stash_for);
@EXPORT = @EXPORT_OK = qw(
_install_coderef
_unimport_coderefs
_glob_for
_stash_for
);
}
{
@@ -251,7 +257,6 @@ sub meta {
return Lmo::Meta->new(class => $class);
}
1;
}
# ###########################################################################
@@ -3462,6 +3467,8 @@ sub get_slaves {
my $dp = $self->{DSNParser};
my $methods = $self->_resolve_recursion_methods($args{dsn});
return $slaves unless @$methods;
if ( grep { m/processlist|hosts/i } @$methods ) {
my @required_args = qw(dbh dsn);
foreach my $arg ( @required_args ) {
@@ -7847,6 +7854,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-archiver 2.2.1
pt-archiver 2.2.2
=cut

View File

@@ -42,7 +42,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -60,6 +60,7 @@ our $VERSION = '2.2.1';
# ###########################################################################
{
package Lmo::Utils;
use strict;
use warnings qw( FATAL all );
require Exporter;
@@ -67,7 +68,12 @@ our (@ISA, @EXPORT, @EXPORT_OK);
BEGIN {
@ISA = qw(Exporter);
@EXPORT = @EXPORT_OK = qw(_install_coderef _unimport_coderefs _glob_for _stash_for);
@EXPORT = @EXPORT_OK = qw(
_install_coderef
_unimport_coderefs
_glob_for
_stash_for
);
}
{
@@ -251,7 +257,6 @@ sub meta {
return Lmo::Meta->new(class => $class);
}
1;
}
# ###########################################################################
@@ -2326,6 +2331,32 @@ sub name {
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
}
sub remove_duplicate_cxns {
my ($self, %args) = @_;
my @cxns = @{$args{cxns}};
my $seen_ids = $args{seen_ids} || {};
PTDEBUG && _d("Removing duplicates from ", join(" ", map { $_->name } @cxns));
my @trimmed_cxns;
for my $cxn ( @cxns ) {
my $dbh = $cxn->dbh();
my $sql = q{SELECT @@server_id};
PTDEBUG && _d($sql);
my ($id) = $dbh->selectrow_array($sql);
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
if ( ! $seen_ids->{$id}++ ) {
push @trimmed_cxns, $cxn
}
else {
PTDEBUG && _d("Removing ", $cxn->name,
", ID ", $id, ", because we've already seen it");
}
}
return \@trimmed_cxns;
}
sub DESTROY {
my ($self) = @_;
@@ -5664,6 +5695,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-config-diff 2.2.1
pt-config-diff 2.2.2
=cut

View File

@@ -41,7 +41,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -1124,6 +1124,7 @@ if ( PTDEBUG ) {
# ###########################################################################
{
package Lmo::Utils;
use strict;
use warnings qw( FATAL all );
require Exporter;
@@ -1131,7 +1132,12 @@ our (@ISA, @EXPORT, @EXPORT_OK);
BEGIN {
@ISA = qw(Exporter);
@EXPORT = @EXPORT_OK = qw(_install_coderef _unimport_coderefs _glob_for _stash_for);
@EXPORT = @EXPORT_OK = qw(
_install_coderef
_unimport_coderefs
_glob_for
_stash_for
);
}
{
@@ -1315,7 +1321,6 @@ sub meta {
return Lmo::Meta->new(class => $class);
}
1;
}
# ###########################################################################
@@ -2670,6 +2675,32 @@ sub name {
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
}
sub remove_duplicate_cxns {
my ($self, %args) = @_;
my @cxns = @{$args{cxns}};
my $seen_ids = $args{seen_ids} || {};
PTDEBUG && _d("Removing duplicates from ", join(" ", map { $_->name } @cxns));
my @trimmed_cxns;
for my $cxn ( @cxns ) {
my $dbh = $cxn->dbh();
my $sql = q{SELECT @@server_id};
PTDEBUG && _d($sql);
my ($id) = $dbh->selectrow_array($sql);
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
if ( ! $seen_ids->{$id}++ ) {
push @trimmed_cxns, $cxn
}
else {
PTDEBUG && _d("Removing ", $cxn->name,
", ID ", $id, ", because we've already seen it");
}
}
return \@trimmed_cxns;
}
sub DESTROY {
my ($self) = @_;
@@ -5437,6 +5468,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-deadlock-logger 2.2.1
pt-deadlock-logger 2.2.2
=cut

View File

@@ -37,7 +37,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -63,6 +63,7 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
use List::Util qw(max);
use Getopt::Long;
use Data::Dumper;
my $POD_link_re = '[LC]<"?([^">]+)"?>';
@@ -1046,6 +1047,45 @@ sub _parse_synopsis {
);
};
sub set_vars {
my ($self, $file) = @_;
$file ||= $self->{file} || __FILE__;
my %user_vars;
my $user_vars = $self->has('set-vars') ? $self->get('set-vars') : undef;
if ( $user_vars ) {
foreach my $var_val ( @$user_vars ) {
my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
die "Invalid --set-vars value: $var_val\n" unless $var && $val;
$user_vars{$var} = {
val => $val,
default => 0,
};
}
}
my %default_vars;
my $default_vars = $self->read_para_after($file, qr/MAGIC_set_vars/);
if ( $default_vars ) {
%default_vars = map {
my $var_val = $_;
my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
die "Invalid --set-vars value: $var_val\n" unless $var && $val;
$var => {
val => $val,
default => 1,
};
} split("\n", $default_vars);
}
my %vars = (
%default_vars, # first the tool's defaults
%user_vars, # then the user's which overwrite the defaults
);
PTDEBUG && _d('--set-vars:', Dumper(\%vars));
return \%vars;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
@@ -5501,6 +5541,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-diskstats 2.2.1
pt-diskstats 2.2.2
=cut

View File

@@ -38,7 +38,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -5480,6 +5480,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-duplicate-key-checker 2.2.1
pt-duplicate-key-checker 2.2.2
=cut

View File

@@ -36,6 +36,7 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
use List::Util qw(max);
use Getopt::Long;
use Data::Dumper;
my $POD_link_re = '[LC]<"?([^">]+)"?>';
@@ -1019,6 +1020,45 @@ sub _parse_synopsis {
);
};
sub set_vars {
my ($self, $file) = @_;
$file ||= $self->{file} || __FILE__;
my %user_vars;
my $user_vars = $self->has('set-vars') ? $self->get('set-vars') : undef;
if ( $user_vars ) {
foreach my $var_val ( @$user_vars ) {
my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
die "Invalid --set-vars value: $var_val\n" unless $var && $val;
$user_vars{$var} = {
val => $val,
default => 0,
};
}
}
my %default_vars;
my $default_vars = $self->read_para_after($file, qr/MAGIC_set_vars/);
if ( $default_vars ) {
%default_vars = map {
my $var_val = $_;
my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
die "Invalid --set-vars value: $var_val\n" unless $var && $val;
$var => {
val => $val,
default => 1,
};
} split("\n", $default_vars);
}
my %vars = (
%default_vars, # first the tool's defaults
%user_vars, # then the user's which overwrite the defaults
);
PTDEBUG && _d('--set-vars:', Dumper(\%vars));
return \%vars;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
@@ -1562,6 +1602,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-fifo-split 2.2.1
pt-fifo-split 2.2.2
=cut

View File

@@ -34,7 +34,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -4946,6 +4946,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-find 2.2.1
pt-find 2.2.2
=cut

View File

@@ -37,6 +37,7 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
use List::Util qw(max);
use Getopt::Long;
use Data::Dumper;
my $POD_link_re = '[LC]<"?([^">]+)"?>';
@@ -1020,6 +1021,45 @@ sub _parse_synopsis {
);
};
sub set_vars {
my ($self, $file) = @_;
$file ||= $self->{file} || __FILE__;
my %user_vars;
my $user_vars = $self->has('set-vars') ? $self->get('set-vars') : undef;
if ( $user_vars ) {
foreach my $var_val ( @$user_vars ) {
my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
die "Invalid --set-vars value: $var_val\n" unless $var && $val;
$user_vars{$var} = {
val => $val,
default => 0,
};
}
}
my %default_vars;
my $default_vars = $self->read_para_after($file, qr/MAGIC_set_vars/);
if ( $default_vars ) {
%default_vars = map {
my $var_val = $_;
my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
die "Invalid --set-vars value: $var_val\n" unless $var && $val;
$var => {
val => $val,
default => 1,
};
} split("\n", $default_vars);
}
my %vars = (
%default_vars, # first the tool's defaults
%user_vars, # then the user's which overwrite the defaults
);
PTDEBUG && _d('--set-vars:', Dumper(\%vars));
return \%vars;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
@@ -2153,6 +2193,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-fingerprint 2.2.1
pt-fingerprint 2.2.2
=cut

View File

@@ -36,7 +36,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -1827,6 +1827,32 @@ sub name {
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
}
sub remove_duplicate_cxns {
my ($self, %args) = @_;
my @cxns = @{$args{cxns}};
my $seen_ids = $args{seen_ids} || {};
PTDEBUG && _d("Removing duplicates from ", join(" ", map { $_->name } @cxns));
my @trimmed_cxns;
for my $cxn ( @cxns ) {
my $dbh = $cxn->dbh();
my $sql = q{SELECT @@server_id};
PTDEBUG && _d($sql);
my ($id) = $dbh->selectrow_array($sql);
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
if ( ! $seen_ids->{$id}++ ) {
push @trimmed_cxns, $cxn
}
else {
PTDEBUG && _d("Removing ", $cxn->name,
", ID ", $id, ", because we've already seen it");
}
}
return \@trimmed_cxns;
}
sub DESTROY {
my ($self) = @_;
@@ -4445,6 +4471,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-fk-error-logger 2.2.1
pt-fk-error-logger 2.2.2
=cut

View File

@@ -37,7 +37,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -105,6 +105,8 @@ sub get_slaves {
my $dp = $self->{DSNParser};
my $methods = $self->_resolve_recursion_methods($args{dsn});
return $slaves unless @$methods;
if ( grep { m/processlist|hosts/i } @$methods ) {
my @required_args = qw(dbh dsn);
foreach my $arg ( @required_args ) {
@@ -3047,6 +3049,8 @@ use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
use Time::HiRes qw(sleep);
sub new {
my ( $class, %args ) = @_;
my $self = {
@@ -5955,7 +5959,7 @@ not check or adjust for different system or MySQL time zones which can
cause the tool to compute the lag incorrectly. Specifying this option is
a good idea because it ensures that the tool works correctly regardless of
time zones, but it also makes the tool backwards-incompatible with
pt-heartbeat 2.2.1 and older (unless the older version of pt-heartbeat
pt-heartbeat 2.2.2 and older (unless the older version of pt-heartbeat
is running on a system that uses UTC).
=item --version
@@ -6137,6 +6141,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-heartbeat 2.2.1
pt-heartbeat 2.2.2
=cut

View File

@@ -44,7 +44,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -7476,6 +7476,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-index-usage 2.2.1
pt-index-usage 2.2.2
=cut

View File

@@ -345,14 +345,14 @@ _parse_command_line() {
if [ "$next_opt_is_val" ]; then
next_opt_is_val=""
if [ $# -eq 0 ] || [ $(expr "$opt" : "-") -eq 1 ]; then
if [ $# -eq 0 ] || [ $(expr "$opt" : "\-") -eq 1 ]; then
option_error "$real_opt requires a $required_arg argument"
continue
fi
val="$opt"
opt_is_ok=1
else
if [ $(expr "$opt" : "-") -eq 0 ]; then
if [ $(expr "$opt" : "\-") -eq 0 ]; then
if [ -z "$ARGV" ]; then
ARGV="$opt"
else
@@ -1115,7 +1115,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-ioprofile 2.2.1
pt-ioprofile 2.2.2
=cut

View File

@@ -46,7 +46,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -3738,6 +3738,8 @@ sub get_slaves {
my $dp = $self->{DSNParser};
my $methods = $self->_resolve_recursion_methods($args{dsn});
return $slaves unless @$methods;
if ( grep { m/processlist|hosts/i } @$methods ) {
my @required_args = qw(dbh dsn);
foreach my $arg ( @required_args ) {
@@ -5178,6 +5180,32 @@ sub name {
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
}
sub remove_duplicate_cxns {
my ($self, %args) = @_;
my @cxns = @{$args{cxns}};
my $seen_ids = $args{seen_ids} || {};
PTDEBUG && _d("Removing duplicates from ", join(" ", map { $_->name } @cxns));
my @trimmed_cxns;
for my $cxn ( @cxns ) {
my $dbh = $cxn->dbh();
my $sql = q{SELECT @@server_id};
PTDEBUG && _d($sql);
my ($id) = $dbh->selectrow_array($sql);
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
if ( ! $seen_ids->{$id}++ ) {
push @trimmed_cxns, $cxn
}
else {
PTDEBUG && _d("Removing ", $cxn->name,
", ID ", $id, ", because we've already seen it");
}
}
return \@trimmed_cxns;
}
sub DESTROY {
my ($self) = @_;
@@ -8098,6 +8126,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-kill 2.2.1
pt-kill 2.2.2
=cut

View File

@@ -791,7 +791,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-mext 2.2.1
pt-mext 2.2.2
=cut

View File

@@ -3111,7 +3111,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-mysql-summary 2.2.1
pt-mysql-summary 2.2.2
=cut

View File

@@ -53,7 +53,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -1137,6 +1137,7 @@ if ( PTDEBUG ) {
# ###########################################################################
{
package Lmo::Utils;
use strict;
use warnings qw( FATAL all );
require Exporter;
@@ -1144,7 +1145,12 @@ our (@ISA, @EXPORT, @EXPORT_OK);
BEGIN {
@ISA = qw(Exporter);
@EXPORT = @EXPORT_OK = qw(_install_coderef _unimport_coderefs _glob_for _stash_for);
@EXPORT = @EXPORT_OK = qw(
_install_coderef
_unimport_coderefs
_glob_for
_stash_for
);
}
{
@@ -1328,7 +1334,6 @@ sub meta {
return Lmo::Meta->new(class => $class);
}
1;
}
# ###########################################################################
@@ -3786,6 +3791,32 @@ sub name {
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
}
sub remove_duplicate_cxns {
my ($self, %args) = @_;
my @cxns = @{$args{cxns}};
my $seen_ids = $args{seen_ids} || {};
PTDEBUG && _d("Removing duplicates from ", join(" ", map { $_->name } @cxns));
my @trimmed_cxns;
for my $cxn ( @cxns ) {
my $dbh = $cxn->dbh();
my $sql = q{SELECT @@server_id};
PTDEBUG && _d($sql);
my ($id) = $dbh->selectrow_array($sql);
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
if ( ! $seen_ids->{$id}++ ) {
push @trimmed_cxns, $cxn
}
else {
PTDEBUG && _d("Removing ", $cxn->name,
", ID ", $id, ", because we've already seen it");
}
}
return \@trimmed_cxns;
}
sub DESTROY {
my ($self) = @_;
@@ -3880,6 +3911,8 @@ sub get_slaves {
my $dp = $self->{DSNParser};
my $methods = $self->_resolve_recursion_methods($args{dsn});
return $slaves unless @$methods;
if ( grep { m/processlist|hosts/i } @$methods ) {
my @required_args = qw(dbh dsn);
foreach my $arg ( @required_args ) {
@@ -7481,6 +7514,8 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
use Lmo;
use Data::Dumper;
{ local $EVAL_ERROR; eval { require Cxn } };
sub get_cluster_name {
my ($self, $cxn) = @_;
my $sql = "SHOW VARIABLES LIKE 'wsrep\_cluster\_name'";
@@ -7505,13 +7540,67 @@ sub is_cluster_node {
sub same_node {
my ($self, $cxn1, $cxn2) = @_;
my $sql = "SHOW VARIABLES LIKE 'wsrep\_sst\_receive\_address'";
PTDEBUG && _d($cxn1->name, $sql);
my (undef, $val1) = $cxn1->dbh->selectrow_array($sql);
PTDEBUG && _d($cxn2->name, $sql);
my (undef, $val2) = $cxn2->dbh->selectrow_array($sql);
foreach my $val ('wsrep\_sst\_receive\_address', 'wsrep\_node\_name', 'wsrep\_node\_address') {
my $sql = "SHOW VARIABLES LIKE '$val'";
PTDEBUG && _d($cxn1->name, $cxn2->name, $sql);
my (undef, $val1) = $cxn1->dbh->selectrow_array($sql);
my (undef, $val2) = $cxn2->dbh->selectrow_array($sql);
return ($val1 || '') eq ($val2 || '');
return unless ($val1 || '') eq ($val2 || '');
}
return 1;
}
sub find_cluster_nodes {
my ($self, %args) = @_;
my $dbh = $args{dbh};
my $dsn = $args{dsn};
my $dp = $args{DSNParser};
my $make_cxn = $args{make_cxn};
my $sql = q{SHOW STATUS LIKE 'wsrep\_incoming\_addresses'};
PTDEBUG && _d($sql);
my (undef, $addresses) = $dbh->selectrow_array($sql);
PTDEBUG && _d("Cluster nodes found: ", $addresses);
return unless $addresses;
my @addresses = grep { !/\Aunspecified\z/i }
split /,\s*/, $addresses;
my @nodes;
foreach my $address ( @addresses ) {
my ($host, $port) = split /:/, $address;
my $spec = "h=$host"
. ($port ? ",P=$port" : "");
my $node_dsn = $dp->parse($spec, $dsn);
my $node_dbh = eval { $dp->get_dbh(
$dp->get_cxn_params($node_dsn), { AutoCommit => 1 }) };
if ( $EVAL_ERROR ) {
print STDERR "Cannot connect to ", $dp->as_string($node_dsn),
", discovered through $sql: $EVAL_ERROR\n";
if ( !$port && $dsn->{P} != 3306 ) {
$address .= ":3306";
redo;
}
next;
}
PTDEBUG && _d('Connected to', $dp->as_string($node_dsn));
$node_dbh->disconnect();
push @nodes, $make_cxn->(dsn => $node_dsn);
}
return \@nodes;
}
sub remove_duplicate_cxns {
my ($self, %args) = @_;
my @cxns = @{$args{cxns}};
my $seen_ids = $args{seen_ids};
return Cxn->remove_duplicate_cxns(%args);
}
sub same_cluster {
@@ -7525,6 +7614,59 @@ sub same_cluster {
return ($cluster1 || '') eq ($cluster2 || '');
}
sub autodetect_nodes {
my ($self, %args) = @_;
my $ms = $args{MasterSlave};
my $dp = $args{DSNParser};
my $make_cxn = $args{make_cxn};
my $nodes = $args{nodes};
my $seen_ids = $args{seen_ids};
my $new_nodes = [];
return $new_nodes unless @$nodes;
for my $node ( @$nodes ) {
my $nodes_found = $self->find_cluster_nodes(
dbh => $node->dbh(),
dsn => $node->dsn(),
make_cxn => $make_cxn,
DSNParser => $dp,
);
push @$new_nodes, @$nodes_found;
}
$new_nodes = $self->remove_duplicate_cxns(
cxns => $new_nodes,
seen_ids => $seen_ids
);
my $new_slaves = [];
foreach my $node (@$new_nodes) {
my $node_slaves = $ms->get_slaves(
dbh => $node->dbh(),
dsn => $node->dsn(),
make_cxn => $make_cxn,
);
push @$new_slaves, @$node_slaves;
}
$new_slaves = $self->remove_duplicate_cxns(
cxns => $new_slaves,
seen_ids => $seen_ids
);
my @new_slave_nodes = grep { $self->is_cluster_node($_) } @$new_slaves;
my $slaves_of_slaves = $self->autodetect_nodes(
%args,
nodes => \@new_slave_nodes,
);
my @autodetected_nodes = ( @$new_nodes, @$new_slaves, @$slaves_of_slaves );
return \@autodetected_nodes;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
@@ -11255,6 +11397,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-online-schema-change 2.2.1
pt-online-schema-change 2.2.2
=cut

View File

@@ -885,7 +885,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-pmp 2.2.1
pt-pmp 2.2.2
=cut

View File

@@ -63,7 +63,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -10011,6 +10011,8 @@ sub get_slaves {
my $dp = $self->{DSNParser};
my $methods = $self->_resolve_recursion_methods($args{dsn});
return $slaves unless @$methods;
if ( grep { m/processlist|hosts/i } @$methods ) {
my @required_args = qw(dbh dsn);
foreach my $arg ( @required_args ) {
@@ -16082,6 +16084,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-query-digest 2.2.1
pt-query-digest 2.2.2
=cut

View File

@@ -2396,6 +2396,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-show-grants 2.2.1
pt-show-grants 2.2.2
=cut

View File

@@ -1233,7 +1233,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-sift 2.2.1
pt-sift 2.2.2
=cut

View File

@@ -39,7 +39,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -1122,6 +1122,7 @@ if ( PTDEBUG ) {
# ###########################################################################
{
package Lmo::Utils;
use strict;
use warnings qw( FATAL all );
require Exporter;
@@ -1129,7 +1130,12 @@ our (@ISA, @EXPORT, @EXPORT_OK);
BEGIN {
@ISA = qw(Exporter);
@EXPORT = @EXPORT_OK = qw(_install_coderef _unimport_coderefs _glob_for _stash_for);
@EXPORT = @EXPORT_OK = qw(
_install_coderef
_unimport_coderefs
_glob_for
_stash_for
);
}
{
@@ -1313,7 +1319,6 @@ sub meta {
return Lmo::Meta->new(class => $class);
}
1;
}
# ###########################################################################
@@ -2750,6 +2755,8 @@ use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
use Time::HiRes qw(sleep);
sub new {
my ( $class, %args ) = @_;
my $self = {
@@ -4824,6 +4831,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-slave-delay 2.2.1
pt-slave-delay 2.2.2
=cut

View File

@@ -1102,6 +1102,7 @@ if ( PTDEBUG ) {
# ###########################################################################
{
package Lmo::Utils;
use strict;
use warnings qw( FATAL all );
require Exporter;
@@ -1109,7 +1110,12 @@ our (@ISA, @EXPORT, @EXPORT_OK);
BEGIN {
@ISA = qw(Exporter);
@EXPORT = @EXPORT_OK = qw(_install_coderef _unimport_coderefs _glob_for _stash_for);
@EXPORT = @EXPORT_OK = qw(
_install_coderef
_unimport_coderefs
_glob_for
_stash_for
);
}
{
@@ -1293,7 +1299,6 @@ sub meta {
return Lmo::Meta->new(class => $class);
}
1;
}
# ###########################################################################
@@ -2219,6 +2224,8 @@ sub get_slaves {
my $dp = $self->{DSNParser};
my $methods = $self->_resolve_recursion_methods($args{dsn});
return $slaves unless @$methods;
if ( grep { m/processlist|hosts/i } @$methods ) {
my @required_args = qw(dbh dsn);
foreach my $arg ( @required_args ) {
@@ -4317,6 +4324,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-slave-find 2.2.1
pt-slave-find 2.2.2
=cut

View File

@@ -40,7 +40,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -1274,6 +1274,7 @@ if ( PTDEBUG ) {
# ###########################################################################
{
package Lmo::Utils;
use strict;
use warnings qw( FATAL all );
require Exporter;
@@ -1281,7 +1282,12 @@ our (@ISA, @EXPORT, @EXPORT_OK);
BEGIN {
@ISA = qw(Exporter);
@EXPORT = @EXPORT_OK = qw(_install_coderef _unimport_coderefs _glob_for _stash_for);
@EXPORT = @EXPORT_OK = qw(
_install_coderef
_unimport_coderefs
_glob_for
_stash_for
);
}
{
@@ -1465,7 +1471,6 @@ sub meta {
return Lmo::Meta->new(class => $class);
}
1;
}
# ###########################################################################
@@ -2585,6 +2590,8 @@ sub get_slaves {
my $dp = $self->{DSNParser};
my $methods = $self->_resolve_recursion_methods($args{dsn});
return $slaves unless @$methods;
if ( grep { m/processlist|hosts/i } @$methods ) {
my @required_args = qw(dbh dsn);
foreach my $arg ( @required_args ) {
@@ -5766,6 +5773,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-slave-restart 2.2.1
pt-slave-restart 2.2.2
=cut

View File

@@ -2201,7 +2201,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-stalk 2.2.1
pt-stalk 2.2.2
=cut

View File

@@ -2682,7 +2682,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-summary 2.2.1
pt-summary 2.2.2
=cut

View File

@@ -56,7 +56,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -12385,6 +12385,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-table-checksum 2.2.1
pt-table-checksum 2.2.2
=cut

View File

@@ -54,7 +54,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -1137,6 +1137,7 @@ if ( PTDEBUG ) {
# ###########################################################################
{
package Lmo::Utils;
use strict;
use warnings qw( FATAL all );
require Exporter;
@@ -1144,7 +1145,12 @@ our (@ISA, @EXPORT, @EXPORT_OK);
BEGIN {
@ISA = qw(Exporter);
@EXPORT = @EXPORT_OK = qw(_install_coderef _unimport_coderefs _glob_for _stash_for);
@EXPORT = @EXPORT_OK = qw(
_install_coderef
_unimport_coderefs
_glob_for
_stash_for
);
}
{
@@ -1328,7 +1334,6 @@ sub meta {
return Lmo::Meta->new(class => $class);
}
1;
}
# ###########################################################################
@@ -6526,6 +6531,8 @@ sub get_slaves {
my $dp = $self->{DSNParser};
my $methods = $self->_resolve_recursion_methods($args{dsn});
return $slaves unless @$methods;
if ( grep { m/processlist|hosts/i } @$methods ) {
my @required_args = qw(dbh dsn);
foreach my $arg ( @required_args ) {
@@ -8237,6 +8244,8 @@ use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
use Time::HiRes qw(sleep);
sub new {
my ( $class, %args ) = @_;
my $self = {
@@ -12616,6 +12625,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-table-sync 2.2.1
pt-table-sync 2.2.2
=cut

View File

@@ -7512,6 +7512,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-table-usage 2.2.1
pt-table-usage 2.2.2
=cut

View File

@@ -60,7 +60,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -2500,6 +2500,32 @@ sub name {
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
}
sub remove_duplicate_cxns {
my ($self, %args) = @_;
my @cxns = @{$args{cxns}};
my $seen_ids = $args{seen_ids} || {};
PTDEBUG && _d("Removing duplicates from ", join(" ", map { $_->name } @cxns));
my @trimmed_cxns;
for my $cxn ( @cxns ) {
my $dbh = $cxn->dbh();
my $sql = q{SELECT @@server_id};
PTDEBUG && _d($sql);
my ($id) = $dbh->selectrow_array($sql);
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
if ( ! $seen_ids->{$id}++ ) {
push @trimmed_cxns, $cxn
}
else {
PTDEBUG && _d("Removing ", $cxn->name,
", ID ", $id, ", because we've already seen it");
}
}
return \@trimmed_cxns;
}
sub DESTROY {
my ($self) = @_;
@@ -11142,6 +11168,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-upgrade 2.2.1
pt-upgrade 2.2.2
=cut

View File

@@ -43,7 +43,7 @@ BEGIN {
# ###########################################################################
{
package Percona::Toolkit;
our $VERSION = '2.2.1';
our $VERSION = '2.2.2';
1;
}
@@ -1126,6 +1126,7 @@ if ( PTDEBUG ) {
# ###########################################################################
{
package Lmo::Utils;
use strict;
use warnings qw( FATAL all );
require Exporter;
@@ -1133,7 +1134,12 @@ our (@ISA, @EXPORT, @EXPORT_OK);
BEGIN {
@ISA = qw(Exporter);
@EXPORT = @EXPORT_OK = qw(_install_coderef _unimport_coderefs _glob_for _stash_for);
@EXPORT = @EXPORT_OK = qw(
_install_coderef
_unimport_coderefs
_glob_for
_stash_for
);
}
{
@@ -1317,7 +1323,6 @@ sub meta {
return Lmo::Meta->new(class => $class);
}
1;
}
# ###########################################################################
@@ -6094,6 +6099,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-variable-advisor 2.2.1
pt-variable-advisor 2.2.2
=cut

View File

@@ -3233,6 +3233,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-visual-explain 2.2.1
pt-visual-explain 2.2.2
=cut