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/t/events_bugs.test | |
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/t/events_bugs.test')
-rw-r--r-- | mysql-test/t/events_bugs.test | 97 |
1 files changed, 84 insertions, 13 deletions
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test index e9751608a46..26abf663ce1 100644 --- a/mysql-test/t/events_bugs.test +++ b/mysql-test/t/events_bugs.test @@ -78,8 +78,13 @@ begin drop table "hashed_num"; end| delimiter ;| ---sleep 0.8 ---echo "Now if everything is fine the event has compiled and is locked + +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where info = 'select get_lock(\'test_bug16407\', 60)'; +--source include/wait_condition.inc + +--echo "Now if everything is fine the event has compiled and is locked" select /*1*/ user, host, db, info from information_schema.processlist where command!='Daemon' and (info is null or info not like '%processlist%') order by info; select release_lock('test_bug16407'); @@ -127,10 +132,22 @@ begin end| delimiter ;| select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; ---sleep 1 + +let $wait_condition= + select count(*) = 3 from information_schema.processlist + where info = 'select get_lock(\'ee_16407_2\', 60)'; +--source include/wait_condition.inc + select /*2*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info; select release_lock('ee_16407_2'); ---sleep 1.2 + +let $wait_condition= + select count(*) = 1 and user = 'event_scheduler' and info is null + from information_schema.processlist + where (command!='Daemon' || user='event_scheduler') + and (info is null or info not like '%processlist%'); +--source include/wait_condition.inc + select /*3*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info; set global event_scheduler= off; select * from events_smode_test order by ev_name, a; @@ -150,6 +167,7 @@ set global event_scheduler= on; set sql_mode='traditional'; delimiter |; +# ee_16407_5_pendant() should not insert anything because of invalid date. create procedure ee_16407_5_pendant() begin insert into events_test.events_smode_test values('ee_16407_5','2001-02-29'); end| create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end| create event ee_16407_5 on schedule every 60 second do @@ -165,11 +183,23 @@ begin call events_test.ee_16407_6_pendant(); end| delimiter ;| ---sleep 1 + +let $wait_condition= + select count(*) = 2 from information_schema.processlist + where info = 'select get_lock(\'ee_16407_5\', 60)'; +--source include/wait_condition.inc + --echo "Should have 2 locked processes" select /*4*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info; select release_lock('ee_16407_5'); ---sleep 1.3 + +let $wait_condition= + select count(*) = 1 and user = 'event_scheduler' and info is null + from information_schema.processlist + where (command!='Daemon' || user='event_scheduler') + and (info is null or info not like '%processlist%'); +--source include/wait_condition.inc + --echo "Should have 0 processes locked" select /*5*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info; select * from events_smode_test order by ev_name, a; @@ -272,17 +302,58 @@ insert into t1 values (2); create table t2 (a char(20)); insert into t2 values ("e22830_1"); create function f22830 () returns int return 5; + +select get_lock('ee_22830', 60); +set global event_scheduler=on; + +delimiter |; +create procedure p22830_wait() +begin + select get_lock('ee_22830', 60); + select release_lock('ee_22830'); +end| + --error ER_NOT_SUPPORTED_YET -create event e22830 on schedule every f22830() second do select 123; -create event e22830_1 on schedule every 1 hour do alter event e22830_1 on schedule every (select 8 from dual) hour; -create event e22830_2 on schedule every 1 hour do alter event e22830_2 on schedule every (select 8 from t1) hour; -create event e22830_3 on schedule every 1 hour do alter event e22830_3 on schedule every f22830() hour; -create event e22830_4 on schedule every 1 hour do alter event e22830_4 on schedule every (select f22830() from dual) hour; +create event e22830 on schedule every f22830() second do +begin + call p22830_wait(); + select 123; +end| +create event e22830_1 on schedule every 1 hour do +begin + call p22830_wait(); + alter event e22830_1 on schedule every (select 8 from dual) hour; +end| +create event e22830_2 on schedule every 1 hour do +begin + call p22830_wait(); + alter event e22830_2 on schedule every (select 8 from t1) hour; +end| +create event e22830_3 on schedule every 1 hour do +begin + call p22830_wait(); + alter event e22830_3 on schedule every f22830() hour; +end| +create event e22830_4 on schedule every 1 hour do +begin + call p22830_wait(); + alter event e22830_4 on schedule every (select f22830() from dual) hour; +end| +delimiter ;| + +--echo "All events should be blocked in get_lock()" select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name; -set global event_scheduler=on; ---sleep 4 + +select release_lock('ee_22830'); + +let $wait_condition= + select group_concat(interval_value order by interval_value) = '1,1,1,8' + from information_schema.events; +--source include/wait_condition.inc + set global event_scheduler=off; select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name; +drop procedure p22830_wait; drop function f22830; --error ER_PARSE_ERROR drop event (select a from t2); |