summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <andrey@lmy004.>2006-07-10 13:44:43 +0200
committerunknown <andrey@lmy004.>2006-07-10 13:44:43 +0200
commit974eecc246db18e29e5ef06db6f48a0f4b3f7951 (patch)
tree692560cb267120b449f56b1df9db9a918e5c7477 /mysql-test/t
parentb9a7fe2757d9040296311e96a9e2740416d181f2 (diff)
downloadmariadb-git-974eecc246db18e29e5ef06db6f48a0f4b3f7951.tar.gz
WL#3337 (Event scheduler new architecture)
This patch introduces specialized Event data objects Event_basic as parent. Event_queue_element used for queue storage Event_timed used for SHOW EVENTS/ I_S.EVENTS / SHOW CREATE EVENT Event_job_data using during execution. Methods were moved out of Event_timed to other classes. This patch also introduces Events::LOCK_event_metadata. This patch gives new implementation of Events::dump_internal_status(). Now both the Event_scheduler and Event_queue return information during their ::dump_internal_status(). Shortened a bit the runtime for executing events test cases. mysql-test/r/events.result: update results mysql-test/r/events_bugs.result: update results mysql-test/r/events_logs_tests.result: update results mysql-test/r/events_scheduling.result: update results mysql-test/t/events.test: update test make --sleep more appropriate . saving some time could mean failure on loaded boxes though :( add tests for previously uncovered branches. mysql-test/t/events_bugs.test: update test make --sleep more appropriate . saving some time could mean failure on loaded boxes though :( add tests for previously uncovered branches. mysql-test/t/events_logs_tests.test: make the test shorter by time mysql-test/t/events_scheduling.test: when selecting always use ORDER BY mysql-test/t/events_stress.test: sleep 2.5secs for shorter stress test sql/event_data_objects.cc: Event_timed is no more used during execution. Event_timed is no more used during in the memory queue. Event_timed is only used for SHOW CREATE EVENT/ I_S.EVENTS/ SHOW EVENTS Event_basic is the parent of almost all Event data objects. Event_basic -> Event_queue_element (used for the memory queue) -> Event_timed Event_basic -> Event_job_data (the object used for execution) Sql_alloc -> Event_parse_data (used during parsing) sql/event_data_objects.h: Event_timed is no more used during execution. Event_timed is no more used during in the memory queue. Event_timed is only used for SHOW CREATE EVENT/ I_S.EVENTS/ SHOW EVENTS Event_basic is the parent of almost all Event data objects. Event_basic -> Event_queue_element (used for the memory queue) -> Event_timed Event_basic -> Event_job_data (the object used for execution) Sql_alloc -> Event_parse_data (used during parsing) sql/event_db_repository.cc: Cosmetics. load_named_event now uses Event_basic, for polymorphism find_event uses Event_basic, to be polymorphic. use Field **fields= table->field and then index fields[...] Add documentation. Fix documentation. sql/event_db_repository.h: Event_db_repository depends only on Event_basic's interface sql/event_queue.cc: Cosmetics. Don't use Event_timed for the queue and giving back object for execution. Event_queue_element is for the queue, Event_job_data is for execution. Add Event_queue::dump_internal_status() for SHOW SCHEDULER STATUS command sql/event_queue.h: Cosmetics. Don't use Event_timed for the queue and giving back object for execution. Event_queue_element is for the queue, Event_job_data is for execution. Add Event_queue::dump_internal_status() for SHOW SCHEDULER STATUS command sql/event_scheduler_ng.cc: Add back Event_scheduler::cond_wait() Add back Event_scheduler::dump_internal_status() Using Event_job_data for execution. Make the scheduler thread unkillable (thd->command= COM_DAEMON). Add a lot of documentation. sql/event_scheduler_ng.h: Add back Event_scheduler::cond_wait() Add back Event_scheduler::dump_internal_status() Using Event_job_data for execution. sql/events.cc: Documentation Add LOCK_event_metadata sql/events.h: Change the signature of Events::drop_event() not to use sp_name but LEX_STRING sql/share/errmsg.txt: Fix error message sql/sql_parse.cc: Events::drop_event() has new signature
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/events.test16
-rw-r--r--mysql-test/t/events_bugs.test47
-rw-r--r--mysql-test/t/events_logs_tests.test15
-rw-r--r--mysql-test/t/events_scheduling.test2
-rw-r--r--mysql-test/t/events_stress.test4
5 files changed, 54 insertions, 30 deletions
diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test
index 5dff48c203b..34c00a6387a 100644
--- a/mysql-test/t/events.test
+++ b/mysql-test/t/events.test
@@ -18,7 +18,7 @@ CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table;
connection default;
SHOW DATABASES LIKE 'db_x';
SET GLOBAL event_scheduler=1;
---sleep 1.5
+--sleep 0.8
SHOW DATABASES LIKE 'db_x';
SHOW TABLES FROM db_x;
SET GLOBAL event_scheduler=2;
@@ -83,7 +83,6 @@ DROP EVENT event_starts_test;
#
create table test_nested(a int);
create event e_43 on schedule every 1 second do set @a = 5;
-set global event_scheduler = 1;
--error 1562
alter event e_43 do alter event e_43 do set @a = 4;
delimiter |;
@@ -94,7 +93,7 @@ begin
end|
delimiter ;|
set global event_scheduler = 1;
---sleep 1
+--sleep 3
select db, name, body, status, interval_field, interval_value from mysql.event;
drop event e_43;
drop table test_nested;
@@ -102,7 +101,7 @@ drop table test_nested;
--echo "Let's check whether we can use non-qualified names"
create table non_qualif(a int);
create event non_qualif_ev on schedule every 10 minute do insert into non_qualif values (800219);
---sleep 1
+--sleep 0.5
select * from non_qualif;
drop event non_qualif_ev;
drop table non_qualif;
@@ -165,6 +164,10 @@ show create event root22;
--error ER_NOT_SUPPORTED_YET
SHOW EVENTS;
drop event root22;
+--error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
+create event root23 on schedule every -100 year do select 1;
+--error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
+create event root23 on schedule every 222222222222222222222 year do select 1;
drop event root6;
drop event root7;
drop event root8;
@@ -294,7 +297,7 @@ select get_lock("test_lock2", 20);
--echo "Create an event which tries to acquire a mutex. The event locks on the mutex"
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
--echo "Let some time pass to the event starts"
---sleep 1
+--sleep 0.5
--echo "Should have only 2 processes: the scheduler and the locked event"
select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;--echo "Release the mutex, the event worker should finish."
--echo "Release the mutex, the event worker should finish."
@@ -312,10 +315,11 @@ drop event закачка;
set global event_scheduler=1;
select get_lock("test_lock2_1", 20);
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
---sleep 1
+--sleep 0.5
--echo "Should have only 3 processes: the scheduler, our conn and the locked event"
select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
set global event_scheduler=2;
+--sleep 0.3
--echo "Should have only our process now:"
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
drop event закачка21;
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
index 4ff114555ca..7fd4c684b4b 100644
--- a/mysql-test/t/events_bugs.test
+++ b/mysql-test/t/events_bugs.test
@@ -45,6 +45,19 @@ create event e_55 on schedule at 99990101000000 do drop table t;
create event e_55 on schedule every 10 hour starts 99990101000000 do drop table t;
--error ER_EVENT_ENDS_BEFORE_STARTS
create event e_55 on schedule every 10 minute ends 99990101000000 do drop table t;
+--error ER_EVENT_EXEC_TIME_IN_THE_PAST
+create event e_55 on schedule at 10000101000000 do drop table t;
+--error ER_EVENT_EXEC_TIME_IN_THE_PAST
+create event e_55 on schedule at 20000101000000 do drop table t;
+--error ER_PARSE_ERROR
+create event e_55 on schedule at 20200101000000 starts 10000101000000 do drop table t;
+--error ER_PARSE_ERROR
+create event e_55 on schedule at 20200101000000 ends 10000101000000 do drop table t;
+--error ER_PARSE_ERROR
+create event e_55 on schedule at 20200101000000 starts 10000101000000 ends 10000101000000 do drop table t;
+--error ER_WRONG_VALUE
+create event e_55 on schedule every 10 hour starts 10000101000000 do drop table t;
+
#
# End - 16396: Events: Distant-future dates become past dates
#
@@ -53,8 +66,6 @@ create event e_55 on schedule every 10 minute ends 99990101000000 do drop table
# Start - 16407: Events: Changes in sql_mode won't be taken into account
#
set global event_scheduler=2;
---echo "Wait a bit to settle down"
---sleep 1
delete from mysql.event;
set global event_scheduler= 1;
set @old_sql_mode:=@@sql_mode;
@@ -67,11 +78,13 @@ begin
drop table "hashed_num";
end|
delimiter ;|
---sleep 1
+--sleep 0.5
--echo "Now if everything is fine the event has compiled and is locked
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select release_lock('test_bug16407');
+
set global event_scheduler= 2;
+
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
--echo "Let's check whether we change the sql_mode on ALTER EVENT"
set sql_mode='traditional';
@@ -79,6 +92,10 @@ alter event e_16407 do select 1;
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
drop event e_16407;
+set sql_mode="ansi";
+select get_lock('ee_16407_2', 60);
+
+set global event_scheduler= 1;
--echo "Another sql_mode test"
set sql_mode="traditional";
create table events_smode_test(ev_name char(10), a date) engine=myisam;
@@ -87,6 +104,7 @@ delimiter |;
create event ee_16407_2 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60) /*ee_16407_2*/;
+ select release_lock('ee_16407_2');
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end|
--error ER_TRUNCATED_WRONG_VALUE
@@ -95,6 +113,7 @@ insert into events_smode_test values ('test','1980-19-02')|
create event ee_16407_3 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60) /*ee_16407_3*/;
+ select release_lock('ee_16407_2');
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19');
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29');
end|
@@ -103,17 +122,15 @@ set sql_mode=""|
create event ee_16407_4 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60) /*ee_16407_4*/;
+ select release_lock('ee_16407_2');
insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
end|
delimiter ;|
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
-set sql_mode="ansi";
-select get_lock('ee_16407_2', 60);
-set global event_scheduler= 1;
---sleep 1
+--sleep 0.5
select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select release_lock('ee_16407_2');
---sleep 2
+--sleep 0.8
select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
set global event_scheduler= 2;
select * from events_smode_test order by ev_name, a;
@@ -126,6 +143,11 @@ drop event ee_16407_4;
--echo "And now one last test regarding sql_mode and call of SP from an event"
delete from events_smode_test;
+set sql_mode='ansi';
+select get_lock('ee_16407_5', 60);
+
+set global event_scheduler= 1;
+
set sql_mode='traditional';
delimiter |;
create procedure ee_16407_5_pendant() begin insert into events_test.events_smode_test values('ee_16407_5','2001-02-29'); end|
@@ -133,22 +155,21 @@ create procedure ee_16407_6_pendant() begin insert into events_test.events_smode
create event ee_16407_5 on schedule every 60 second do
begin
select get_lock('ee_16407_5', 60) /*ee_16407_5*/;
+ select release_lock('ee_16407_5');
call events_test.ee_16407_5_pendant();
end|
create event ee_16407_6 on schedule every 60 second do
begin
select get_lock('ee_16407_5', 60) /*ee_16407_6*/;
+ select release_lock('ee_16407_5');
call events_test.ee_16407_6_pendant();
end|
delimiter ;|
-set sql_mode='ansi';
-select get_lock('ee_16407_5', 60);
-set global event_scheduler= 1;
---sleep 1
+--sleep 0.5
--echo "Should have 2 locked processes"
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select release_lock('ee_16407_5');
---sleep 2
+--sleep 0.8
--echo "Should have 0 processes locked"
select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select * from events_smode_test order by ev_name, a;
diff --git a/mysql-test/t/events_logs_tests.test b/mysql-test/t/events_logs_tests.test
index 5f4ec852cd3..0cf073f2280 100644
--- a/mysql-test/t/events_logs_tests.test
+++ b/mysql-test/t/events_logs_tests.test
@@ -14,7 +14,7 @@ END|
delimiter ;|
--echo "Check General Query Log"
SET GLOBAL event_scheduler=2;
-create event log_general on schedule every 1 minute do SELect 'alabala', sleep(3) from dual;
+create event log_general on schedule every 1 minute do SELect 'alabala', sleep(1) from dual;
TRUNCATE mysql.general_log;
--echo "1 row, the current statement!"
--replace_column 1 USER_HOST
@@ -22,13 +22,12 @@ call select_general_log();
SET GLOBAL event_scheduler=1;
--echo "Wait the scheduler to start"
--echo "Should see 3 rows - the 'SELect' is in the middle. The other two are selects from general_log"
---sleep 2
+--sleep 0.7
--replace_column 1 USER_HOST
call select_general_log();
DROP PROCEDURE select_general_log;
DROP EVENT log_general;
SET GLOBAL event_scheduler=2;
---sleep 1
--echo "Check slow query log"
--disable_query_log
@@ -69,18 +68,18 @@ SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
SET SESSION long_query_time=300;
--echo "Make it quite long"
TRUNCATE mysql.slow_log;
-SET SESSION long_query_time=1;
CREATE TABLE slow_event_test (slo_val tinyint, val tinyint);
--echo "This won't go to the slow log"
-CREATE EVENT long_event ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(3);
SELECT * FROM slow_event_test;
+SET SESSION long_query_time=1;
SET GLOBAL event_scheduler=1;
+CREATE EVENT long_event ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(1.5);
--echo "Sleep some more time than the actual event run will take"
---sleep 5
+--sleep 2
SHOW VARIABLES LIKE 'event_scheduler';
--echo "Check our table. Should see 1 row"
SELECT * FROM slow_event_test;
---echo "Check slow log. Should not see anything because 3 is under the threshold of 4 for GLOBAL, though over SESSION which is 2"
+--echo "Check slow log. Should not see anything because 1.5 is under the threshold of 300 for GLOBAL, though over SESSION which is 2"
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
--echo "This should go to the slow log"
DROP EVENT long_event;
@@ -88,7 +87,7 @@ SET SESSION long_query_time=10;
SET GLOBAL long_query_time=1;
CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2);
--echo "Sleep some more time than the actual event run will take"
---sleep 3
+--sleep 2.5
--echo "Check our table. Should see 2 rows"
SELECT * FROM slow_event_test;
--echo "Check slow log. Should see 1 row because 4 is over the threshold of 3 for GLOBAL, though under SESSION which is 10"
diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test
index 987939bc162..dc4460999a7 100644
--- a/mysql-test/t/events_scheduling.test
+++ b/mysql-test/t/events_scheduling.test
@@ -34,7 +34,7 @@ DROP EVENT start_n_end;
--error ER_EVENT_DOES_NOT_EXIST
DROP EVENT only_one_time;
--echo "Should be preserved"
-SELECT EVENT_NAME, STATUS FROM INFORMATION_SCHEMA.EVENTS;
+SELECT EVENT_NAME, STATUS FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_NAME;
DROP EVENT two_time;
DROP TABLE table_1;
DROP TABLE table_2;
diff --git a/mysql-test/t/events_stress.test b/mysql-test/t/events_stress.test
index 7700a12efab..7b1efdea1ba 100644
--- a/mysql-test/t/events_stress.test
+++ b/mysql-test/t/events_stress.test
@@ -61,7 +61,7 @@ while ($1)
--enable_query_log
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
SET GLOBAL event_scheduler=1;
---sleep 12
+--sleep 2.5
DROP DATABASE events_conn1_test2;
SET GLOBAL event_scheduler=2;
@@ -100,7 +100,7 @@ while ($1)
}
--enable_query_log
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
---sleep 12
+--sleep 2.5
connection conn2;
--send
DROP DATABASE events_conn2_db;