Commit e8778f1c authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-19265 Server should throw warning if event is created and event_scheduler = OFF

parent 75908617
...@@ -245,7 +245,11 @@ Log_name Pos Event_type Server_id End_log_pos Info ...@@ -245,7 +245,11 @@ Log_name Pos Event_type Server_id End_log_pos Info
RESET MASTER; RESET MASTER;
SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30'); 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; 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; 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; SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME EVENT_DEFINITION EVENT_NAME EVENT_DEFINITION
ev1 DROP TABLE IF EXISTS t2 ev1 DROP TABLE IF EXISTS t2
......
...@@ -4,6 +4,8 @@ CREATE TABLE t1 (a INT); ...@@ -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; 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 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); 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; SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME EVENT_DEFINITION EVENT_NAME EVENT_DEFINITION
ev1 INSERT INTO t1 VALUES (10) ev1 INSERT INTO t1 VALUES (10)
...@@ -21,10 +23,13 @@ ev1 INSERT INTO t1 VALUES (10) ...@@ -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); CREATE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (12);
Warnings: Warnings:
Note 1537 Event 'ev1' already exists 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; SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME EVENT_DEFINITION EVENT_NAME EVENT_DEFINITION
ev1 INSERT INTO t1 VALUES (10) ev1 INSERT INTO t1 VALUES (10)
CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (13); 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; SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME EVENT_DEFINITION EVENT_NAME EVENT_DEFINITION
ev1 INSERT INTO t1 VALUES (13) ev1 INSERT INTO t1 VALUES (13)
......
...@@ -2186,6 +2186,8 @@ COLLATION(_utf8 'текст') AS c4, ...@@ -2186,6 +2186,8 @@ COLLATION(_utf8 'текст') AS c4,
@@collation_connection AS c5, @@collation_connection AS c5,
@@character_set_client AS c6; @@character_set_client AS c6;
END| 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 CREATE EVENT ev2 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO
BEGIN BEGIN
...@@ -2198,6 +2200,8 @@ COLLATION(_utf8 'текст') AS c4, ...@@ -2198,6 +2200,8 @@ COLLATION(_utf8 'текст') AS c4,
@@collation_connection AS c5, @@collation_connection AS c5,
@@character_set_client AS c6; @@character_set_client AS c6;
END| 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 CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO
BEGIN BEGIN
...@@ -2210,6 +2214,8 @@ COLLATION(_utf8 'текст') AS c4, ...@@ -2210,6 +2214,8 @@ COLLATION(_utf8 'текст') AS c4,
@@collation_connection AS c5, @@collation_connection AS c5,
@@character_set_client AS c6; @@character_set_client AS c6;
END| 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 CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO
BEGIN BEGIN
...@@ -2222,6 +2228,8 @@ COLLATION(_utf8 'текст') AS c4, ...@@ -2222,6 +2228,8 @@ COLLATION(_utf8 'текст') AS c4,
@@collation_connection AS c5, @@collation_connection AS c5,
@@character_set_client AS c6; @@character_set_client AS c6;
END| END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
......
...@@ -2186,6 +2186,8 @@ COLLATION(_koi8r ' ...@@ -2186,6 +2186,8 @@ COLLATION(_koi8r '
@@collation_connection AS c5, @@collation_connection AS c5,
@@character_set_client AS c6; @@character_set_client AS c6;
END| 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 CREATE EVENT ev2 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO
BEGIN BEGIN
...@@ -2198,6 +2200,8 @@ COLLATION(_koi8r ' ...@@ -2198,6 +2200,8 @@ COLLATION(_koi8r '
@@collation_connection AS c5, @@collation_connection AS c5,
@@character_set_client AS c6; @@character_set_client AS c6;
END| 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 CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO
BEGIN BEGIN
...@@ -2210,6 +2214,8 @@ COLLATION(_koi8r ' ...@@ -2210,6 +2214,8 @@ COLLATION(_koi8r '
@@collation_connection AS c5, @@collation_connection AS c5,
@@character_set_client AS c6; @@character_set_client AS c6;
END| 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 CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO
BEGIN BEGIN
...@@ -2222,6 +2228,8 @@ COLLATION(_koi8r ' ...@@ -2222,6 +2228,8 @@ COLLATION(_koi8r '
@@collation_connection AS c5, @@collation_connection AS c5,
@@character_set_client AS c6; @@character_set_client AS c6;
END| END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
......
This diff is collapsed.
...@@ -3,6 +3,8 @@ drop database if exists events_test; ...@@ -3,6 +3,8 @@ drop database if exists events_test;
create database events_test; create database events_test;
use events_test; use events_test;
create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5; 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; 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 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 events_test e_26 set @a = 5 root@localhost 2037-01-01 00:00:00 DROP
...@@ -13,6 +15,8 @@ create event e_26 on schedule at 'definitely not a datetime' disable do set @a = ...@@ -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' ERROR HY000: Incorrect AT value: 'definitely not a datetime'
set names utf8; set names utf8;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1; 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 задачка; drop event задачка;
"DISABLE the scheduler. Testing that it does not work when the variable is 0" "DISABLE the scheduler. Testing that it does not work when the variable is 0"
set global event_scheduler=off; set global event_scheduler=off;
...@@ -22,6 +26,8 @@ select get_lock("test_lock1", 20); ...@@ -22,6 +26,8 @@ select get_lock("test_lock1", 20);
get_lock("test_lock1", 20) get_lock("test_lock1", 20)
1 1
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);
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
"Should return 1 row" "Should return 1 row"
select definer, name, db from mysql.event; select definer, name, db from mysql.event;
definer name db definer name db
...@@ -94,22 +100,30 @@ on schedule every 10 hour ...@@ -94,22 +100,30 @@ on schedule every 10 hour
disable disable
do do
select 1; 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'; select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
event_schema event_name definer event_definition event_schema event_name definer event_definition
events_test white_space root@localhost select 1 events_test white_space root@localhost select 1
drop event white_space; drop event white_space;
create event white_space on schedule every 10 hour disable do create event white_space on schedule every 10 hour disable do
select 2; 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'; select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
event_schema event_name definer event_definition event_schema event_name definer event_definition
events_test white_space root@localhost select 2 events_test white_space root@localhost select 2
drop event white_space; drop event white_space;
create event white_space on schedule every 10 hour disable do select 3; 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'; select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
event_schema event_name definer event_definition event_schema event_name definer event_definition
events_test white_space root@localhost select 3 events_test white_space root@localhost select 3
drop event white_space; drop event white_space;
create event e1 on schedule every 1 year do set @a = 5; 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 table t1 (s1 int);
create trigger t1_ai after insert on t1 for each row show create event e1; 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 ERROR 0A000: Not allowed to return a result set from a trigger
...@@ -126,6 +140,8 @@ LOCK TABLES mode. ...@@ -126,6 +140,8 @@ LOCK TABLES mode.
create table t1 (a int); create table t1 (a int);
create event e1 on schedule every 10 hour do select 1; 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; lock table t1 read;
show create event e1; show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
...@@ -229,6 +245,8 @@ Events in sub-statements, events and prelocking ...@@ -229,6 +245,8 @@ Events in sub-statements, events and prelocking
create event e1 on schedule every 10 hour do select 1; 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 create function f1() returns int
begin begin
show create event e1; show create event e1;
...@@ -321,6 +339,8 @@ drop table t1| ...@@ -321,6 +339,8 @@ drop table t1|
drop event e1| drop event e1|
set names utf8; set names utf8;
create event имя_события_в_кодировке_утф8_длиной_больше_чем_48 on schedule every 2 year do select 1; 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 select EVENT_NAME from information_schema.events
where event_schema='test'; where event_schema='test';
EVENT_NAME EVENT_NAME
...@@ -333,6 +353,8 @@ create event event_35981 on schedule every 6 month on completion preserve ...@@ -333,6 +353,8 @@ create event event_35981 on schedule every 6 month on completion preserve
disable disable
do do
select 1; 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 The following SELECTs should all give 1
select count(*) from information_schema.events select count(*) from information_schema.events
where event_schema = database() and event_name = 'event_35981' and where event_schema = database() and event_name = 'event_35981' and
...@@ -367,6 +389,8 @@ drop event event_35981; ...@@ -367,6 +389,8 @@ drop event event_35981;
create event event_35981 on schedule every 6 month disable create event event_35981 on schedule every 6 month disable
do do
select 1; 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 select count(*) from information_schema.events
where event_schema = database() and event_name = 'event_35981' and where event_schema = database() and event_name = 'event_35981' and
on_completion = 'NOT PRESERVE'; on_completion = 'NOT PRESERVE';
...@@ -377,6 +401,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp ...@@ -377,6 +401,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp
on completion not preserve on completion not preserve
do do
select 1; 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' alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
ends '1999-01-02 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. 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.
...@@ -385,6 +411,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp ...@@ -385,6 +411,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp
on completion not preserve on completion not preserve
do do
select 1; 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' 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; ends '1999-01-02 00:00:00' on completion preserve;
Warnings: Warnings:
...@@ -394,6 +422,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp ...@@ -394,6 +422,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp
on completion preserve on completion preserve
do do
select 1; 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' alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
ends '1999-01-02 00:00:00'; ends '1999-01-02 00:00:00';
Warnings: Warnings:
......
This diff is collapsed.
CREATE DATABASE IF NOT EXISTS events_test; CREATE DATABASE IF NOT EXISTS events_test;
use events_test; use events_test;
CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123; CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SHOW EVENTS; SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
...@@ -37,7 +39,11 @@ Let's create some new events from the name of ev_test@localhost ...@@ -37,7 +39,11 @@ Let's create some new events from the name of ev_test@localhost
CREATE EVENT one_event ON SCHEDULE EVERY 20 SECOND DO SELECT 123; CREATE EVENT one_event ON SCHEDULE EVERY 20 SECOND DO SELECT 123;
ERROR HY000: Event 'one_event' already exists ERROR HY000: Event 'one_event' already exists
CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE COMMENT "two event" DO SELECT 123; CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE COMMENT "two event" DO SELECT 123;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE EVENT three_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION PRESERVE COMMENT "three event" DO SELECT 123; CREATE EVENT three_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION PRESERVE COMMENT "three event" DO SELECT 123;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
"Now we should see 3 events:"; "Now we should see 3 events:";
SHOW EVENTS; SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
...@@ -55,6 +61,8 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E ...@@ -55,6 +61,8 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E
GRANT EVENT ON events_test2.* TO ev_test@localhost; GRANT EVENT ON events_test2.* TO ev_test@localhost;
USE events_test2; USE events_test2;
CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42; CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
USE events_test; USE events_test;
"We should see 4 events : one_event, two_event, three_event & four_event" "We should see 4 events : one_event, two_event, three_event & four_event"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
...@@ -73,6 +81,8 @@ def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SEC ...@@ -73,6 +81,8 @@ def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SEC
CREATE DATABASE events_test2; CREATE DATABASE events_test2;
USE events_test2; USE events_test2;
CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42; CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
"Should see 4 events - one, two, three & five" "Should see 4 events - one, two, three & five"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
......
...@@ -6,10 +6,16 @@ use events_test; ...@@ -6,10 +6,16 @@ use events_test;
create table execution_log(name char(10)); create table execution_log(name char(10));
create event abc1 on schedule every 1 second do create event abc1 on schedule every 1 second do
insert into execution_log value('abc1'); insert into execution_log value('abc1');
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
create event abc2 on schedule every 1 second do create event abc2 on schedule every 1 second do
insert into execution_log value('abc2'); insert into execution_log value('abc2');
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
create event abc3 on schedule every 1 second do create event abc3 on schedule every 1 second do
insert into execution_log value('abc3'); insert into execution_log value('abc3');
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
create table event_like like mysql.event; create table event_like like mysql.event;
insert into event_like select * from mysql.event; insert into event_like select * from mysql.event;
alter table mysql.event alter table mysql.event
......
...@@ -15,6 +15,8 @@ create table t1 (a varchar(255)) engine=innodb; ...@@ -15,6 +15,8 @@ create table t1 (a varchar(255)) engine=innodb;
begin work; begin work;
insert into t1 (a) values ("OK: create event"); insert into t1 (a) values ("OK: create event");
create event e1 on schedule every 1 day do select 1; create event e1 on schedule every 1 day do select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
rollback work; rollback work;
select * from t1; select * from t1;
a a
...@@ -60,11 +62,14 @@ OK: drop event if exists ...@@ -60,11 +62,14 @@ OK: drop event if exists
delete from t1; delete from t1;
commit work; commit work;
create event e1 on schedule every 1 day do select 1; create event e1 on schedule every 1 day do select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
begin work; begin work;
insert into t1 (a) values ("OK: create event if not exists"); insert into t1 (a) values ("OK: create event if not exists");
create event if not exists e1 on schedule every 2 day do select 2; create event if not exists e1 on schedule every 2 day do select 2;
Warnings: Warnings:
Note 1537 Event 'e1' already exists Note 1537 Event 'e1' already exists
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
rollback work; rollback work;
select * from t1; select * from t1;
a a
...@@ -96,6 +101,8 @@ OK: alter event rename: rename to same name ...@@ -96,6 +101,8 @@ OK: alter event rename: rename to same name
delete from t1; delete from t1;
commit work; commit work;
create event e2 on schedule every 3 day do select 3; create event e2 on schedule every 3 day do select 3;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
begin work; begin work;
insert into t1 (a) values ("OK: alter event rename: destination exists"); insert into t1 (a) values ("OK: alter event rename: destination exists");
alter event e2 rename to e1; alter event e2 rename to e1;
...@@ -126,6 +133,8 @@ DROP EVENT IF EXISTS e1; ...@@ -126,6 +133,8 @@ DROP EVENT IF EXISTS e1;
CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT); CREATE TABLE t2 (a INT);
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
START TRANSACTION; START TRANSACTION;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
SAVEPOINT A; SAVEPOINT A;
......
...@@ -85,6 +85,8 @@ insert into t1_temp values (1); ...@@ -85,6 +85,8 @@ insert into t1_temp values (1);
return 0; return 0;
end| end|
create event e1 on schedule every 1 minute do begin end; create event e1 on schedule every 1 minute do begin end;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
# #
# Test compatibility of FLUSH TABLES WITH READ LOCK # Test compatibility of FLUSH TABLES WITH READ LOCK
# with various statements. # with various statements.
......
...@@ -725,7 +725,11 @@ DROP TABLE t1, t2; ...@@ -725,7 +725,11 @@ DROP TABLE t1, t2;
# Bug#51391 Deadlock involving events during rqg_info_schema test # Bug#51391 Deadlock involving events during rqg_info_schema test
# #
CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1; CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2; CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
# Connection con1 # Connection con1
SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query"; SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query";
# Sending: # Sending:
......
...@@ -4302,6 +4302,8 @@ create database first; ...@@ -4302,6 +4302,8 @@ create database first;
use first; use first;
set time_zone = 'UTC'; set time_zone = 'UTC';
create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5; create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
show events; show events;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
first ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci first ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
...@@ -4318,7 +4320,11 @@ show create event ee1; ...@@ -4318,7 +4320,11 @@ show create event ee1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci
create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5; create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
show events; show events;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
...@@ -4455,6 +4461,8 @@ DROP DATABASE mysqldump_test_db; ...@@ -4455,6 +4461,8 @@ DROP DATABASE mysqldump_test_db;
TRUNCATE mysql.event; TRUNCATE mysql.event;
USE test; USE test;
CREATE event e29938 ON SCHEDULE AT '2035-12-31 20:01:23' DO SET @bug29938=29938; CREATE event e29938 ON SCHEDULE AT '2035-12-31 20:01:23' DO SET @bug29938=29938;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SHOW EVENTS; SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
test e29938 root@localhost SYSTEM ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci test e29938 root@localhost SYSTEM ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
...@@ -4541,6 +4549,8 @@ CREATE TABLE t1 (f1 INT); ...@@ -4541,6 +4549,8 @@ CREATE TABLE t1 (f1 INT);
CREATE TRIGGER tr1 BEFORE UPDATE ON t1 FOR EACH ROW SET @f1 = 1; CREATE TRIGGER tr1 BEFORE UPDATE ON t1 FOR EACH ROW SET @f1 = 1;
CREATE PROCEDURE pr1 () SELECT "Meow"; CREATE PROCEDURE pr1 () SELECT "Meow";
CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT "Meow"; CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT "Meow";
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SHOW TRIGGERS; SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
...@@ -4731,7 +4741,11 @@ SELECT COUNT(*) INTO param1 FROM t2; ...@@ -4731,7 +4741,11 @@ SELECT COUNT(*) INTO param1 FROM t2;
END// END//
# Events. # Events.
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792; CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792; CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
# Functions. # Functions.
CREATE FUNCTION `hello1` (s CHAR(20)) CREATE FUNCTION `hello1` (s CHAR(20))
RETURNS CHAR(50) DETERMINISTIC RETURNS CHAR(50) DETERMINISTIC
...@@ -5332,6 +5346,8 @@ one` BEFORE INSERT ON `tab ...@@ -5332,6 +5346,8 @@ one` BEFORE INSERT ON `tab
one` FOR EACH ROW SET NEW.a = 1; one` FOR EACH ROW SET NEW.a = 1;
CREATE EVENT `event CREATE EVENT `event
one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5; one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SHOW TABLES FROM bug25717383; SHOW TABLES FROM bug25717383;
Tables_in_bug25717383 Tables_in_bug25717383
tab tab
......
...@@ -2706,9 +2706,13 @@ create procedure proc_1() alter event xyz comment 'xyz'; ...@@ -2706,9 +2706,13 @@ create procedure proc_1() alter event xyz comment 'xyz';
call proc_1(); call proc_1();
drop event xyz; drop event xyz;
create event xyz on schedule every 5 minute disable do select 123; create event xyz on schedule every 5 minute disable do select 123;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
call proc_1(); call proc_1();
drop event xyz; drop event xyz;
create event xyz on schedule every 5 minute disable do select 123; create event xyz on schedule every 5 minute disable do select 123;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
call proc_1(); call proc_1();
drop event xyz; drop event xyz;
drop procedure proc_1; drop procedure proc_1;
...@@ -2723,6 +2727,8 @@ create event xyz on schedule every 5 minute disable do select 123; ...@@ -2723,6 +2727,8 @@ create event xyz on schedule every 5 minute disable do select 123;
create procedure proc_1() drop event xyz; create procedure proc_1() drop event xyz;
call proc_1(); call proc_1();
create event xyz on schedule every 5 minute disable do select 123; create event xyz on schedule every 5 minute disable do select 123;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
call proc_1(); call proc_1();
call proc_1(); call proc_1();
ERROR HY000: Unknown event 'xyz' ERROR HY000: Unknown event 'xyz'
......
...@@ -797,6 +797,8 @@ create event e1 on schedule every 1 year starts now() ...@@ -797,6 +797,8 @@ create event e1 on schedule every 1 year starts now()
ends date_add(now(), interval 5 hour) do ends date_add(now(), interval 5 hour) do
begin begin
end; end;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
flush status; flush status;
show databases; show databases;
show tables; show tables;
...@@ -1430,6 +1432,8 @@ CREATE TRIGGER t1_bi BEFORE INSERT ON t1 ...@@ -1430,6 +1432,8 @@ CREATE TRIGGER t1_bi BEFORE INSERT ON t1
FOR EACH ROW FOR EACH ROW
SET NEW.c1 = ''; SET NEW.c1 = '';
CREATE EVENT ev1 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO SELECT '' AS test; CREATE EVENT ev1 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO SELECT '' AS test;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
set names utf8; set names utf8;
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
......
...@@ -268,6 +268,8 @@ USE test; ...@@ -268,6 +268,8 @@ USE test;
SET @@SQL_MODE = ''; SET @@SQL_MODE = '';
CREATE EVENT teste_bug11763507 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR CREATE EVENT teste_bug11763507 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
DO SELECT 1 $ DO SELECT 1 $
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SHOW EVENTS LIKE 'teste_bug11763507'; SHOW EVENTS LIKE 'teste_bug11763507';
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
test teste_bug11763507 root@localhost SYSTEM ONE TIME # # # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci test teste_bug11763507 root@localhost SYSTEM ONE TIME # # # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
......
...@@ -15,10 +15,10 @@ BEGIN ...@@ -15,10 +15,10 @@ BEGIN
SELECT 1; SELECT 1;
END $$ END $$
DROP TABLE IF EXISTS t1,t2; DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND
DO INSERT INTO t1 VALUES(1); DO INSERT INTO t1 VALUES(1);
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
Assert Questions == 7 Assert Questions == 7
SHOW STATUS LIKE 'Questions'; SHOW STATUS LIKE 'Questions';
Variable_name Value Variable_name Value
......
...@@ -15,6 +15,8 @@ CREATE EVENT mysqltest.e1 ON SCHEDULE EVERY 15 MINUTE DO BEGIN END; ...@@ -15,6 +15,8 @@ CREATE EVENT mysqltest.e1 ON SCHEDULE EVERY 15 MINUTE DO BEGIN END;
ERROR 42000: Unknown database 'mysqltest' ERROR 42000: Unknown database 'mysqltest'
CREATE DATABASE mysqltest; CREATE DATABASE mysqltest;
CREATE EVENT mysqltest.e1 ON SCHEDULE EVERY 15 MINUTE DO BEGIN END; CREATE EVENT mysqltest.e1 ON SCHEDULE EVERY 15 MINUTE DO BEGIN END;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SET DEBUG_SYNC= "after_wait_locked_schema_name SIGNAL locked WAIT_FOR release"; SET DEBUG_SYNC= "after_wait_locked_schema_name SIGNAL locked WAIT_FOR release";
DROP DATABASE mysqltest;; DROP DATABASE mysqltest;;
SET DEBUG_SYNC= "now WAIT_FOR locked"; SET DEBUG_SYNC= "now WAIT_FOR locked";
......
...@@ -21,6 +21,8 @@ DO ...@@ -21,6 +21,8 @@ DO
BEGIN BEGIN
UPDATE t1 SET id = id +1; UPDATE t1 SET id = id +1;
END;| END;|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
Check Result Check Result
select select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog")) (@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog"))
......
CREATE EVENT event1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT 1; CREATE EVENT event1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1'; SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1';
DEFINER= 'root@localhost' ORIGINATOR = 1 STATUS = 'SLAVESIDE_DISABLED' EVENT_TYPE = 'ONE TIME' ON_COMPLETION = 'NOT PRESERVE' DEFINER= 'root@localhost' ORIGINATOR = 1 STATUS = 'SLAVESIDE_DISABLED' EVENT_TYPE = 'ONE TIME' ON_COMPLETION = 'NOT PRESERVE'
1 1 1 1 1 1 1 1 1 1
......
"Testing mysql_upgrade with EVENT performance_schema.user_event" "Testing mysql_upgrade with EVENT performance_schema.user_event"
create event test.user_event on schedule every 1 day do create event test.user_event on schedule every 1 day do
select "not supposed to be here"; select "not supposed to be here";
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
update mysql.event set db='performance_schema' where name='user_event'; update mysql.event set db='performance_schema' where name='user_event';
select name from mysql.event where db='performance_schema'; select name from mysql.event where db='performance_schema';
name name
......
...@@ -3,9 +3,13 @@ include/master-slave.inc ...@@ -3,9 +3,13 @@ include/master-slave.inc
SET GLOBAL event_scheduler=off; SET GLOBAL event_scheduler=off;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (10); 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.
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11); CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11);
ERROR HY000: Event 'ev1' already exists ERROR HY000: Event 'ev1' already exists
CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11); CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11);
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SELECT EVENT_NAME,STATUS,EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; SELECT EVENT_NAME,STATUS,EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME STATUS EVENT_DEFINITION EVENT_NAME STATUS EVENT_DEFINITION
ev1 ENABLED INSERT INTO t1 VALUES (11) ev1 ENABLED INSERT INTO t1 VALUES (11)
......
...@@ -83,6 +83,8 @@ include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user] ...@@ -83,6 +83,8 @@ include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user]
# Verify 'ALTER EVENT...' statement # Verify 'ALTER EVENT...' statement
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
# Explicitly assign CURRENT_USER() to definer # Explicitly assign CURRENT_USER() to definer
ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE;
include/rpl_sync.inc include/rpl_sync.inc
......
...@@ -32,6 +32,8 @@ test justonce SLAVESIDE_DISABLED 1 ...@@ -32,6 +32,8 @@ test justonce SLAVESIDE_DISABLED 1
DROP EVENT IF EXISTS test.slave_once; DROP EVENT IF EXISTS test.slave_once;
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
"Checking event status on the slave for originator value = slave's server_id" "Checking event status on the slave for originator value = slave's server_id"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
db name status originator db name status originator
...@@ -73,6 +75,8 @@ db name status originator ...@@ -73,6 +75,8 @@ db name status originator
"Creating event test.slave_terminate on the slave" "Creating event test.slave_terminate on the slave"
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
"Checking event status on the slave" "Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
db name status originator db name status originator
...@@ -82,6 +86,8 @@ DROP EVENT test.slave_terminate; ...@@ -82,6 +86,8 @@ DROP EVENT test.slave_terminate;
"Creating event test.slave_terminate with DISABLE ON SLAVE on the slave" "Creating event test.slave_terminate with DISABLE ON SLAVE on the slave"
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO
INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate'); INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate');
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
"Checking event status on the slave" "Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
db name status originator db name status originator
......
...@@ -216,6 +216,8 @@ DO ...@@ -216,6 +216,8 @@ DO
BEGIN BEGIN
UPDATE test.t1 SET a = a + 1 WHERE a < 10; UPDATE test.t1 SET a = a + 1 WHERE a < 10;
END| END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
RESET SLAVE; RESET SLAVE;
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5; CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5;
include/start_slave.inc include/start_slave.inc
......
...@@ -678,6 +678,8 @@ DROP TRIGGER tr1; ...@@ -678,6 +678,8 @@ DROP TRIGGER tr1;
GRANT EVENT ON *.* TO 'root'@'localhost'; GRANT EVENT ON *.* TO 'root'@'localhost';
INSERT INTO t1 VALUES(1, 'test1'); INSERT INTO t1 VALUES(1, 'test1');
CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1; CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
==========MASTER========== ==========MASTER==========
SHOW EVENTS; SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
......
...@@ -50,11 +50,15 @@ BEGIN ...@@ -50,11 +50,15 @@ BEGIN
ALTER EVENT e1 DISABLE; ALTER EVENT e1 DISABLE;
CALL p1(10, ''); CALL p1(10, '');
END| END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
BEGIN BEGIN
ALTER EVENT e11 DISABLE; ALTER EVENT e11 DISABLE;
CALL p11(10, ''); CALL p11(10, '');
END| END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64) CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64)
BEGIN BEGIN
IF x > 5 THEN IF x > 5 THEN
......
...@@ -32,6 +32,8 @@ CREATE DATABASE d1; ...@@ -32,6 +32,8 @@ CREATE DATABASE d1;
CREATE EVENT e1 CREATE EVENT e1
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
DO INSERT INTO test.t1 VALUES (1); DO INSERT INTO test.t1 VALUES (1);
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE FUNCTION f1 () RETURNS INT DETERMINISTIC CREATE FUNCTION f1 () RETURNS INT DETERMINISTIC
RETURN 1; RETURN 1;
CREATE PROCEDURE p1 (OUT rows INT) CREATE PROCEDURE p1 (OUT rows INT)
......
...@@ -60,6 +60,8 @@ INSERT INTO tt_1(ddl_case) VALUES (28); ...@@ -60,6 +60,8 @@ INSERT INTO tt_1(ddl_case) VALUES (28);
DROP USER 'user_new'@'localhost'; DROP USER 'user_new'@'localhost';
INSERT INTO tt_1(ddl_case) VALUES (27); INSERT INTO tt_1(ddl_case) VALUES (27);
CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1; CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
INSERT INTO tt_1(ddl_case) VALUES (26); INSERT INTO tt_1(ddl_case) VALUES (26);
ALTER EVENT evt COMMENT 'evt'; ALTER EVENT evt COMMENT 'evt';
INSERT INTO tt_1(ddl_case) VALUES (25); INSERT INTO tt_1(ddl_case) VALUES (25);
......
...@@ -60,6 +60,8 @@ INSERT INTO tt_1(ddl_case) VALUES (28); ...@@ -60,6 +60,8 @@ INSERT INTO tt_1(ddl_case) VALUES (28);
DROP USER 'user_new'@'localhost'; DROP USER 'user_new'@'localhost';
INSERT INTO tt_1(ddl_case) VALUES (27); INSERT INTO tt_1(ddl_case) VALUES (27);
CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1; CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
INSERT INTO tt_1(ddl_case) VALUES (26); INSERT INTO tt_1(ddl_case) VALUES (26);
ALTER EVENT evt COMMENT 'evt'; ALTER EVENT evt COMMENT 'evt';
INSERT INTO tt_1(ddl_case) VALUES (25); INSERT INTO tt_1(ddl_case) VALUES (25);
......
...@@ -60,6 +60,8 @@ INSERT INTO tt_1(ddl_case) VALUES (28); ...@@ -60,6 +60,8 @@ INSERT INTO tt_1(ddl_case) VALUES (28);
DROP USER 'user_new'@'localhost'; DROP USER 'user_new'@'localhost';
INSERT INTO tt_1(ddl_case) VALUES (27); INSERT INTO tt_1(ddl_case) VALUES (27);
CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1; CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
INSERT INTO tt_1(ddl_case) VALUES (26); INSERT INTO tt_1(ddl_case) VALUES (26);
ALTER EVENT evt COMMENT 'evt'; ALTER EVENT evt COMMENT 'evt';
INSERT INTO tt_1(ddl_case) VALUES (25); INSERT INTO tt_1(ddl_case) VALUES (25);
......
...@@ -4,6 +4,8 @@ CREATE TEMPORARY TABLE t1 (a INT); ...@@ -4,6 +4,8 @@ CREATE TEMPORARY TABLE t1 (a INT);
CREATE TABLE t2 (a INT, b INT) ENGINE= MyISAM; CREATE TABLE t2 (a INT, b INT) ENGINE= MyISAM;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
CREATE EVENT e1 ON SCHEDULE EVERY 10 HOUR DO SELECT 1; 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.
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
ALTER EVENT e1 ON SCHEDULE EVERY 20 HOUR DO SELECT 1; ALTER EVENT e1 ON SCHEDULE EVERY 20 HOUR DO SELECT 1;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
...@@ -123,6 +125,8 @@ ERROR HY000: Can't execute the given command because you have active locked tabl ...@@ -123,6 +125,8 @@ ERROR HY000: Can't execute the given command because you have active locked tabl
INSERT INTO t2 VALUES ("CREATE EVENT e1 with table locked"); INSERT INTO t2 VALUES ("CREATE EVENT e1 with table locked");
UNLOCK TABLE; UNLOCK TABLE;
CREATE EVENT e2 ON SCHEDULE EVERY 10 HOUR DO SELECT 1; CREATE EVENT e2 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 WRITE; LOCK TABLE t1 WRITE;
ALTER EVENT e2 ON SCHEDULE EVERY 20 HOUR DO SELECT 1; ALTER EVENT e2 ON SCHEDULE EVERY 20 HOUR DO SELECT 1;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
......
...@@ -21,6 +21,7 @@ GRANT ALL ON *.* TO event_user3@localhost; ...@@ -21,6 +21,7 @@ GRANT ALL ON *.* TO event_user3@localhost;
connect (conn2,localhost,event_user2,,events_conn2_db); connect (conn2,localhost,event_user2,,events_conn2_db);
--echo "In the second connection we create some events which won't be dropped till the end" --echo "In the second connection we create some events which won't be dropped till the end"
--disable_query_log --disable_query_log
--disable_warnings
let $1= 50; let $1= 50;
while ($1) while ($1)
{ {
......
...@@ -20,11 +20,11 @@ END $$ ...@@ -20,11 +20,11 @@ END $$
DELIMITER ;$$ DELIMITER ;$$
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1,t2; DROP TABLE IF EXISTS t1,t2;
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND
DO INSERT INTO t1 VALUES(1);
--enable_warnings --enable_warnings
CREATE TABLE t1 (c1 INT); CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT); CREATE TABLE t2 (c1 INT);
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND
DO INSERT INTO t1 VALUES(1);
--echo Assert Questions == 7 --echo Assert Questions == 7
SHOW STATUS LIKE 'Questions'; SHOW STATUS LIKE 'Questions';
......
...@@ -417,6 +417,12 @@ Events::create_event(THD *thd, Event_parse_data *parse_data) ...@@ -417,6 +417,12 @@ Events::create_event(THD *thd, Event_parse_data *parse_data)
thd->restore_stmt_binlog_format(save_binlog_format); thd->restore_stmt_binlog_format(save_binlog_format);
if (!ret && Events::opt_event_scheduler == Events::EVENTS_OFF)
{
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.");
}
DBUG_RETURN(ret); DBUG_RETURN(ret);
WSREP_ERROR_LABEL: WSREP_ERROR_LABEL:
......
...@@ -681,6 +681,8 @@ DROP TRIGGER tr1; ...@@ -681,6 +681,8 @@ DROP TRIGGER tr1;
GRANT EVENT ON *.* TO 'root'@'localhost'; GRANT EVENT ON *.* TO 'root'@'localhost';
INSERT INTO t1 VALUES(1, 'test1'); INSERT INTO t1 VALUES(1, 'test1');
CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1; CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
==========MASTER========== ==========MASTER==========
SHOW EVENTS; SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
......
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