mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +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:
@@ -3507,7 +3507,6 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
sub check_recursion_method {
|
||||
my ($methods) = @_;
|
||||
|
||||
if ( @$methods != 1 ) {
|
||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||
&& $methods->[0] !~ /^dsn=/i )
|
||||
@@ -3520,7 +3519,7 @@ sub check_recursion_method {
|
||||
else {
|
||||
my ($method) = @$methods;
|
||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|dsn=)/i;
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|cluster$|dsn=)/i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3557,6 +3556,7 @@ 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,
|
||||
@@ -3565,7 +3565,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;
|
||||
},
|
||||
}
|
||||
@@ -3763,7 +3772,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
|
||||
|
@@ -114,7 +114,6 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
sub check_recursion_method {
|
||||
my ($methods) = @_;
|
||||
|
||||
if ( @$methods != 1 ) {
|
||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||
&& $methods->[0] !~ /^dsn=/i )
|
||||
@@ -127,7 +126,7 @@ sub check_recursion_method {
|
||||
else {
|
||||
my ($method) = @$methods;
|
||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|dsn=)/i;
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|cluster$|dsn=)/i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,6 +163,7 @@ 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,
|
||||
@@ -172,7 +172,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;
|
||||
},
|
||||
}
|
||||
@@ -370,7 +379,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
|
||||
|
15
bin/pt-kill
15
bin/pt-kill
@@ -3777,7 +3777,6 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
sub check_recursion_method {
|
||||
my ($methods) = @_;
|
||||
|
||||
if ( @$methods != 1 ) {
|
||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||
&& $methods->[0] !~ /^dsn=/i )
|
||||
@@ -3790,7 +3789,7 @@ sub check_recursion_method {
|
||||
else {
|
||||
my ($method) = @$methods;
|
||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|dsn=)/i;
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|cluster$|dsn=)/i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3827,6 +3826,7 @@ 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,
|
||||
@@ -3835,7 +3835,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;
|
||||
},
|
||||
}
|
||||
|
@@ -4326,7 +4326,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
|
||||
|
@@ -10436,6 +10436,7 @@ 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,
|
||||
@@ -10444,7 +10445,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;
|
||||
},
|
||||
}
|
||||
@@ -10642,7 +10652,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
|
||||
|
@@ -2214,7 +2214,6 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
sub check_recursion_method {
|
||||
my ($methods) = @_;
|
||||
|
||||
if ( @$methods != 1 ) {
|
||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||
&& $methods->[0] !~ /^dsn=/i )
|
||||
@@ -2227,7 +2226,7 @@ sub check_recursion_method {
|
||||
else {
|
||||
my ($method) = @$methods;
|
||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|dsn=)/i;
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|cluster$|dsn=)/i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2264,6 +2263,7 @@ 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,
|
||||
@@ -2272,7 +2272,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;
|
||||
},
|
||||
}
|
||||
@@ -2470,7 +2479,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
|
||||
|
@@ -2625,7 +2625,6 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
sub check_recursion_method {
|
||||
my ($methods) = @_;
|
||||
|
||||
if ( @$methods != 1 ) {
|
||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||
&& $methods->[0] !~ /^dsn=/i )
|
||||
@@ -2638,7 +2637,7 @@ sub check_recursion_method {
|
||||
else {
|
||||
my ($method) = @$methods;
|
||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|dsn=)/i;
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|cluster$|dsn=)/i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2675,6 +2674,7 @@ 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,
|
||||
@@ -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
|
||||
|
@@ -5005,7 +5005,6 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
sub check_recursion_method {
|
||||
my ($methods) = @_;
|
||||
|
||||
if ( @$methods != 1 ) {
|
||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||
&& $methods->[0] !~ /^dsn=/i )
|
||||
@@ -5018,7 +5017,7 @@ sub check_recursion_method {
|
||||
else {
|
||||
my ($method) = @$methods;
|
||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|dsn=)/i;
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|cluster$|dsn=)/i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5055,6 +5054,7 @@ 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,
|
||||
@@ -5063,7 +5063,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;
|
||||
},
|
||||
}
|
||||
@@ -5261,7 +5270,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
|
||||
|
@@ -6587,7 +6587,6 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
sub check_recursion_method {
|
||||
my ($methods) = @_;
|
||||
|
||||
if ( @$methods != 1 ) {
|
||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||
&& $methods->[0] !~ /^dsn=/i )
|
||||
@@ -6600,7 +6599,7 @@ sub check_recursion_method {
|
||||
else {
|
||||
my ($method) = @$methods;
|
||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|dsn=)/i;
|
||||
unless $method && $method =~ m/^(?:processlist$|hosts$|none$|cluster$|dsn=)/i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6637,6 +6636,7 @@ 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,
|
||||
@@ -6645,7 +6645,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;
|
||||
},
|
||||
}
|
||||
@@ -6843,7 +6852,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
|
||||
|
@@ -352,7 +352,7 @@ sub get_connected_slaves {
|
||||
die "You do not have the PROCESS privilege";
|
||||
}
|
||||
|
||||
$sql = 'SHOW PROCESSLIST';
|
||||
$sql = 'SHOW FULL PROCESSLIST';
|
||||
PTDEBUG && _d($dbh, $sql);
|
||||
# It's probably a slave if it's doing a binlog dump.
|
||||
grep { $_->{command} =~ m/Binlog Dump/i }
|
||||
|
Reference in New Issue
Block a user