5s default wait_until() time. Wait 5m instead of 16m for wipe_clean(). Don't connect to slave2 in wipe_clean() any longer.

This commit is contained in:
Daniel Nichter
2012-06-06 11:43:56 -07:00
parent 805b9dec4a
commit 14b615ebd9
2 changed files with 4 additions and 6 deletions

View File

@@ -233,7 +233,7 @@ sub parse_file {
sub wait_until { sub wait_until {
my ( $code, $t, $max_t ) = @_; my ( $code, $t, $max_t ) = @_;
$t ||= .20; $t ||= .20;
$max_t ||= 5; $max_t ||= 30;
my $slept = 0; my $slept = 0;
while ( $slept <= $max_t ) { while ( $slept <= $max_t ) {

View File

@@ -185,9 +185,8 @@ sub wipe_clean {
$dbh->do("DROP DATABASE IF EXISTS `$db`"); $dbh->do("DROP DATABASE IF EXISTS `$db`");
} }
my $slave2_dbh = $self->get_dbh_for('slave2');
$self->wait_for_slaves(); $self->wait_for_slaves();
$slave2_dbh->disconnect;
return; return;
} }
@@ -311,8 +310,7 @@ sub ok {
return !@errors; return !@errors;
} }
# Dings a heartbeat on the master, and waits until the slave catches up fully to # Dings a heartbeat on the master, and waits until the slave catches up fully.
# that.
sub wait_for_slaves { sub wait_for_slaves {
my $self = shift; my $self = shift;
my $now = time(); my $now = time();
@@ -324,7 +322,7 @@ sub wait_for_slaves {
my $then = $slave2_dbh->selectall_arrayref( my $then = $slave2_dbh->selectall_arrayref(
"select a from percona_test.sentinel where id = 1")->[0]->[0]; "select a from percona_test.sentinel where id = 1")->[0]->[0];
return $now == $then; return $now == $then;
}, undef, 1000 }, undef, 300
); );
} }