diff --git a/mysql-test/r/events_logs_tests.result b/mysql-test/r/events_logs_tests.result index e6ca3c29e9b27821cb738189fa7bfc93ab6d3167..ab1666fefb98cb1be939768929c3d93d36e26766 100644 --- a/mysql-test/r/events_logs_tests.result +++ b/mysql-test/r/events_logs_tests.result @@ -43,7 +43,7 @@ SLEEP(3) 0 SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; user_host query_time db sql_text -root[root] @ localhost [] 00:00:03 events_test SELECT SLEEP(3) +root[root] @ localhost [] SLEEPVAL events_test SELECT SLEEP(3) TRUNCATE mysql.slow_log; CREATE TABLE slow_event_test (slo_val tinyint, val tinyint); "This won't go to the slow log" @@ -75,7 +75,7 @@ slo_val val "Check slow log. Should see 1 row because 5 is over the threshold of 4 for GLOBAL, though under SESSION which is 10" SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; user_host query_time db sql_text -root[root] @ localhost [localhost] 00:00:05 events_test INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(5) +root[root] @ localhost [localhost] SLEEPVAL events_test INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(5) DROP EVENT long_event2; SET GLOBAL long_query_time =@old_global_long_query_time; SET SESSION long_query_time =@old_session_long_query_time; diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result index 67e8e6d5691ec7ade8a686743f977f1f8f688128..8b1f29d320fe522d735da8ee315c2e5be60282be 100644 --- a/mysql-test/r/events_scheduling.result +++ b/mysql-test/r/events_scheduling.result @@ -4,7 +4,9 @@ CREATE TABLE table_1(a int); CREATE TABLE table_2(a int); CREATE TABLE table_3(a int); CREATE TABLE table_4(a int); +CREATE TABLE T19170(s1 TIMESTAMP); SET GLOBAL event_scheduler=1; +CREATE EVENT E19170 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO T19170 VALUES(CURRENT_TIMESTAMP); CREATE EVENT two_sec ON SCHEDULE EVERY 2 SECOND DO INSERT INTO table_1 VALUES(1); CREATE EVENT start_n_end ON SCHEDULE EVERY 1 SECOND @@ -29,8 +31,8 @@ DROP EVENT two_sec; SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') OK -SELECT IF(LAST_EXECUTED-ENDS < 2, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; -IF(LAST_EXECUTED-ENDS < 2, 'OK', 'ERROR') +SELECT IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; +IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR') OK DROP EVENT start_n_end; "Already dropped because ended. Therefore an error." @@ -43,4 +45,8 @@ DROP TABLE table_1; DROP TABLE table_2; DROP TABLE table_3; DROP TABLE table_4; +"Checking for multiple executions in one second, should not happen -> 0 as result" +SELECT COUNT(*) FROM (SELECT s1, COUNT(*) AS cnt FROM T19170 GROUP BY s1) AS tmp WHERE tmp.cnt > 1; +COUNT(*) +0 DROP DATABASE events_test; diff --git a/mysql-test/t/events_logs_tests.test b/mysql-test/t/events_logs_tests.test index e586184c9e4142552550fdf1ddac2d97a1f84094..21adc17d5b8708880502d3fa9448d6b2a89d252f 100644 --- a/mysql-test/t/events_logs_tests.test +++ b/mysql-test/t/events_logs_tests.test @@ -56,6 +56,7 @@ SET GLOBAL long_query_time=4; SET SESSION long_query_time=2; --echo "Check that logging is working" SELECT SLEEP(3); +--replace_regex /00:00:0[3-5]/SLEEPVAL/ SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; TRUNCATE mysql.slow_log; CREATE TABLE slow_event_test (slo_val tinyint, val tinyint); @@ -79,6 +80,7 @@ CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_te --echo "Check our table. Should see 2 rows" SELECT * FROM slow_event_test; --echo "Check slow log. Should see 1 row because 5 is over the threshold of 4 for GLOBAL, though under SESSION which is 10" +--replace_regex /00:00:0[5-7]/SLEEPVAL/ SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; DROP EVENT long_event2; SET GLOBAL long_query_time =@old_global_long_query_time; diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test index f83d919515b6c3729092c63603cbaded04faa5b2..ae3cc7d5fac06abf0105503924219d308e4250db 100644 --- a/mysql-test/t/events_scheduling.test +++ b/mysql-test/t/events_scheduling.test @@ -4,7 +4,9 @@ CREATE TABLE table_1(a int); CREATE TABLE table_2(a int); CREATE TABLE table_3(a int); CREATE TABLE table_4(a int); +CREATE TABLE T19170(s1 TIMESTAMP); SET GLOBAL event_scheduler=1; +CREATE EVENT E19170 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO T19170 VALUES(CURRENT_TIMESTAMP); CREATE EVENT two_sec ON SCHEDULE EVERY 2 SECOND DO INSERT INTO table_1 VALUES(1); CREATE EVENT start_n_end ON SCHEDULE EVERY 1 SECOND @@ -21,7 +23,7 @@ SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_3; SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_4; DROP EVENT two_sec; SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; -SELECT IF(LAST_EXECUTED-ENDS < 2, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; +SELECT IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; DROP EVENT start_n_end; --echo "Already dropped because ended. Therefore an error." --error ER_EVENT_DOES_NOT_EXIST @@ -33,4 +35,6 @@ DROP TABLE table_1; DROP TABLE table_2; DROP TABLE table_3; DROP TABLE table_4; +--echo "Checking for multiple executions in one second, should not happen -> 0 as result" +SELECT COUNT(*) FROM (SELECT s1, COUNT(*) AS cnt FROM T19170 GROUP BY s1) AS tmp WHERE tmp.cnt > 1; DROP DATABASE events_test;