3.0.5 Testing

This commit is contained in:
Carlos Salguero
2017-11-07 17:52:14 -03:00
parent a7d4439155
commit e428fa5187
24 changed files with 186 additions and 75 deletions

View File

@@ -45,7 +45,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -3613,8 +3613,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -3876,6 +3875,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -3887,8 +3887,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -3898,7 +3897,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -3949,6 +3952,14 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status = $self->get_slave_status($slave_dbh);
if (!$slave_status) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -4017,6 +4028,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {

View File

@@ -43,7 +43,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';

View File

@@ -42,7 +42,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';

View File

@@ -38,7 +38,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';

View File

@@ -39,7 +39,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';

View File

@@ -35,7 +35,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';

View File

@@ -37,7 +37,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';

View File

@@ -44,7 +44,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -188,8 +188,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -451,6 +450,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -462,8 +462,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -473,7 +472,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -524,6 +527,14 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status = $self->get_slave_status($slave_dbh);
if (!$slave_status) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -592,6 +603,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {

View File

@@ -45,7 +45,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';

View File

@@ -3894,8 +3894,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -4157,6 +4156,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -4168,8 +4168,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -4179,7 +4178,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -4230,6 +4233,14 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status = $self->get_slave_status($slave_dbh);
if (!$slave_status) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -4298,6 +4309,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {

View File

@@ -4216,8 +4216,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -4479,6 +4478,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -4490,8 +4490,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -4501,7 +4500,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -4552,6 +4555,14 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status = $self->get_slave_status($slave_dbh);
if (!$slave_status) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -4620,6 +4631,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {

View File

@@ -64,7 +64,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -10512,8 +10512,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -10775,6 +10774,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -10786,8 +10786,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -10797,7 +10796,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -10848,6 +10851,14 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status = $self->get_slave_status($slave_dbh);
if (!$slave_status) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -10916,6 +10927,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {

View File

@@ -40,7 +40,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';

View File

@@ -2302,8 +2302,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -2565,6 +2564,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -2576,8 +2576,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -2587,7 +2586,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -2638,6 +2641,14 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status = $self->get_slave_status($slave_dbh);
if (!$slave_status) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -2706,6 +2717,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {

View File

@@ -41,7 +41,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -2713,8 +2713,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -2976,6 +2975,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -2987,8 +2987,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -2998,7 +2997,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -3049,6 +3052,14 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status = $self->get_slave_status($slave_dbh);
if (!$slave_status) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -3117,6 +3128,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {

View File

@@ -57,7 +57,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -5124,8 +5124,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -5387,6 +5386,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -5398,8 +5398,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -5409,7 +5408,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -5460,6 +5463,14 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status = $self->get_slave_status($slave_dbh);
if (!$slave_status) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -5528,6 +5539,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {
@@ -8533,7 +8547,6 @@ sub wait {
PTDEBUG && _d('Checking slave lag');
for my $i ( 0..$#lagged_slaves ) {
my $lag = $get_lag->($lagged_slaves[$i]->{cxn});
die "Please restart the program using --channel=<channel name>" if !defined($lag);
PTDEBUG && _d($lagged_slaves[$i]->{cxn}->name(),
'slave lag:', $lag);
if ( !defined $lag || $lag > $max_lag ) {

View File

@@ -55,7 +55,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -6696,8 +6696,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -6959,6 +6958,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -6970,8 +6970,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -6981,7 +6980,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -7037,10 +7040,9 @@ sub wait_for_master {
return {
result => undef,
waited => 0,
error =>'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line',
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -7060,7 +7062,6 @@ sub wait_for_master {
return {
result => $result,
waited => $waited,
error => undef,
};
}
@@ -7113,7 +7114,6 @@ sub catchup_to_master {
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {

View File

@@ -61,7 +61,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';

View File

@@ -44,7 +44,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';