mariadb/mysql-test/t/events.test
2006-01-20 22:24:58 +01:00

109 lines
3.7 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

create database if not exists events_test;
use events_test;
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;
alter event event2 disabled;
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;
create event e_43 on schedule every 1 second do set @a = 5;
set global event_scheduler = 1;
select sleep(2);
alter event e_43 do alter event e_43 do set @a = 4;
select sleep(3);
select db, name, body, status, interval_field, interval_value from mysql.event;
drop event e_43;
select sleep(1);
set global event_scheduler = 0;
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("20010101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
set max_allowed_packet=128000000;
select count(*) from t_event3;
drop event event3;
drop table t_event3;
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 1229
set event_scheduler=0;
# event_scheduler could be only either 0 or 1
--error 1231
set global event_scheduler=2;
#set global event_scheduler=0;
#select count(*) from mysql.event;
#select get_lock("test_lock1", 20);
#create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
#select count(*) from mysql.event;
##show processlist;
#select release_lock("test_lock1");
#drop event закачка;
#select count(*) from mysql.event;
#
#set global event_scheduler=1;
#select get_lock("test_lock2", 20);
#create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
#select sleep(2);
#show processlist;
#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);
#select sleep(2);
##show processlist;
#set global event_scheduler=0;
#select sleep(2);
##show processlist;
#select release_lock("test_lock2_1");
#select sleep(2);
##show processlist;
#drop event закачка21;
#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);
#show processlist;
#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);
##show processlist;
##drop event закачка4;
##select release_lock("test_lock4");
#set global event_scheduler=0;
#select sleep(2);
##show processlist;
##the following locks for some reason and is a bug, commented for now
##select count(*) from mysql.event;
drop database events_test;