Commit 2dc2a430 authored by unknown's avatar unknown

fix for bug#16548 (Events: can't alter clause for preserve)

WL #1034 (Internal CRON)


mysql-test/r/events.result:
  fix the results
mysql-test/t/disabled.def:
  make it enabled
mysql-test/t/events.test:
  - comment out some tests (having problems now)
  - add test for fix for bug#16548
sql/sql_yacc.yy:
  - fix for bug#16548 (Events: can't alter clause for preserve)
  - prefix optional non-terminals with opt_
parent 14c38f00
...@@ -6,6 +6,9 @@ Note 1305 Event event1 does not exist ...@@ -6,6 +6,9 @@ Note 1305 Event event1 does not exist
create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end; 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 event1 rename to event2;
alter event event2 disabled; alter event event2 disabled;
alter event event2 on completion not preserve;
alter event event2 on schedule every 1 year on completion preserve rename to event3 comment "new comment" do begin select 1; end__
alter event event3 rename to event2;
drop event 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; 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; drop event event2;
...@@ -27,69 +30,4 @@ set event_scheduler=0; ...@@ -27,69 +30,4 @@ set event_scheduler=0;
ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL
set global event_scheduler=2; set global event_scheduler=2;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2' ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
set global event_scheduler=0;
select count(*) from mysql.event;
count(*)
0
select get_lock("test_lock1", 20);
get_lock("test_lock1", 20)
1
create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
select count(*) from mysql.event;
count(*)
1
select release_lock("test_lock1");
release_lock("test_lock1")
1
drop event закачка;
select count(*) from mysql.event;
count(*)
0
set global event_scheduler=1;
select get_lock("test_lock2", 20);
get_lock("test_lock2", 20)
1
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
select sleep(2);
sleep(2)
0
select release_lock("test_lock2");
release_lock("test_lock2")
1
drop event закачка;
set global event_scheduler=1;
select get_lock("test_lock2_1", 20);
get_lock("test_lock2_1", 20)
1
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
select sleep(2);
sleep(2)
0
set global event_scheduler=0;
select sleep(2);
sleep(2)
0
select release_lock("test_lock2_1");
release_lock("test_lock2_1")
1
select sleep(2);
sleep(2)
0
drop event закачка21;
set global event_scheduler=1;
select get_lock("test_lock3", 20);
get_lock("test_lock3", 20)
1
create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
select sleep(2);
sleep(2)
0
drop event закачка;
select release_lock("test_lock3");
release_lock("test_lock3")
1
set global event_scheduler=0;
select sleep(2);
sleep(2)
0
drop database events_test; drop database events_test;
...@@ -19,7 +19,6 @@ innodb_concurrent : Results are not deterministic, Elliot will fix (BUG#3300) ...@@ -19,7 +19,6 @@ innodb_concurrent : Results are not deterministic, Elliot will fix (BUG#3300)
subselect : Bug#15706 subselect : Bug#15706
ps_7ndb : dbug assert in RBR mode when executing test suite ps_7ndb : dbug assert in RBR mode when executing test suite
rpl_ddl : Bug#15963 SBR does not show "Definer" correctly rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
events : Affects flush test case. A table lock not released somewhere
ndb_binlog_basic : Results are not deterministic, Tomas will fix ndb_binlog_basic : Results are not deterministic, Tomas will fix
rpl_ndb_basic : Bug#16228 rpl_ndb_basic : Bug#16228
rpl_sp : Bug #16456 rpl_sp : Bug #16456
......
...@@ -4,6 +4,11 @@ drop event if exists event1; ...@@ -4,6 +4,11 @@ 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; 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 event1 rename to event2;
alter event event2 disabled; 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; 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; create event event2 on schedule every 2 second starts now() ends date_add(now(), interval 5 hour) comment "some" DO begin end;
...@@ -28,67 +33,67 @@ set event_scheduler=0; ...@@ -28,67 +33,67 @@ set event_scheduler=0;
--error 1231 --error 1231
set global event_scheduler=2; set global event_scheduler=2;
set global event_scheduler=0; #set global event_scheduler=0;
select count(*) from mysql.event; #select count(*) from mysql.event;
select get_lock("test_lock1", 20); #select get_lock("test_lock1", 20);
create event закачка on schedule every 10 hour do 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; #select count(*) from mysql.event;
#show processlist; ##show processlist;
select release_lock("test_lock1"); #select release_lock("test_lock1");
drop event закачка; #drop event закачка;
select count(*) from mysql.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 #set global event_scheduler=1;
# 2. create an event #select get_lock("test_lock2", 20);
# 3. sleep so it has time to start #create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
# 4. should appear in processlist #select sleep(2);
# 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; #show processlist;
set global event_scheduler=0; #select release_lock("test_lock2");
select sleep(2); #drop event закачка;
#show processlist;
select release_lock("test_lock2_1"); ##
select sleep(2); ## 1. get a lock
#show processlist; ## 2. create an event
drop event закачка21; ## 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; #set global event_scheduler=1;
select get_lock("test_lock3", 20); #select get_lock("test_lock3", 20);
create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20); #create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
select sleep(2); #select sleep(2);
#show processlist; #show processlist;
drop event закачка; #drop event закачка;
select release_lock("test_lock3"); #select release_lock("test_lock3");
# #
# test with very often occuring event # test with very often occuring event
# (disabled for now, locks) # (disabled for now, locks)
#select get_lock("test_lock4", 20); ##select get_lock("test_lock4", 20);
#create event закачка4 on schedule every 1 second do 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 sleep(3);
#show processlist; ##show processlist;
#drop event закачка4; ##drop event закачка4;
#select release_lock("test_lock4"); ##select release_lock("test_lock4");
set global event_scheduler=0; #set global event_scheduler=0;
select sleep(2); #select sleep(2);
#show processlist; ##show processlist;
#the following locks for some reason and is a bug, commented for now ##the following locks for some reason and is a bug, commented for now
#select count(*) from mysql.event; ##select count(*) from mysql.event;
drop database events_test; drop database events_test;
...@@ -1360,9 +1360,9 @@ create: ...@@ -1360,9 +1360,9 @@ create:
lex->et->init_name(YYTHD, $4); lex->et->init_name(YYTHD, $4);
} }
ON SCHEDULE_SYM ev_schedule_time ON SCHEDULE_SYM ev_schedule_time
ev_on_completion opt_ev_on_completion
ev_status opt_ev_status
ev_comment opt_ev_comment
DO_SYM ev_sql_stmt DO_SYM ev_sql_stmt
{ {
/* /*
...@@ -1444,7 +1444,7 @@ ev_schedule_time: EVERY_SYM expr interval ...@@ -1444,7 +1444,7 @@ ev_schedule_time: EVERY_SYM expr interval
} }
; ;
ev_status: /* empty */ {$<ulong_num>$= 0;} opt_ev_status: /* empty */ {$<ulong_num>$= 0;}
| ENABLED_SYM | ENABLED_SYM
{ {
LEX *lex=Lex; LEX *lex=Lex;
...@@ -1491,8 +1491,12 @@ ev_ends: /* empty */ ...@@ -1491,8 +1491,12 @@ ev_ends: /* empty */
} }
; ;
ev_on_completion: /* empty */ {$<ulong_num>$= 0;} opt_ev_on_completion: /* empty */ {$<ulong_num>$= 0;}
| ON COMPLETION_SYM PRESERVE_SYM | ev_on_completion
;
ev_on_completion:
ON COMPLETION_SYM PRESERVE_SYM
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (!lex->et_compile_phase) if (!lex->et_compile_phase)
...@@ -1508,7 +1512,7 @@ ev_on_completion: /* empty */ {$<ulong_num>$= 0;} ...@@ -1508,7 +1512,7 @@ ev_on_completion: /* empty */ {$<ulong_num>$= 0;}
} }
; ;
ev_comment: /* empty */ {$<ulong_num>$= 0;} opt_ev_comment: /* empty */ {$<ulong_num>$= 0;}
| COMMENT_SYM TEXT_STRING_sys | COMMENT_SYM TEXT_STRING_sys
{ {
LEX *lex= Lex; LEX *lex= Lex;
...@@ -4711,12 +4715,11 @@ alter: ...@@ -4711,12 +4715,11 @@ alter:
YYTHD->client_capabilities &= ~CLIENT_MULTI_QUERIES; YYTHD->client_capabilities &= ~CLIENT_MULTI_QUERIES;
} }
ev_on_schedule ev_alter_on_schedule_completion
ev_rename_to opt_ev_rename_to
ev_on_completion opt_ev_status
ev_status opt_ev_comment
ev_comment opt_ev_sql_stmt
ev_opt_sql_stmt
{ {
/* /*
$1 - ALTER $1 - ALTER
...@@ -4731,7 +4734,7 @@ alter: ...@@ -4731,7 +4734,7 @@ alter:
can overwrite it can overwrite it
*/ */
if (!($<ulong_num>5 || $<ulong_num>6 || $<ulong_num>7 || if (!($<ulong_num>5 || $<ulong_num>6 || $<ulong_num>7 ||
$<ulong_num>8 || $<ulong_num>9 || $<ulong_num>10)) $<ulong_num>8 || $<ulong_num>9))
{ {
yyerror(ER(ER_SYNTAX_ERROR)); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
...@@ -4760,15 +4763,13 @@ alter: ...@@ -4760,15 +4763,13 @@ alter:
} }
; ;
ev_alter_on_schedule_completion: /* empty */ { $<ulong_num>$= 0;}
| ON SCHEDULE_SYM ev_schedule_time { $<ulong_num>$= 1; }
| ev_on_completion { $<ulong_num>$= 1; }
| ON SCHEDULE_SYM ev_schedule_time ev_on_completion { $<ulong_num>$= 1; }
;
ev_on_schedule: /* empty */ { $<ulong_num>$= 0;} opt_ev_rename_to: /* empty */ { $<ulong_num>$= 0;}
| ON SCHEDULE_SYM ev_schedule_time
{
$<ulong_num>$= 1;
}
;
ev_rename_to: /* empty */ { $<ulong_num>$= 0;}
| RENAME TO_SYM sp_name | RENAME TO_SYM sp_name
{ {
LEX *lex=Lex; LEX *lex=Lex;
...@@ -4778,7 +4779,7 @@ ev_rename_to: /* empty */ { $<ulong_num>$= 0;} ...@@ -4778,7 +4779,7 @@ ev_rename_to: /* empty */ { $<ulong_num>$= 0;}
} }
; ;
ev_opt_sql_stmt: /* empty*/ { $<ulong_num>$= 0;} opt_ev_sql_stmt: /* empty*/ { $<ulong_num>$= 0;}
| DO_SYM ev_sql_stmt | DO_SYM ev_sql_stmt
{ {
$<ulong_num>$= 1; $<ulong_num>$= 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment