diff options
author | Matthias Leich <Matthias.Leich@sun.com> | 2008-11-21 22:28:23 +0100 |
---|---|---|
committer | Matthias Leich <Matthias.Leich@sun.com> | 2008-11-21 22:28:23 +0100 |
commit | d082cf340ce870691e4c944c0cc0c85ce65223cc (patch) | |
tree | 6d4cda5f97304f7cdaa186398bb8205b8c0c8631 /mysql-test | |
parent | 58fddfccddd0857cd7ab15d13d42efc37e8191ef (diff) | |
download | mariadb-git-d082cf340ce870691e4c944c0cc0c85ce65223cc.tar.gz |
- Fix for Bug#39854 events_scheduling fails sporadically on pushbuild
- restore original state of event_scheduler at the end of the test
- minor fixes around comments, formatting
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/events_scheduling.result | 9 | ||||
-rw-r--r-- | mysql-test/t/events_scheduling.test | 33 |
2 files changed, 27 insertions, 15 deletions
diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result index b7d4578bede..63140bffaa4 100644 --- a/mysql-test/r/events_scheduling.result +++ b/mysql-test/r/events_scheduling.result @@ -1,7 +1,8 @@ CREATE DATABASE IF NOT EXISTS events_test; USE events_test; +SET @event_scheduler=@@global.event_scheduler; SET GLOBAL event_scheduler=OFF; -Try agian to make sure it's allowed +Try again to make sure it's allowed SET GLOBAL event_scheduler=OFF; SHOW VARIABLES LIKE 'event_scheduler'; Variable_name Value @@ -64,8 +65,8 @@ INSERT INTO table_4 VALUES (1); SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1; IF(SUM(a) >= 4, 'OK', 'ERROR') OK -SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2; -IF(SUM(a) >= 5, 'OK', 'ERROR') +SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_2; +IF(SUM(a) >= 4, 'OK', 'ERROR') OK SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3; IF(SUM(a) >= 1, 'OK', 'ERROR') @@ -94,4 +95,4 @@ DROP TABLE table_2; DROP TABLE table_3; DROP TABLE table_4; DROP DATABASE events_test; -SET GLOBAL event_scheduler=OFF; +SET GLOBAL event_scheduler=@event_scheduler; diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test index a5133166495..87cfa42e283 100644 --- a/mysql-test/t/events_scheduling.test +++ b/mysql-test/t/events_scheduling.test @@ -1,11 +1,12 @@ -# Can't test with embedded server that doesn't support grants +# Can't test with embedded server that doesn't support events -- source include/not_embedded.inc CREATE DATABASE IF NOT EXISTS events_test; USE events_test; +SET @event_scheduler=@@global.event_scheduler; SET GLOBAL event_scheduler=OFF; ---echo Try agian to make sure it's allowed +--echo Try again to make sure it's allowed SET GLOBAL event_scheduler=OFF; SHOW VARIABLES LIKE 'event_scheduler'; SET GLOBAL event_scheduler=1; @@ -57,34 +58,44 @@ ON COMPLETION PRESERVE DO INSERT INTO table_4 VALUES (1); +# Wait for the events to fire and check the data afterwards + # Let event_1 insert at least 4 records into the table let $wait_condition=select count(*) >= 4 from table_1; --source include/wait_condition.inc +# Minimum of passed time is 6 seconds assuming +# - event executions starts immediate after creation +# - 4 times event_1 means an insert at ect, ect+2, ect+4, ect+6 +# ect = event creation time -# Let event_2 reach the end of its execution interval +# Let event_2 reach the end of its execution interval let $wait_condition=select count(*) = 0 from information_schema.events where event_name='event_2' and status='enabled'; --source include/wait_condition.inc +# Minimum of passed time is 6 seconds. +# See wait_condition for event_1 above and ENDS condition for event_2. -# Let event_3, which is ON COMPLETION NOT PRESERVE execute and drop itself +# Let event_3, which is ON COMPLETION NOT PRESERVE execute and drop itself let $wait_condition=select count(*) = 0 from information_schema.events where event_name='event_3'; --source include/wait_condition.inc -# Let event_4 reach the end of its execution interval +# Let event_4 reach the end of its execution interval let $wait_condition=select count(*) = 0 from information_schema.events where event_name='event_4' and status='enabled'; --source include/wait_condition.inc -# Wait for the events to fire and check the data afterwards - let $wait_condition=SELECT SUM(a) >= 4 FROM table_1; source include/wait_condition.inc; SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1; -let $wait_condition=SELECT SUM(a) >= 5 FROM table_2; +# In case of a testing box under heavy load it cannot be guaranteed that +# it is really often enough checked if event_2 has to be executed. +# -> Bug#39854 events_scheduling fails sporadically on pushbuild +# Therefore we lowered here the original expectation of 5 to 4. +let $wait_condition=SELECT SUM(a) >= 4 FROM table_2; source include/wait_condition.inc; -SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2; +SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_2; let $wait_condition=SELECT SUM(a) >= 1 FROM table_3; source include/wait_condition.inc; @@ -112,9 +123,9 @@ DROP TABLE table_2; DROP TABLE table_3; DROP TABLE table_4; DROP DATABASE events_test; -SET GLOBAL event_scheduler=OFF; +SET GLOBAL event_scheduler=@event_scheduler; -# +# # End of tests # |