Make pt-table-checksum/relication_filters.t and progress.t stable. Add PerconaTest::wait_until_no_lag(). Fix sandbox/test-env reset.

This commit is contained in:
Daniel Nichter
2012-06-04 07:33:14 -07:00
parent e7b2171696
commit 4e90f65736
5 changed files with 72 additions and 72 deletions

View File

@@ -236,6 +236,26 @@ sub wait_until {
return 0;
}
sub wait_until_no_lag {
my (@dbhs) = @_;
foreach my $dbh (@dbhs) {
PTDEVDEBUG && _d('Waiting for no slave lag');
wait_until( # slaves aren't lagging
sub {
my $row = $dbh->selectrow_hashref('SHOW SLAVE STATUS');
my $lag = exists $row->{Seconds_Behind_Master}
? $row->{Seconds_Behind_Master}
: $row->{seconds_behind_master};
PTDEVDEBUG && _d('Slave lag:', $lag);
if ( !defined $lag ) {
BAIL_OUT("Slave is stopped: " . Dumper($row));
}
return $lag ? 0 : 1;
}
);
}
}
# Wait t seconds for code to return.
sub wait_for {
my ( $code, $t ) = @_;