Attempt to avoid race condition in t/pt-table-checksum/progress.t by slowing down the checksum job slightly, but this is a TEST_WISHLIST PLUGIN_WISHLIST and this test goes onto the spreadsheet of unreliable tests.

This commit is contained in:
Baron Schwartz
2012-06-05 00:09:31 -04:00
parent d8d019aecc
commit 2d33ba23dc
2 changed files with 29 additions and 3 deletions

View File

@@ -55,6 +55,8 @@ our @EXPORT = qw(
parse_file
wait_until
wait_for
wait_until_slave_running
wait_until_no_lag
test_log_parser
test_protocol_parser
test_packet_parser
@@ -243,6 +245,22 @@ sub wait_until {
return 0;
}
sub wait_until_slave_running {
my (@dbhs) = @_;
foreach my $dbh (@dbhs) {
PTDEVDEBUG && _d('Waiting for slaves to be running');
wait_until(
sub {
my $row = $dbh->selectrow_hashref('SHOW SLAVE STATUS');
my $sqlt = $row->{slave_sql_running} || $row->{Slave_SQL_Running} || 'NULL';
my $iot = $row->{Slave_IO_Running} || $row->{slave_io_running} || 'NULL';
PTDEVDEBUG && _d('Slave SQL:', $sqlt, 'Slave IO:', $iot);
return $sqlt eq 'Yes' && $iot eq 'Yes';
}
);
}
}
sub wait_until_no_lag {
my (@dbhs) = @_;
foreach my $dbh (@dbhs) {

View File

@@ -45,10 +45,13 @@ else {
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
# so we need to specify --lock-wait-timeout=3 else the tool will die.
# And --max-load "" prevents waiting for status variables.
# And --max-load "" prevents waiting for status variables. Setting
# --chunk-size may help prevent the tool from running too fast and finishing
# before the TEST_WISHLIST job below finishes. (Or, it might just make things
# worse. This is a random stab in the dark. There is a problem either way.)
my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
my @args = ($master_dsn, qw(--lock-wait-timeout 3),
'--progress', 'time,1', '--max-load', '');
'--progress', 'time,1', '--max-load', '', '--chunk-size', '500');
my $output;
my $row;
my $scripts = "$trunk/t/pt-table-checksum/scripts/";
@@ -61,11 +64,13 @@ my $scripts = "$trunk/t/pt-table-checksum/scripts/";
$master_dbh->do('drop table if exists percona.checksums');
# Must not be lagging.
PerconaTest::wait_until_no_lag($slave1_dbh, $slave2_dbh);
wait_until_no_lag($slave1_dbh, $slave2_dbh);
# This big fancy command waits until it sees the checksum for sakila.city
# in the repl table on the master, then it stops slave2 for 2 seconds,
# then starts it again.
# TEST_WISHLIST PLUGIN_WISHLIST: do this with a plugin to the tool itself,
# not in this unreliable fashion.
system("$trunk/util/wait-to-exec '$scripts/wait-for-chunk.sh 12345 sakila city 1' '$scripts/exec-wait-exec.sh 12347 \"stop slave sql_thread\" 2 \"start slave sql_thread\"' 3 >/dev/null &");
$output = output(
@@ -91,6 +96,9 @@ is(
"No errors after waiting for slave lag"
);
# Now wait until the SQL thread is started again.
wait_until_slave_running($slave1_dbh, $slave2_dbh);
# #############################################################################
# Done.
# #############################################################################