Skip to content

Commit

Permalink
MDEV-19265 Server should throw warning if event is created and event_…
Browse files Browse the repository at this point in the history
…scheduler = OFF
  • Loading branch information
vaintroub committed Apr 28, 2019
1 parent 7590861 commit e8778f1
Show file tree
Hide file tree
Showing 36 changed files with 289 additions and 4 deletions.
4 changes: 4 additions & 0 deletions mysql-test/r/create_drop_binlog.result
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ Log_name Pos Event_type Server_id End_log_pos Info
RESET MASTER;
SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30');
CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t2;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME EVENT_DEFINITION
ev1 DROP TABLE IF EXISTS t2
Expand Down
5 changes: 5 additions & 0 deletions mysql-test/r/create_drop_event.result
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ CREATE TABLE t1 (a INT);
CREATE OR REPLACE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db1;
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (10);
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME EVENT_DEFINITION
ev1 INSERT INTO t1 VALUES (10)
Expand All @@ -21,10 +23,13 @@ ev1 INSERT INTO t1 VALUES (10)
CREATE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (12);
Warnings:
Note 1537 Event 'ev1' already exists
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME EVENT_DEFINITION
ev1 INSERT INTO t1 VALUES (10)
CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (13);
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME EVENT_DEFINITION
ev1 INSERT INTO t1 VALUES (13)
Expand Down
8 changes: 8 additions & 0 deletions mysql-test/r/ddl_i18n_koi8r.result
Original file line number Diff line number Diff line change
Expand Up @@ -2186,6 +2186,8 @@ COLLATION(_utf8 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.

CREATE EVENT ev2 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO
BEGIN
Expand All @@ -2198,6 +2200,8 @@ COLLATION(_utf8 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.

CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO
BEGIN
Expand All @@ -2210,6 +2214,8 @@ COLLATION(_utf8 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.

CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO
BEGIN
Expand All @@ -2222,6 +2228,8 @@ COLLATION(_utf8 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.



Expand Down
8 changes: 8 additions & 0 deletions mysql-test/r/ddl_i18n_utf8.result
Original file line number Diff line number Diff line change
Expand Up @@ -2186,6 +2186,8 @@ COLLATION(_koi8r '
@@collation_connection AS c5,
@@character_set_client AS c6;
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.

CREATE EVENT ev2 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO
BEGIN
Expand All @@ -2198,6 +2200,8 @@ COLLATION(_koi8r '
@@collation_connection AS c5,
@@character_set_client AS c6;
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.

CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO
BEGIN
Expand All @@ -2210,6 +2214,8 @@ COLLATION(_koi8r '
@@collation_connection AS c5,
@@character_set_client AS c6;
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.

CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO
BEGIN
Expand All @@ -2222,6 +2228,8 @@ COLLATION(_koi8r '
@@collation_connection AS c5,
@@character_set_client AS c6;
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.



Expand Down
68 changes: 68 additions & 0 deletions mysql-test/r/events_1.result

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions mysql-test/r/events_2.result
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ drop database if exists events_test;
create database events_test;
use events_test;
create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion
events_test e_26 set @a = 5 root@localhost 2037-01-01 00:00:00 DROP
Expand All @@ -13,6 +15,8 @@ create event e_26 on schedule at 'definitely not a datetime' disable do set @a =
ERROR HY000: Incorrect AT value: 'definitely not a datetime'
set names utf8;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
drop event задачка;
"DISABLE the scheduler. Testing that it does not work when the variable is 0"
set global event_scheduler=off;
Expand All @@ -22,6 +26,8 @@ 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);
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
"Should return 1 row"
select definer, name, db from mysql.event;
definer name db
Expand Down Expand Up @@ -94,22 +100,30 @@ on schedule every 10 hour
disable
do
select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
event_schema event_name definer event_definition
events_test white_space root@localhost select 1
drop event white_space;
create event white_space on schedule every 10 hour disable do
select 2;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
event_schema event_name definer event_definition
events_test white_space root@localhost select 2
drop event white_space;
create event white_space on schedule every 10 hour disable do select 3;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
event_schema event_name definer event_definition
events_test white_space root@localhost select 3
drop event white_space;
create event e1 on schedule every 1 year do set @a = 5;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
create table t1 (s1 int);
create trigger t1_ai after insert on t1 for each row show create event e1;
ERROR 0A000: Not allowed to return a result set from a trigger
Expand All @@ -126,6 +140,8 @@ LOCK TABLES mode.

create table t1 (a int);
create event e1 on schedule every 10 hour do select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
lock table t1 read;
show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
Expand Down Expand Up @@ -229,6 +245,8 @@ Events in sub-statements, events and prelocking


create event e1 on schedule every 10 hour do select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
create function f1() returns int
begin
show create event e1;
Expand Down Expand Up @@ -321,6 +339,8 @@ drop table t1|
drop event e1|
set names utf8;
create event имя_события_в_кодировке_утф8_длиной_больше_чем_48 on schedule every 2 year do select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
select EVENT_NAME from information_schema.events
where event_schema='test';
EVENT_NAME
Expand All @@ -333,6 +353,8 @@ create event event_35981 on schedule every 6 month on completion preserve
disable
do
select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
The following SELECTs should all give 1
select count(*) from information_schema.events
where event_schema = database() and event_name = 'event_35981' and
Expand Down Expand Up @@ -367,6 +389,8 @@ drop event event_35981;
create event event_35981 on schedule every 6 month disable
do
select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
select count(*) from information_schema.events
where event_schema = database() and event_name = 'event_35981' and
on_completion = 'NOT PRESERVE';
Expand All @@ -377,6 +401,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp
on completion not preserve
do
select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
ends '1999-01-02 00:00:00';
ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future.
Expand All @@ -385,6 +411,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp
on completion not preserve
do
select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
ends '1999-01-02 00:00:00' on completion preserve;
Warnings:
Expand All @@ -394,6 +422,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp
on completion preserve
do
select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
ends '1999-01-02 00:00:00';
Warnings:
Expand Down
Loading

0 comments on commit e8778f1

Please sign in to comment.