mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-12-22 03:00:29 +08: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:
@@ -3505,23 +3505,22 @@ use warnings FATAL => 'all';
|
|||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
sub check_recursion_method {
|
sub check_recursion_method {
|
||||||
my ($methods) = @_;
|
my ($methods) = @_;
|
||||||
|
if ( @$methods != 1 ) {
|
||||||
if ( @$methods != 1 ) {
|
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
&& $methods->[0] !~ /^dsn=/i )
|
||||||
&& $methods->[0] !~ /^dsn=/i )
|
{
|
||||||
{
|
die "Invalid combination of recursion methods: "
|
||||||
die "Invalid combination of recursion methods: "
|
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
||||||
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
. "Only hosts and processlist may be combined.\n"
|
||||||
. "Only hosts and processlist may be combined.\n"
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
|
||||||
my ($method) = @$methods;
|
my ($method) = @$methods;
|
||||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
@@ -3557,7 +3556,8 @@ sub get_slaves {
|
|||||||
die "I need a $arg argument" unless $args{$arg};
|
die "I need a $arg argument" unless $args{$arg};
|
||||||
}
|
}
|
||||||
my ($dbh, $dsn) = @args{@required_args};
|
my ($dbh, $dsn) = @args{@required_args};
|
||||||
|
my $o = $self->{OptionParser};
|
||||||
|
|
||||||
$self->recurse_to_slaves(
|
$self->recurse_to_slaves(
|
||||||
{ dbh => $dbh,
|
{ dbh => $dbh,
|
||||||
dsn => $dsn,
|
dsn => $dsn,
|
||||||
@@ -3565,7 +3565,16 @@ sub get_slaves {
|
|||||||
my ( $dsn, $dbh, $level, $parent ) = @_;
|
my ( $dsn, $dbh, $level, $parent ) = @_;
|
||||||
return unless $level;
|
return unless $level;
|
||||||
PTDEBUG && _d('Found slave:', $dp->as_string($dsn));
|
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;
|
return;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -3763,7 +3772,7 @@ sub get_connected_slaves {
|
|||||||
die "You do not have the PROCESS privilege";
|
die "You do not have the PROCESS privilege";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SHOW PROCESSLIST';
|
$sql = 'SHOW FULL PROCESSLIST';
|
||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
grep { $_->{command} =~ m/Binlog Dump/i }
|
grep { $_->{command} =~ m/Binlog Dump/i }
|
||||||
map { # Lowercase the column names
|
map { # Lowercase the column names
|
||||||
|
|||||||
@@ -112,23 +112,22 @@ use warnings FATAL => 'all';
|
|||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
sub check_recursion_method {
|
sub check_recursion_method {
|
||||||
my ($methods) = @_;
|
my ($methods) = @_;
|
||||||
|
if ( @$methods != 1 ) {
|
||||||
if ( @$methods != 1 ) {
|
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
&& $methods->[0] !~ /^dsn=/i )
|
||||||
&& $methods->[0] !~ /^dsn=/i )
|
{
|
||||||
{
|
die "Invalid combination of recursion methods: "
|
||||||
die "Invalid combination of recursion methods: "
|
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
||||||
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
. "Only hosts and processlist may be combined.\n"
|
||||||
. "Only hosts and processlist may be combined.\n"
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
|
||||||
my ($method) = @$methods;
|
my ($method) = @$methods;
|
||||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
@@ -164,7 +163,8 @@ sub get_slaves {
|
|||||||
die "I need a $arg argument" unless $args{$arg};
|
die "I need a $arg argument" unless $args{$arg};
|
||||||
}
|
}
|
||||||
my ($dbh, $dsn) = @args{@required_args};
|
my ($dbh, $dsn) = @args{@required_args};
|
||||||
|
my $o = $self->{OptionParser};
|
||||||
|
|
||||||
$self->recurse_to_slaves(
|
$self->recurse_to_slaves(
|
||||||
{ dbh => $dbh,
|
{ dbh => $dbh,
|
||||||
dsn => $dsn,
|
dsn => $dsn,
|
||||||
@@ -172,7 +172,16 @@ sub get_slaves {
|
|||||||
my ( $dsn, $dbh, $level, $parent ) = @_;
|
my ( $dsn, $dbh, $level, $parent ) = @_;
|
||||||
return unless $level;
|
return unless $level;
|
||||||
PTDEBUG && _d('Found slave:', $dp->as_string($dsn));
|
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;
|
return;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -370,7 +379,7 @@ sub get_connected_slaves {
|
|||||||
die "You do not have the PROCESS privilege";
|
die "You do not have the PROCESS privilege";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SHOW PROCESSLIST';
|
$sql = 'SHOW FULL PROCESSLIST';
|
||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
grep { $_->{command} =~ m/Binlog Dump/i }
|
grep { $_->{command} =~ m/Binlog Dump/i }
|
||||||
map { # Lowercase the column names
|
map { # Lowercase the column names
|
||||||
|
|||||||
43
bin/pt-kill
43
bin/pt-kill
@@ -3775,23 +3775,22 @@ use warnings FATAL => 'all';
|
|||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
sub check_recursion_method {
|
sub check_recursion_method {
|
||||||
my ($methods) = @_;
|
my ($methods) = @_;
|
||||||
|
if ( @$methods != 1 ) {
|
||||||
if ( @$methods != 1 ) {
|
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
&& $methods->[0] !~ /^dsn=/i )
|
||||||
&& $methods->[0] !~ /^dsn=/i )
|
{
|
||||||
{
|
die "Invalid combination of recursion methods: "
|
||||||
die "Invalid combination of recursion methods: "
|
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
||||||
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
. "Only hosts and processlist may be combined.\n"
|
||||||
. "Only hosts and processlist may be combined.\n"
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
|
||||||
my ($method) = @$methods;
|
my ($method) = @$methods;
|
||||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
@@ -3827,7 +3826,8 @@ sub get_slaves {
|
|||||||
die "I need a $arg argument" unless $args{$arg};
|
die "I need a $arg argument" unless $args{$arg};
|
||||||
}
|
}
|
||||||
my ($dbh, $dsn) = @args{@required_args};
|
my ($dbh, $dsn) = @args{@required_args};
|
||||||
|
my $o = $self->{OptionParser};
|
||||||
|
|
||||||
$self->recurse_to_slaves(
|
$self->recurse_to_slaves(
|
||||||
{ dbh => $dbh,
|
{ dbh => $dbh,
|
||||||
dsn => $dsn,
|
dsn => $dsn,
|
||||||
@@ -3835,7 +3835,16 @@ sub get_slaves {
|
|||||||
my ( $dsn, $dbh, $level, $parent ) = @_;
|
my ( $dsn, $dbh, $level, $parent ) = @_;
|
||||||
return unless $level;
|
return unless $level;
|
||||||
PTDEBUG && _d('Found slave:', $dp->as_string($dsn));
|
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;
|
return;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4111,7 +4111,7 @@ sub get_slaves {
|
|||||||
}
|
}
|
||||||
my ($dbh, $dsn) = @args{@required_args};
|
my ($dbh, $dsn) = @args{@required_args};
|
||||||
my $o = $self->{OptionParser};
|
my $o = $self->{OptionParser};
|
||||||
|
|
||||||
$self->recurse_to_slaves(
|
$self->recurse_to_slaves(
|
||||||
{ dbh => $dbh,
|
{ dbh => $dbh,
|
||||||
dsn => $dsn,
|
dsn => $dsn,
|
||||||
@@ -4326,7 +4326,7 @@ sub get_connected_slaves {
|
|||||||
die "You do not have the PROCESS privilege";
|
die "You do not have the PROCESS privilege";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SHOW PROCESSLIST';
|
$sql = 'SHOW FULL PROCESSLIST';
|
||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
grep { $_->{command} =~ m/Binlog Dump/i }
|
grep { $_->{command} =~ m/Binlog Dump/i }
|
||||||
map { # Lowercase the column names
|
map { # Lowercase the column names
|
||||||
|
|||||||
@@ -10436,7 +10436,8 @@ sub get_slaves {
|
|||||||
die "I need a $arg argument" unless $args{$arg};
|
die "I need a $arg argument" unless $args{$arg};
|
||||||
}
|
}
|
||||||
my ($dbh, $dsn) = @args{@required_args};
|
my ($dbh, $dsn) = @args{@required_args};
|
||||||
|
my $o = $self->{OptionParser};
|
||||||
|
|
||||||
$self->recurse_to_slaves(
|
$self->recurse_to_slaves(
|
||||||
{ dbh => $dbh,
|
{ dbh => $dbh,
|
||||||
dsn => $dsn,
|
dsn => $dsn,
|
||||||
@@ -10444,7 +10445,16 @@ sub get_slaves {
|
|||||||
my ( $dsn, $dbh, $level, $parent ) = @_;
|
my ( $dsn, $dbh, $level, $parent ) = @_;
|
||||||
return unless $level;
|
return unless $level;
|
||||||
PTDEBUG && _d('Found slave:', $dp->as_string($dsn));
|
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;
|
return;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -10642,7 +10652,7 @@ sub get_connected_slaves {
|
|||||||
die "You do not have the PROCESS privilege";
|
die "You do not have the PROCESS privilege";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SHOW PROCESSLIST';
|
$sql = 'SHOW FULL PROCESSLIST';
|
||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
grep { $_->{command} =~ m/Binlog Dump/i }
|
grep { $_->{command} =~ m/Binlog Dump/i }
|
||||||
map { # Lowercase the column names
|
map { # Lowercase the column names
|
||||||
|
|||||||
@@ -2212,23 +2212,22 @@ use warnings FATAL => 'all';
|
|||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
sub check_recursion_method {
|
sub check_recursion_method {
|
||||||
my ($methods) = @_;
|
my ($methods) = @_;
|
||||||
|
if ( @$methods != 1 ) {
|
||||||
if ( @$methods != 1 ) {
|
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
&& $methods->[0] !~ /^dsn=/i )
|
||||||
&& $methods->[0] !~ /^dsn=/i )
|
{
|
||||||
{
|
die "Invalid combination of recursion methods: "
|
||||||
die "Invalid combination of recursion methods: "
|
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
||||||
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
. "Only hosts and processlist may be combined.\n"
|
||||||
. "Only hosts and processlist may be combined.\n"
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
|
||||||
my ($method) = @$methods;
|
my ($method) = @$methods;
|
||||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
@@ -2264,7 +2263,8 @@ sub get_slaves {
|
|||||||
die "I need a $arg argument" unless $args{$arg};
|
die "I need a $arg argument" unless $args{$arg};
|
||||||
}
|
}
|
||||||
my ($dbh, $dsn) = @args{@required_args};
|
my ($dbh, $dsn) = @args{@required_args};
|
||||||
|
my $o = $self->{OptionParser};
|
||||||
|
|
||||||
$self->recurse_to_slaves(
|
$self->recurse_to_slaves(
|
||||||
{ dbh => $dbh,
|
{ dbh => $dbh,
|
||||||
dsn => $dsn,
|
dsn => $dsn,
|
||||||
@@ -2272,7 +2272,16 @@ sub get_slaves {
|
|||||||
my ( $dsn, $dbh, $level, $parent ) = @_;
|
my ( $dsn, $dbh, $level, $parent ) = @_;
|
||||||
return unless $level;
|
return unless $level;
|
||||||
PTDEBUG && _d('Found slave:', $dp->as_string($dsn));
|
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;
|
return;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -2470,7 +2479,7 @@ sub get_connected_slaves {
|
|||||||
die "You do not have the PROCESS privilege";
|
die "You do not have the PROCESS privilege";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SHOW PROCESSLIST';
|
$sql = 'SHOW FULL PROCESSLIST';
|
||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
grep { $_->{command} =~ m/Binlog Dump/i }
|
grep { $_->{command} =~ m/Binlog Dump/i }
|
||||||
map { # Lowercase the column names
|
map { # Lowercase the column names
|
||||||
|
|||||||
@@ -2623,23 +2623,22 @@ use warnings FATAL => 'all';
|
|||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
sub check_recursion_method {
|
sub check_recursion_method {
|
||||||
my ($methods) = @_;
|
my ($methods) = @_;
|
||||||
|
if ( @$methods != 1 ) {
|
||||||
if ( @$methods != 1 ) {
|
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
&& $methods->[0] !~ /^dsn=/i )
|
||||||
&& $methods->[0] !~ /^dsn=/i )
|
{
|
||||||
{
|
die "Invalid combination of recursion methods: "
|
||||||
die "Invalid combination of recursion methods: "
|
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
||||||
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
. "Only hosts and processlist may be combined.\n"
|
||||||
. "Only hosts and processlist may be combined.\n"
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
|
||||||
my ($method) = @$methods;
|
my ($method) = @$methods;
|
||||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
@@ -2675,7 +2674,8 @@ sub get_slaves {
|
|||||||
die "I need a $arg argument" unless $args{$arg};
|
die "I need a $arg argument" unless $args{$arg};
|
||||||
}
|
}
|
||||||
my ($dbh, $dsn) = @args{@required_args};
|
my ($dbh, $dsn) = @args{@required_args};
|
||||||
|
my $o = $self->{OptionParser};
|
||||||
|
|
||||||
$self->recurse_to_slaves(
|
$self->recurse_to_slaves(
|
||||||
{ dbh => $dbh,
|
{ dbh => $dbh,
|
||||||
dsn => $dsn,
|
dsn => $dsn,
|
||||||
@@ -2683,7 +2683,16 @@ sub get_slaves {
|
|||||||
my ( $dsn, $dbh, $level, $parent ) = @_;
|
my ( $dsn, $dbh, $level, $parent ) = @_;
|
||||||
return unless $level;
|
return unless $level;
|
||||||
PTDEBUG && _d('Found slave:', $dp->as_string($dsn));
|
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;
|
return;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -2881,7 +2890,7 @@ sub get_connected_slaves {
|
|||||||
die "You do not have the PROCESS privilege";
|
die "You do not have the PROCESS privilege";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SHOW PROCESSLIST';
|
$sql = 'SHOW FULL PROCESSLIST';
|
||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
grep { $_->{command} =~ m/Binlog Dump/i }
|
grep { $_->{command} =~ m/Binlog Dump/i }
|
||||||
map { # Lowercase the column names
|
map { # Lowercase the column names
|
||||||
|
|||||||
@@ -5003,23 +5003,22 @@ use warnings FATAL => 'all';
|
|||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
sub check_recursion_method {
|
sub check_recursion_method {
|
||||||
my ($methods) = @_;
|
my ($methods) = @_;
|
||||||
|
if ( @$methods != 1 ) {
|
||||||
if ( @$methods != 1 ) {
|
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
&& $methods->[0] !~ /^dsn=/i )
|
||||||
&& $methods->[0] !~ /^dsn=/i )
|
{
|
||||||
{
|
die "Invalid combination of recursion methods: "
|
||||||
die "Invalid combination of recursion methods: "
|
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
||||||
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
. "Only hosts and processlist may be combined.\n"
|
||||||
. "Only hosts and processlist may be combined.\n"
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
|
||||||
my ($method) = @$methods;
|
my ($method) = @$methods;
|
||||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
@@ -5055,7 +5054,8 @@ sub get_slaves {
|
|||||||
die "I need a $arg argument" unless $args{$arg};
|
die "I need a $arg argument" unless $args{$arg};
|
||||||
}
|
}
|
||||||
my ($dbh, $dsn) = @args{@required_args};
|
my ($dbh, $dsn) = @args{@required_args};
|
||||||
|
my $o = $self->{OptionParser};
|
||||||
|
|
||||||
$self->recurse_to_slaves(
|
$self->recurse_to_slaves(
|
||||||
{ dbh => $dbh,
|
{ dbh => $dbh,
|
||||||
dsn => $dsn,
|
dsn => $dsn,
|
||||||
@@ -5063,7 +5063,16 @@ sub get_slaves {
|
|||||||
my ( $dsn, $dbh, $level, $parent ) = @_;
|
my ( $dsn, $dbh, $level, $parent ) = @_;
|
||||||
return unless $level;
|
return unless $level;
|
||||||
PTDEBUG && _d('Found slave:', $dp->as_string($dsn));
|
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;
|
return;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -5261,7 +5270,7 @@ sub get_connected_slaves {
|
|||||||
die "You do not have the PROCESS privilege";
|
die "You do not have the PROCESS privilege";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SHOW PROCESSLIST';
|
$sql = 'SHOW FULL PROCESSLIST';
|
||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
grep { $_->{command} =~ m/Binlog Dump/i }
|
grep { $_->{command} =~ m/Binlog Dump/i }
|
||||||
map { # Lowercase the column names
|
map { # Lowercase the column names
|
||||||
|
|||||||
@@ -6585,23 +6585,22 @@ use warnings FATAL => 'all';
|
|||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
sub check_recursion_method {
|
sub check_recursion_method {
|
||||||
my ($methods) = @_;
|
my ($methods) = @_;
|
||||||
|
if ( @$methods != 1 ) {
|
||||||
if ( @$methods != 1 ) {
|
if ( grep({ !m/processlist|hosts/i } @$methods)
|
||||||
if ( grep({ !m/processlist|hosts/i } @$methods)
|
&& $methods->[0] !~ /^dsn=/i )
|
||||||
&& $methods->[0] !~ /^dsn=/i )
|
{
|
||||||
{
|
die "Invalid combination of recursion methods: "
|
||||||
die "Invalid combination of recursion methods: "
|
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
||||||
. join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". "
|
. "Only hosts and processlist may be combined.\n"
|
||||||
. "Only hosts and processlist may be combined.\n"
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
|
||||||
my ($method) = @$methods;
|
my ($method) = @$methods;
|
||||||
die "Invalid recursion method: " . ( $method || 'undef' )
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
@@ -6637,7 +6636,8 @@ sub get_slaves {
|
|||||||
die "I need a $arg argument" unless $args{$arg};
|
die "I need a $arg argument" unless $args{$arg};
|
||||||
}
|
}
|
||||||
my ($dbh, $dsn) = @args{@required_args};
|
my ($dbh, $dsn) = @args{@required_args};
|
||||||
|
my $o = $self->{OptionParser};
|
||||||
|
|
||||||
$self->recurse_to_slaves(
|
$self->recurse_to_slaves(
|
||||||
{ dbh => $dbh,
|
{ dbh => $dbh,
|
||||||
dsn => $dsn,
|
dsn => $dsn,
|
||||||
@@ -6645,7 +6645,16 @@ sub get_slaves {
|
|||||||
my ( $dsn, $dbh, $level, $parent ) = @_;
|
my ( $dsn, $dbh, $level, $parent ) = @_;
|
||||||
return unless $level;
|
return unless $level;
|
||||||
PTDEBUG && _d('Found slave:', $dp->as_string($dsn));
|
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;
|
return;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -6843,7 +6852,7 @@ sub get_connected_slaves {
|
|||||||
die "You do not have the PROCESS privilege";
|
die "You do not have the PROCESS privilege";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SHOW PROCESSLIST';
|
$sql = 'SHOW FULL PROCESSLIST';
|
||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
grep { $_->{command} =~ m/Binlog Dump/i }
|
grep { $_->{command} =~ m/Binlog Dump/i }
|
||||||
map { # Lowercase the column names
|
map { # Lowercase the column names
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ sub get_connected_slaves {
|
|||||||
die "You do not have the PROCESS privilege";
|
die "You do not have the PROCESS privilege";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SHOW PROCESSLIST';
|
$sql = 'SHOW FULL PROCESSLIST';
|
||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
# It's probably a slave if it's doing a binlog dump.
|
# It's probably a slave if it's doing a binlog dump.
|
||||||
grep { $_->{command} =~ m/Binlog Dump/i }
|
grep { $_->{command} =~ m/Binlog Dump/i }
|
||||||
|
|||||||
Reference in New Issue
Block a user