diff options
author | unknown <kroki/tomash@moonlight.home> | 2007-01-19 18:33:48 +0300 |
---|---|---|
committer | unknown <kroki/tomash@moonlight.home> | 2007-01-19 18:33:48 +0300 |
commit | 35fdeff81f3c44609bf43899703ae47c6459605d (patch) | |
tree | 278d9fd8d4a743095fcc6f62ae13cc766c0a33ee /mysql-test/include/wait_until_rows_count.inc | |
parent | 5d92d2d7cf4ba64bdd9eed8d843221a4a476915d (diff) | |
download | mariadb-git-35fdeff81f3c44609bf43899703ae47c6459605d.tar.gz |
BUG#25211: events_bugs.test fails on sapsrv1
The problem was that the events_bugs test could randomly fail due to
races in the test case.
The solution is to replace fixed sleeps with reliable polling of a
certain state to settle. For that, a new auxiliary script
include/wait_condition.inc is used, that allows waiting for a given
query to return true.
mysql-test/include/wait_until_rows_count.inc:
Script is rewritten using new include/wait_condition.inc.
mysql-test/r/events_bugs.result:
Update result: add missing quotation mark.
mysql-test/t/events_bugs.test:
Replace --sleep with the reliable waiting for a certain state.
mysql-test/include/wait_condition.inc:
New BitKeeper file ``mysql-test/include/wait_condition.inc''
Diffstat (limited to 'mysql-test/include/wait_until_rows_count.inc')
-rw-r--r-- | mysql-test/include/wait_until_rows_count.inc | 50 |
1 files changed, 9 insertions, 41 deletions
diff --git a/mysql-test/include/wait_until_rows_count.inc b/mysql-test/include/wait_until_rows_count.inc index cf2a21d335a..f1b79c54424 100644 --- a/mysql-test/include/wait_until_rows_count.inc +++ b/mysql-test/include/wait_until_rows_count.inc @@ -1,52 +1,20 @@ # include/wait_until_rows_count.inc -# inspired by wait_for_slave_status by Matthias Leich # # SUMMARY # -# Waits until SELECT count(*)-$count from $table returns zero +# Waits until SELECT count(*) = $count from $table returns true, or +# the operation times out. # # USAGE # -# Set vars like -# let $count=11; -# let $table=t1; -# # invoke the macro -# --include wait_until_rows_count.inc +# let $count= 5; +# let $table= t1; +# --source include/wait_until_rows_count.inc # # EXAMPLE -# extra/binlog/binlog_insert_delayed.test +# extra/binlog/binlog_insert_delayed.test # -# -# TODO: generalize up to wait_[until|while] with arbitrary select or even query and -# a condition to wait or get awakened -# It's impossible to implement such a "most" general macro without -# extending mysqltest. Just no way to pass a query as an argument and -# evaluate it here, like eval "$quuery". One is bound -# to specify it inside of the macro - ---disable_query_log - -let $wait_counter= 300; # max wait in 0.1 seconds -while ($wait_counter) -{ - eval select count(*)-$count from $table into @rez; - let $rez=`select @rez`; - let $success=`SELECT @rez = 0`; - let $no_success=1; - if ($success) - { - let $wait_counter= 1; # droppping counter to leave loop - let $no_success=0; - } - if ($no_success) - { - --sleep 0.1 - } - dec $wait_counter; -} ---enable_query_log -if ($no_success) -{ - --die Timeout in wait_until_rows_count.inc, required table never had a prescribed number of rows. -} +let $wait_condition= + select count(*) = $count from $table; +--source include/wait_condition.inc |