mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-06 12:27:56 +00:00
PT-139 wait_for_master returns error if no channel was specified in a multi master env
This commit is contained in:
@@ -6237,6 +6237,9 @@ sub lock_and_wait {
|
||||
slave_dbh => $dst->{dbh},
|
||||
timeout => $timeout,
|
||||
);
|
||||
if ($wait->{error}) {
|
||||
die $result->{error};
|
||||
}
|
||||
if ( defined $wait->{result} && $wait->{result} != -1 ) {
|
||||
return; # slave caught up
|
||||
}
|
||||
@@ -7011,6 +7014,15 @@ 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 =>'This server returned more than one row for SHOW SLAVE STATUS 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)";
|
||||
@@ -7030,6 +7042,7 @@ sub wait_for_master {
|
||||
return {
|
||||
result => $result,
|
||||
waited => $waited,
|
||||
error => undef,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7079,6 +7092,10 @@ 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