mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-28 08:51:44 +00:00
3.0.5 Testing
This commit is contained in:
@@ -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) ) {
|
||||
|
Reference in New Issue
Block a user