mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-19 18:34:59 +00:00
BUG-1595678 Updated MasterSlave lib into binaries
Also updated a 'SHOW PROCESSLIST' to 'SHOW FULL PROCESSLIST' because pt-kill needs more than 100 chars in the info field.
This commit is contained in:
@@ -2623,23 +2623,22 @@ use warnings FATAL => 'all';
|
||||
use English qw(-no_match_vars);
|
||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
sub check_recursion_method {
|
||||
sub check_recursion_method {
|
||||
my ($methods) = @_;
|
||||
|
||||
if ( @$methods != 1 ) {
|
||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||
&& $methods->[0] !~ /^dsn=/i )
|
||||
{
|
||||
die "Invalid combination of recursion methods: "
|
||||
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
||||
. "Only hosts and processlist may be combined.\n"
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( @$methods != 1 ) {
|
||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||
&& $methods->[0] !~ /^dsn=/i )
|
||||
{
|
||||
die "Invalid combination of recursion methods: "
|
||||
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
||||
. "Only hosts and processlist may be combined.\n"
|
||||
}
|
||||
}
|
||||
else {
|
||||
my ($method) = @$methods;
|
||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|dsn=)/i;
|
||||
}
|
||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|cluster$|dsn=)/i;
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
@@ -2675,7 +2674,8 @@ sub get_slaves {
|
||||
die "I need a $arg argument" unless $args{$arg};
|
||||
}
|
||||
my ($dbh, $dsn) = @args{@required_args};
|
||||
|
||||
my $o = $self->{OptionParser};
|
||||
|
||||
$self->recurse_to_slaves(
|
||||
{ dbh => $dbh,
|
||||
dsn => $dsn,
|
||||
@@ -2683,7 +2683,16 @@ sub get_slaves {
|
||||
my ( $dsn, $dbh, $level, $parent ) = @_;
|
||||
return unless $level;
|
||||
PTDEBUG && _d('Found slave:', $dp->as_string($dsn));
|
||||
push @$slaves, $make_cxn->(dsn => $dsn, dbh => $dbh);
|
||||
my $slave_dsn = $dsn;
|
||||
if ($o->got('slave-user')) {
|
||||
$slave_dsn->{u} = $o->get('slave-user');
|
||||
PTDEBUG && _d("Using slave user ".$o->get('slave-user')." on ".$slave_dsn->{h}.":".$slave_dsn->{P});
|
||||
}
|
||||
if ($o->got('slave-password')) {
|
||||
$slave_dsn->{p} = $o->get('slave-password');
|
||||
PTDEBUG && _d("Slave password set");
|
||||
}
|
||||
push @$slaves, $make_cxn->(dsn => $slave_dsn, dbh => $dbh);
|
||||
return;
|
||||
},
|
||||
}
|
||||
@@ -2881,7 +2890,7 @@ sub get_connected_slaves {
|
||||
die "You do not have the PROCESS privilege";
|
||||
}
|
||||
|
||||
$sql = 'SHOW PROCESSLIST';
|
||||
$sql = 'SHOW FULL PROCESSLIST';
|
||||
PTDEBUG && _d($dbh, $sql);
|
||||
grep { $_->{command} =~ m/Binlog Dump/i }
|
||||
map { # Lowercase the column names
|
||||
|
Reference in New Issue
Block a user