mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
3a8e50e082
WL#1034 (Internal CRON) mysql-test/r/events.result: add a test for to test bug #16431 mysql-test/t/events.test: results of new tests sql/event.cc: - more debug info - pass info to evex_remove_from_cache() whether the operation was drop or alter. this fixes possible bug that may lead to dropping of an event when it's altered. also fix for bug#16431 sql/event_executor.cc: be more verbose and throw more errors sql/event_timed.cc: - add ` around the names of the db and the event_name and not their concatenation. remove ; from the end - unneeded. this fixes bug #16431, which was failing because after some recursion the query was ending on ;; which is normally an error in the parser because that's the delimiter - more debug info - don't execute lex_end() two times when there's a parse error or thd->is_fatal_error
109 lines
3.7 KiB
Text
109 lines
3.7 KiB
Text
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;
|