mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-26 15:31:55 +00:00
fix problems with sandbox breaking replication and pt-slave-delay
This commit is contained in:
@@ -32,6 +32,8 @@ use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use English qw(-no_match_vars);
|
||||
use Time::HiRes qw(sleep);
|
||||
use Data::Dumper;
|
||||
$Data::Dumper::Indent = 1;
|
||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
my $trunk = $ENV{PERCONA_TOOLKIT_BRANCH};
|
||||
@@ -197,13 +199,15 @@ sub slave_is_ok {
|
||||
if ( $status->[0]->{last_error} ) {
|
||||
warn "Sandbox $slave " . $port_for{$slave} . " is broken: "
|
||||
. $status->[0]->{last_error} . "\n";
|
||||
warn Dumper($status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
foreach my $thd ( qw(slave_io_running slave_sql_running) ) {
|
||||
if ( $status->[0]->{$thd} ne 'Yes' ) {
|
||||
if ( ($status->[0]->{$thd} || 'No') eq 'No' ) {
|
||||
warn "Sandbox $slave " . $port_for{$slave} . " $thd thread "
|
||||
. "is not running\n";
|
||||
warn Dumper($status);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -217,11 +221,7 @@ sub slave_is_ok {
|
||||
}
|
||||
}
|
||||
|
||||
if ( !defined $status->[0]->{seconds_behind_master} ) {
|
||||
warn "Sandbox $slave " . $port_for{$slave} . " is stopped\n";
|
||||
return 0;
|
||||
}
|
||||
elsif ( $status->[0]->{seconds_behind_master} > 0 ) {
|
||||
if ( ($status->[0]->{seconds_behind_master} || 0) > 0 ) {
|
||||
my $sleep_t = 0.25;
|
||||
my $total_t = 0;
|
||||
while ( defined $status->[0]->{seconds_behind_master}
|
||||
|
@@ -27,7 +27,7 @@ elsif ( !$slave_dbh ) {
|
||||
plan skip_all => 'Cannot connect to second sandbox master';
|
||||
}
|
||||
else {
|
||||
plan tests => 7;
|
||||
plan tests => 6;
|
||||
}
|
||||
|
||||
my $output;
|
||||
@@ -84,6 +84,13 @@ like(
|
||||
'No SLAVE STATUS on master'
|
||||
);
|
||||
|
||||
# Sometimes the slave will be in a state of "reconnecting to master" that will
|
||||
# take a while. Help that along. But, we've disconnected $slave_dbh by doing
|
||||
# 'stop' on the sandbox above, so we need to reconnect.
|
||||
$slave_dbh = $sb->get_dbh_for('slave1');
|
||||
$slave_dbh->do('STOP SLAVE');
|
||||
$slave_dbh->do('START SLAVE');
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
Reference in New Issue
Block a user