mirror of
https://github.com/MariaDB/server.git
synced 2025-08-30 11:22:14 +03:00
- Scheduler is either initialized at server start or never. Starting & stopping is now suspending & resuming. - The scheduler has clear OO interface - Now all calls to the scheduler are synchronous - GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc) - External API is encapsulated into class Events - Includes fixes for all comments of Kostja's review of 19.05.2005 Starting to merge into 5.1-release (5.1.10) and push BitKeeper/etc/ignore: Added libmysqld/event_scheduler.cc to the ignore list libmysqld/Makefile.am: executor -> scheduler mysql-test/r/events.result: update result mysql-test/r/events_bugs.result: update result mysql-test/r/events_logs_tests.result: update result mysql-test/r/events_microsec.result: update result mysql-test/r/events_scheduling.result: update result mysql-test/r/events_stress.result: update result mysql-test/t/disabled.def: enable these tests mysql-test/t/events.test: optimize the test a bit for speed, save some seconds runtime remove FULL from SHOW EVENTS mostly use I_S.EVENTS mysql-test/t/events_bugs.test: Skip irrelevant for the current design tests - all events are loaded on server startup. Change in mysql.event will be visible on next server start. Don't use numeric error codes. mysql-test/t/events_logs_tests.test: optimize the test a bit for speed mysql-test/t/events_microsec.test: Skip irrelevant for the current design tests - all events are loaded on server startup. Change in mysql.event will be visible on next server start. Don't use numeric error codes. mysql-test/t/events_scheduling.test: broader test mysql-test/t/events_stress.test: Rework the test to the new architecture of suspending/resuming. Use less events, no need for thousands, hundreds is still ok. sql/Makefile.am: executor -> scheduler sql/cmakelists.txt: executor -> scheduler sql/event.cc: - remove todo comments - remove unneded evex_queue abstraction functions - move events_init() and events_shutdown() from event_executor.cc to here - export db_create_event - remove evex_load_and_compile_event, part of class Event_scheduler - integrate the public interface found in event.h and used by sql_parse.cc to use the new class Event_scheduler. sql/event.h: - add COND_finished so if one thread kills a running event it waits on this - export callback event_timed_definer_equal, event_timed_identifier_equal(), event_timed_name_equal and event_timed_db_equal() to be used by Event_scheduler::drop_matching_events() - cleanup event.h - encapsulated all external interface into class Events sql/event_executor.cc: make it empty, will delete after that sql/event_priv.h: - more things in the private header - remove event queue abstraction functions. tightly bind to QUEUE - export privately db_drop_event, db_find_event, db_create_event() - made change_security_context() and restore_security_context() free functions sql/event_timed.cc: - fix calculation of time when ENDS is set (STARTS is always set) - during Event_timed::compile() set the right Security_ctx. Prevents a crash during Event_scheduler::load_events_from_db() - add Event_timed::kill_thread() - implement event_timed_*_equal() - made change_security_context() and restore_security_context() free functions. - Comments cleanups sql/lex.h: new word scheduler for SHOW SCHEDULER STATUS (available only debug builds) sql/log.cc: move these from event_scheduler.cc sql/mysql_priv.h: refactor kill_one_thread export sql_print_message_func and sql_print_message_handlers sql/mysqld.cc: In close_connections, called by kill_server() skip the main scheduler thread and use events_shutdown() for shutting down the scheduler, in the same manner it's done for RPL. Add a new value to --event-scheduler : 0 <- No scheduler available 1 <- Start with scheduler enabled 2 <- Start with scheduler suspended sql/repl_failsafe.cc: refactor thd::system_thread to be an enum sql/set_var.cc: move sys_var_event_executor::update() to set_var.cc executor -> scheduler use thd::sys_var_tmp sql/set_var.h: executor -> scheduler sql/share/errmsg.txt: 3 new error messages sql/sql_class.cc: refactor thd::system_thread to be an enum . more type-safety sql/sql_class.h: refactor thd::system_thread to be an enum . more type-safety sql/sql_db.cc: get the error from evex_drop_schema_events sql/sql_error.h: export warning_level_names sql/sql_lex.h: new command SHOW SCHEDULER STATUS, available only in debug build and for debug purposes. sql/sql_parse.cc: refactor kill_one_thread() -> does the *dirty* work, and sql_kill just the reporting. add handler for SQLCOM_SHOW_SCHEDULER_STATUS sql/sql_show.cc: fix verbosity handling (this will be obsoleted anyway by the fix for 17394). sql/sql_yacc.yy: remove FULL from SHOW EVENTS add SHOW SCHEDULER STATUS in debug builds sql/table.cc: Fix valgrind warning.
456 lines
16 KiB
Plaintext
456 lines
16 KiB
Plaintext
create database if not exists events_test;
|
||
use events_test;
|
||
|
||
#
|
||
# START: BUG #17289 Events: missing privilege check for drop database
|
||
#
|
||
CREATE USER pauline@localhost;
|
||
CREATE DATABASE db_x;
|
||
GRANT EVENT ON db_x.* TO pauline@localhost;
|
||
USE db_x;
|
||
CREATE TABLE x_table(a int);
|
||
connect (priv_conn,localhost,pauline,,db_x);
|
||
CREATE EVENT e_x1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db_x;
|
||
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
|
||
SHOW DATABASES LIKE 'db_x';
|
||
SHOW TABLES FROM db_x;
|
||
SET GLOBAL event_scheduler=2;
|
||
connection priv_conn;
|
||
DROP EVENT e_x1;
|
||
DROP EVENT e_x2;
|
||
disconnect priv_conn;
|
||
connection default;
|
||
DROP DATABASE db_x;
|
||
DROP USER pauline@localhost;
|
||
USE events_test;
|
||
#
|
||
# END: BUG #17289 Events: missing privilege check for drop database
|
||
#
|
||
SET GLOBAL event_scheduler=2;
|
||
drop event if exists event1;
|
||
create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end;
|
||
alter event event1 rename to event2 enable;
|
||
alter event event2 disable;
|
||
alter event event2 enable;
|
||
alter event event2 on completion not preserve;
|
||
delimiter __;
|
||
alter event event2 on schedule every 1 year on completion preserve rename to event3 comment "new comment" do begin select 1; end__
|
||
delimiter ;__
|
||
alter event event3 rename to event2;
|
||
|
||
drop event event2;
|
||
create event event2 on schedule every 2 second starts now() ends date_add(now(), interval 5 hour) comment "some" DO begin end;
|
||
drop event event2;
|
||
|
||
# BUG #16537 (Events: mysql.event.starts is null)
|
||
CREATE EVENT event_starts_test ON SCHEDULE EVERY 10 SECOND COMMENT "" DO SELECT 1;
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
|
||
ALTER EVENT event_starts_test ON SCHEDULE AT '2020-02-02 20:00:02';
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
|
||
ALTER EVENT event_starts_test COMMENT "non-empty comment";
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
|
||
ALTER EVENT event_starts_test COMMENT "";
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
|
||
DROP EVENT event_starts_test;
|
||
CREATE EVENT event_starts_test ON SCHEDULE EVERY 20 SECOND STARTS '2020-02-02 20:00:02' ENDS '2022-02-02 20:00:02' DO SELECT 2;
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
|
||
ALTER EVENT event_starts_test COMMENT "non-empty comment";
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
|
||
ALTER EVENT event_starts_test COMMENT "";
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
DROP EVENT event_starts_test;
|
||
#
|
||
#
|
||
create event e_43 on schedule every 1 second do set @a = 5;
|
||
set global event_scheduler = 1;
|
||
--sleep 2
|
||
alter event e_43 do alter event e_43 do set @a = 4;
|
||
--sleep 2
|
||
select db, name, body, status, interval_field, interval_value from mysql.event;
|
||
drop event e_43;
|
||
--sleep 1
|
||
|
||
--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
|
||
select * from non_qualif;
|
||
drop event non_qualif_ev;
|
||
drop table non_qualif;
|
||
set global event_scheduler = 2;
|
||
|
||
create table t_event3 (a int, b float);
|
||
drop event if exists event3;
|
||
create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
|
||
select count(*) from t_event3;
|
||
drop event event3;
|
||
drop table t_event3;
|
||
|
||
|
||
set names utf8;
|
||
#
|
||
# SHOW CREATE EVENT test begin
|
||
#
|
||
CREATE EVENT root6 ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1;
|
||
SHOW CREATE EVENT root6;
|
||
create event root7 on schedule every 2 year do select 1;
|
||
SHOW CREATE EVENT root7;
|
||
create event root8 on schedule every '2:5' year_month do select 1;
|
||
SHOW CREATE EVENT root8;
|
||
create event root8_1 on schedule every '2:15' year_month do select 1;
|
||
SHOW CREATE EVENT root8_1;
|
||
create event root9 on schedule every 2 week ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' do select 1;
|
||
SHOW CREATE EVENT root9;
|
||
create event root10 on schedule every '20:5' day_hour do select 1;
|
||
SHOW CREATE EVENT root10;
|
||
create event root11 on schedule every '20:25' day_hour do select 1;
|
||
SHOW CREATE EVENT root11;
|
||
create event root12 on schedule every '20:25' hour_minute do select 1;
|
||
SHOW CREATE EVENT root12;
|
||
create event root13 on schedule every '25:25' hour_minute do select 1;
|
||
SHOW CREATE EVENT root13;
|
||
create event root13_1 on schedule every '11:65' hour_minute do select 1;
|
||
SHOW CREATE EVENT root13_1;
|
||
create event root14 on schedule every '35:35' minute_second do select 1;
|
||
SHOW CREATE EVENT root14;
|
||
create event root15 on schedule every '35:66' minute_second do select 1;
|
||
SHOW CREATE EVENT root15;
|
||
create event root16 on schedule every '35:56' day_minute do select 1;
|
||
SHOW CREATE EVENT root16;
|
||
create event root17 on schedule every '35:12:45' day_minute do select 1;
|
||
SHOW CREATE EVENT root17;
|
||
create event root17_1 on schedule every '35:25:65' day_minute do select 1;
|
||
SHOW CREATE EVENT root17_1;
|
||
create event root18 on schedule every '35:12:45' hour_second do select 1;
|
||
SHOW CREATE EVENT root18;
|
||
create event root19 on schedule every '15:59:85' hour_second do select 1;
|
||
SHOW CREATE EVENT root19;
|
||
create event root20 on schedule every '50:20:12:45' day_second do select 1;
|
||
SHOW CREATE EVENT root20;
|
||
set names cp1251;
|
||
create event <20><><EFBFBD><EFBFBD>21 on schedule every '50:23:59:95' day_second COMMENT '<27><><EFBFBD><EFBFBD> <20> 1251 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' do select 1;
|
||
SHOW CREATE EVENT <20><><EFBFBD><EFBFBD>21;
|
||
insert into mysql.event (db, name, body, definer, interval_value, interval_field) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND");
|
||
--error 1235
|
||
show create event root22;
|
||
--error 1235
|
||
SHOW EVENTS;
|
||
drop event root22;
|
||
drop event root6;
|
||
drop event root7;
|
||
drop event root8;
|
||
drop event root8_1;
|
||
drop event root9;
|
||
drop event root10;
|
||
drop event root11;
|
||
drop event root12;
|
||
drop event root13;
|
||
drop event root13_1;
|
||
drop event root14;
|
||
drop event root15;
|
||
drop event root16;
|
||
drop event root17;
|
||
drop event root17_1;
|
||
drop event root18;
|
||
drop event root19;
|
||
drop event root20;
|
||
drop event <20><><EFBFBD><EFBFBD>21;
|
||
|
||
set names latin1;
|
||
#
|
||
# SHOW CREATE EVENT test end
|
||
#
|
||
|
||
#
|
||
# mysql.event intact checking start
|
||
#
|
||
# There should be at least 1 second between the ALTERs or we can't catch the change of create_time!!
|
||
#
|
||
CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
ALTER TABLE mysql.event ADD dummy INT FIRST;
|
||
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
|
||
SHOW EVENTS;
|
||
ALTER TABLE mysql.event DROP dummy, ADD dummy2 VARCHAR(64) FIRST;
|
||
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
|
||
SHOW EVENTS;
|
||
ALTER TABLE mysql.event DROP dummy2;
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
CREATE TABLE event_like LIKE mysql.event;
|
||
INSERT INTO event_like SELECT * FROM mysql.event;
|
||
#sleep a bit or we won't catch the change of time
|
||
--sleep 1
|
||
ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
|
||
--error ER_CANNOT_LOAD_FROM_TABLE
|
||
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
|
||
ALTER TABLE mysql.event MODIFY db char(20) character set utf8 collate utf8_bin default '';
|
||
#wait a bit or we won't see the difference because of seconds resolution
|
||
--sleep 1
|
||
SHOW CREATE TABLE mysql.event;
|
||
--error ER_CANNOT_LOAD_FROM_TABLE
|
||
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
|
||
--sleep 1
|
||
ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin default '';
|
||
--sleep 1
|
||
--echo "This should work"
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
--sleep 1
|
||
ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
|
||
--error ER_CANNOT_LOAD_FROM_TABLE
|
||
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
|
||
--sleep 1
|
||
ALTER TABLE mysql.event MODIFY db varchar(64) character set utf8 collate utf8_bin default '';
|
||
--sleep 1
|
||
--error ER_CANNOT_LOAD_FROM_TABLE
|
||
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
|
||
--sleep 1
|
||
ALTER TABLE mysql.event DROP comment, DROP starts;
|
||
--sleep 1
|
||
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
|
||
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
|
||
DROP TABLE mysql.event;
|
||
CREATE TABLE mysql.event like event_like;
|
||
INSERT INTO mysql.event SELECT * FROM event_like;
|
||
DROP TABLE event_like;
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
DROP EVENT intact_check;
|
||
#
|
||
# mysql.event intact checking end
|
||
#
|
||
|
||
#
|
||
#INFORMATION_SCHEMA.EVENTS test begin
|
||
#
|
||
create event one_event on schedule every 10 second do select 123;
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
|
||
CREATE DATABASE events_test2;
|
||
CREATE USER ev_test@localhost;
|
||
GRANT ALL ON events_test.* to ev_test@localhost;
|
||
GRANT ALL on events_test2.* to ev_test@localhost;
|
||
REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
|
||
REVOKE PROCESS on *.* from ev_test@localhost;
|
||
#now we are on con1
|
||
connect (ev_con1,localhost,ev_test,,events_test2);
|
||
select "NEW CONNECTION";
|
||
SELECT USER(), DATABASE();
|
||
SHOW GRANTS;
|
||
|
||
--echo "Here comes an error:";
|
||
#NO EVENT_ACL on events_test2
|
||
--error 1044
|
||
SHOW EVENTS;
|
||
USE events_test;
|
||
|
||
--echo "Now the list should be empty:";
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
#now create an event with the same name but we are different user
|
||
select concat("Let's create some new events from the name of ",user());
|
||
create event one_event on schedule every 20 second do select 123;
|
||
create event two_event on schedule every 20 second on completion not preserve comment "two event" do select 123;
|
||
create event three_event on schedule every 20 second on completion preserve comment "three event" do select 123;
|
||
|
||
--echo "Now we should see 3 events:";
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
|
||
--echo "This should show us only 3 events:";
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
|
||
--echo "This should show us only 2 events:";
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS LIKE 't%event';
|
||
|
||
--echo "This should show us no events:";
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS FROM test LIKE '%';
|
||
#ok, we are back
|
||
connection default;
|
||
DROP DATABASE events_test2;
|
||
|
||
--echo "should see 1 event:";
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
|
||
--echo "we should see 4 events now:";
|
||
--replace_column 8 # 9 #
|
||
SHOW EVENTS;
|
||
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
|
||
|
||
connection ev_con1;
|
||
drop event one_event;
|
||
drop event two_event;
|
||
drop event three_event;
|
||
disconnect ev_con1;
|
||
connection default;
|
||
drop user ev_test@localhost;
|
||
drop event one_event;
|
||
#
|
||
##INFORMATION_SCHEMA.EVENTS test end
|
||
#
|
||
|
||
--echo "Sleep a bit so the server closes the second connection"
|
||
--sleep 2
|
||
create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
|
||
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
|
||
drop event e_26;
|
||
--error ER_WRONG_VALUE
|
||
create event e_26 on schedule at NULL disabled do set @a = 5;
|
||
--error ER_WRONG_VALUE
|
||
create event e_26 on schedule at 'definitely not a datetime' disabled do set @a = 5;
|
||
|
||
set names utf8;
|
||
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
|
||
drop event задачка;
|
||
|
||
# event_scheduler is a global var
|
||
--error ER_GLOBAL_VARIABLE
|
||
set event_scheduler=2;
|
||
# event_scheduler could be only either 1 or 2
|
||
--error ER_WRONG_VALUE_FOR_VAR
|
||
set global event_scheduler=3;
|
||
|
||
--echo "DISABLE the scheduler. Testing that it does not work when the variable is 0"
|
||
set global event_scheduler=2;
|
||
select definer, name, db from mysql.event;
|
||
select get_lock("test_lock1", 20);
|
||
create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
|
||
--echo "Should return 1 row"
|
||
select definer, name, db from mysql.event;
|
||
|
||
--echo "Should be only 1 process"
|
||
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_lock1");
|
||
drop event закачка;
|
||
--echo "Should have 0 events"
|
||
select count(*) from mysql.event;
|
||
|
||
#
|
||
#
|
||
#
|
||
--echo "ENABLE the scheduler and get a lock"
|
||
set global event_scheduler=1;
|
||
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 2
|
||
--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."
|
||
select release_lock("test_lock2");
|
||
drop event закачка;
|
||
|
||
##
|
||
## 1. get a lock
|
||
## 2. create an event
|
||
## 3. sleep so it has time to start
|
||
## 4. should appear in processlist
|
||
## 5. kill the scheduler, it will wait for the child to stop
|
||
## 6. both processes should be there on show processlist
|
||
## 7. release the lock and sleep, both scheduler and child should end
|
||
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
|
||
--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;
|
||
--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;
|
||
|
||
####
|
||
# Bug #16410 Events: CREATE EVENT is legal in a CREATE TRIGGER statement
|
||
#
|
||
create table t_16 (s1 int);
|
||
--error 1422
|
||
create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
|
||
drop table t_16;
|
||
#
|
||
# end of test case
|
||
####
|
||
|
||
#
|
||
# START: BUG #17453: Creating Event crash the server
|
||
#
|
||
create event white_space
|
||
on schedule every 10 hour
|
||
disable
|
||
do
|
||
select 1;
|
||
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
|
||
drop event white_space;
|
||
create event white_space on schedule every 10 hour disable do
|
||
|
||
select 2;
|
||
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
|
||
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
|
||
drop event white_space;
|
||
create event white_space on schedule every 10 hour disable do select 3;
|
||
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
|
||
drop event white_space;
|
||
#
|
||
# END: BUG #17453: Creating Event crash the server
|
||
#
|
||
|
||
#
|
||
# Bug#17403 "Events: packets out of order with show create event"
|
||
#
|
||
create event e1 on schedule every 1 year do set @a = 5;
|
||
create table t1 (s1 int);
|
||
--error ER_SP_NO_RETSET
|
||
create trigger t1_ai after insert on t1 for each row show create event e1;
|
||
drop table t1;
|
||
drop event e1;
|
||
|
||
##set global event_scheduler=1;
|
||
##select get_lock("test_lock3", 20);
|
||
##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
|
||
##select sleep(2);
|
||
##select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
|
||
##drop event закачка;
|
||
##select release_lock("test_lock3");
|
||
|
||
#
|
||
# test with very often occuring event
|
||
# (disabled for now, locks)
|
||
##select get_lock("test_lock4", 20);
|
||
##create event закачка4 on schedule every 1 second do select get_lock("test_lock4", 20);
|
||
##select sleep(3);
|
||
##select /*6*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
|
||
##drop event закачка4;
|
||
##select release_lock("test_lock4");
|
||
|
||
##set global event_scheduler=2;
|
||
##select sleep(2);
|
||
##--replace_column 1 # 6 #
|
||
##show processlist;
|
||
##select count(*) from mysql.event;
|
||
|
||
drop database events_test;
|