Commit 119de054 authored by unknown's avatar unknown

fix for bug #17578: Test "events" fails due to scheduling difference


mysql-test/r/events.result:
  update result
mysql-test/r/events_bugs.result:
  update result
mysql-test/t/events.test:
  - use information_schema.processlist
  - move from error codes to constants
mysql-test/t/events_bugs.test:
  fix for bug #17578: Test "events" fails due to scheduling difference
  use information_schema.processlist
parent 27978ba2
...@@ -116,80 +116,80 @@ set names utf8; ...@@ -116,80 +116,80 @@ set names utf8;
CREATE EVENT root6 ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1; CREATE EVENT root6 ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1;
SHOW CREATE EVENT root6; SHOW CREATE EVENT root6;
Event sql_mode Create Event Event sql_mode Create Event
root6 CREATE EVENT `events_test`.`root6` ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1 root6 CREATE EVENT `root6` ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1
create event root7 on schedule every 2 year do select 1; create event root7 on schedule every 2 year do select 1;
SHOW CREATE EVENT root7; SHOW CREATE EVENT root7;
Event sql_mode Create Event Event sql_mode Create Event
root7 CREATE EVENT `events_test`.`root7` ON SCHEDULE EVERY 2 YEAR ON COMPLETION NOT PRESERVE ENABLE DO select 1 root7 CREATE EVENT `root7` ON SCHEDULE EVERY 2 YEAR ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root8 on schedule every '2:5' year_month do select 1; create event root8 on schedule every '2:5' year_month do select 1;
SHOW CREATE EVENT root8; SHOW CREATE EVENT root8;
Event sql_mode Create Event Event sql_mode Create Event
root8 CREATE EVENT `events_test`.`root8` ON SCHEDULE EVERY '2-5' YEAR_MONTH ON COMPLETION NOT PRESERVE ENABLE DO select 1 root8 CREATE EVENT `root8` ON SCHEDULE EVERY '2-5' YEAR_MONTH ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root8_1 on schedule every '2:15' year_month do select 1; create event root8_1 on schedule every '2:15' year_month do select 1;
SHOW CREATE EVENT root8_1; SHOW CREATE EVENT root8_1;
Event sql_mode Create Event Event sql_mode Create Event
root8_1 CREATE EVENT `events_test`.`root8_1` ON SCHEDULE EVERY '3-3' YEAR_MONTH ON COMPLETION NOT PRESERVE ENABLE DO select 1 root8_1 CREATE EVENT `root8_1` ON SCHEDULE EVERY '3-3' YEAR_MONTH ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root9 on schedule every 2 week ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' do select 1; create event root9 on schedule every 2 week ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' do select 1;
SHOW CREATE EVENT root9; SHOW CREATE EVENT root9;
Event sql_mode Create Event Event sql_mode Create Event
root9 CREATE EVENT `events_test`.`root9` ON SCHEDULE EVERY 2 WEEK ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' DO select 1 root9 CREATE EVENT `root9` ON SCHEDULE EVERY 2 WEEK ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' DO select 1
create event root10 on schedule every '20:5' day_hour do select 1; create event root10 on schedule every '20:5' day_hour do select 1;
SHOW CREATE EVENT root10; SHOW CREATE EVENT root10;
Event sql_mode Create Event Event sql_mode Create Event
root10 CREATE EVENT `events_test`.`root10` ON SCHEDULE EVERY '20 5' DAY_HOUR ON COMPLETION NOT PRESERVE ENABLE DO select 1 root10 CREATE EVENT `root10` ON SCHEDULE EVERY '20 5' DAY_HOUR ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root11 on schedule every '20:25' day_hour do select 1; create event root11 on schedule every '20:25' day_hour do select 1;
SHOW CREATE EVENT root11; SHOW CREATE EVENT root11;
Event sql_mode Create Event Event sql_mode Create Event
root11 CREATE EVENT `events_test`.`root11` ON SCHEDULE EVERY '21 1' DAY_HOUR ON COMPLETION NOT PRESERVE ENABLE DO select 1 root11 CREATE EVENT `root11` ON SCHEDULE EVERY '21 1' DAY_HOUR ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root12 on schedule every '20:25' hour_minute do select 1; create event root12 on schedule every '20:25' hour_minute do select 1;
SHOW CREATE EVENT root12; SHOW CREATE EVENT root12;
Event sql_mode Create Event Event sql_mode Create Event
root12 CREATE EVENT `events_test`.`root12` ON SCHEDULE EVERY '20:25' HOUR_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1 root12 CREATE EVENT `root12` ON SCHEDULE EVERY '20:25' HOUR_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root13 on schedule every '25:25' hour_minute do select 1; create event root13 on schedule every '25:25' hour_minute do select 1;
SHOW CREATE EVENT root13; SHOW CREATE EVENT root13;
Event sql_mode Create Event Event sql_mode Create Event
root13 CREATE EVENT `events_test`.`root13` ON SCHEDULE EVERY '25:25' HOUR_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1 root13 CREATE EVENT `root13` ON SCHEDULE EVERY '25:25' HOUR_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root13_1 on schedule every '11:65' hour_minute do select 1; create event root13_1 on schedule every '11:65' hour_minute do select 1;
SHOW CREATE EVENT root13_1; SHOW CREATE EVENT root13_1;
Event sql_mode Create Event Event sql_mode Create Event
root13_1 CREATE EVENT `events_test`.`root13_1` ON SCHEDULE EVERY '12:5' HOUR_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1 root13_1 CREATE EVENT `root13_1` ON SCHEDULE EVERY '12:5' HOUR_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root14 on schedule every '35:35' minute_second do select 1; create event root14 on schedule every '35:35' minute_second do select 1;
SHOW CREATE EVENT root14; SHOW CREATE EVENT root14;
Event sql_mode Create Event Event sql_mode Create Event
root14 CREATE EVENT `events_test`.`root14` ON SCHEDULE EVERY '35:35' MINUTE_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1 root14 CREATE EVENT `root14` ON SCHEDULE EVERY '35:35' MINUTE_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root15 on schedule every '35:66' minute_second do select 1; create event root15 on schedule every '35:66' minute_second do select 1;
SHOW CREATE EVENT root15; SHOW CREATE EVENT root15;
Event sql_mode Create Event Event sql_mode Create Event
root15 CREATE EVENT `events_test`.`root15` ON SCHEDULE EVERY '36:6' MINUTE_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1 root15 CREATE EVENT `root15` ON SCHEDULE EVERY '36:6' MINUTE_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root16 on schedule every '35:56' day_minute do select 1; create event root16 on schedule every '35:56' day_minute do select 1;
SHOW CREATE EVENT root16; SHOW CREATE EVENT root16;
Event sql_mode Create Event Event sql_mode Create Event
root16 CREATE EVENT `events_test`.`root16` ON SCHEDULE EVERY '1 11:56' DAY_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1 root16 CREATE EVENT `root16` ON SCHEDULE EVERY '1 11:56' DAY_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root17 on schedule every '35:12:45' day_minute do select 1; create event root17 on schedule every '35:12:45' day_minute do select 1;
SHOW CREATE EVENT root17; SHOW CREATE EVENT root17;
Event sql_mode Create Event Event sql_mode Create Event
root17 CREATE EVENT `events_test`.`root17` ON SCHEDULE EVERY '35 12:45' DAY_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1 root17 CREATE EVENT `root17` ON SCHEDULE EVERY '35 12:45' DAY_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root17_1 on schedule every '35:25:65' day_minute do select 1; create event root17_1 on schedule every '35:25:65' day_minute do select 1;
SHOW CREATE EVENT root17_1; SHOW CREATE EVENT root17_1;
Event sql_mode Create Event Event sql_mode Create Event
root17_1 CREATE EVENT `events_test`.`root17_1` ON SCHEDULE EVERY '36 2:5' DAY_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1 root17_1 CREATE EVENT `root17_1` ON SCHEDULE EVERY '36 2:5' DAY_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root18 on schedule every '35:12:45' hour_second do select 1; create event root18 on schedule every '35:12:45' hour_second do select 1;
SHOW CREATE EVENT root18; SHOW CREATE EVENT root18;
Event sql_mode Create Event Event sql_mode Create Event
root18 CREATE EVENT `events_test`.`root18` ON SCHEDULE EVERY '35:12:45' HOUR_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1 root18 CREATE EVENT `root18` ON SCHEDULE EVERY '35:12:45' HOUR_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root19 on schedule every '15:59:85' hour_second do select 1; create event root19 on schedule every '15:59:85' hour_second do select 1;
SHOW CREATE EVENT root19; SHOW CREATE EVENT root19;
Event sql_mode Create Event Event sql_mode Create Event
root19 CREATE EVENT `events_test`.`root19` ON SCHEDULE EVERY '16:0:25' HOUR_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1 root19 CREATE EVENT `root19` ON SCHEDULE EVERY '16:0:25' HOUR_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
create event root20 on schedule every '50:20:12:45' day_second do select 1; create event root20 on schedule every '50:20:12:45' day_second do select 1;
SHOW CREATE EVENT root20; SHOW CREATE EVENT root20;
Event sql_mode Create Event Event sql_mode Create Event
root20 CREATE EVENT `events_test`.`root20` ON SCHEDULE EVERY '50 20:12:45' DAY_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1 root20 CREATE EVENT `root20` ON SCHEDULE EVERY '50 20:12:45' DAY_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
set names cp1251; set names cp1251;
create event ðóóò21 on schedule every '50:23:59:95' day_second COMMENT 'òîâà å 1251 êîìåíòàð' do select 1; create event ðóóò21 on schedule every '50:23:59:95' day_second COMMENT 'òîâà å 1251 êîìåíòàð' do select 1;
SHOW CREATE EVENT ðóóò21; SHOW CREATE EVENT ðóóò21;
Event sql_mode Create Event Event sql_mode Create Event
ðóóò21 CREATE EVENT `events_test`.`ðóóò21` ON SCHEDULE EVERY '51 0:0:35' DAY_SECOND ON COMPLETION NOT PRESERVE ENABLE COMMENT 'òîâà å 1251 êîìåíòàð' DO select 1 ðóóò21 CREATE EVENT `ðóóò21` ON SCHEDULE EVERY '51 0:0:35' DAY_SECOND ON COMPLETION NOT PRESERVE ENABLE COMMENT 'òîâà å 1251 êîìåíòàð' DO select 1
insert into mysql.event (db, name, body, definer, interval_value, interval_field) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND"); insert into mysql.event (db, name, body, definer, interval_value, interval_field) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND");
show create event root22; show create event root22;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND' ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
...@@ -262,6 +262,8 @@ SHOW EVENTS; ...@@ -262,6 +262,8 @@ SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED
ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default ''; ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
Warnings:
Warning 1265 Data truncated for column 'db' at row 1
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log. ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
ALTER TABLE mysql.event MODIFY db varchar(64) character set utf8 collate utf8_bin default ''; ALTER TABLE mysql.event MODIFY db varchar(64) character set utf8 collate utf8_bin default '';
...@@ -387,10 +389,9 @@ create event закачка on schedule every 10 hour do select get_lock("test_l ...@@ -387,10 +389,9 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
select definer, name, db from mysql.event; select definer, name, db from mysql.event;
definer name db definer name db
root@localhost закачка events_test root@localhost закачка events_test
"Should be only 1 process" "Should be 0 processes"
show processlist; select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
Id User Host db Command Time State Info user host db command state info
# root localhost events_test Query # NULL show processlist
select release_lock("test_lock1"); select release_lock("test_lock1");
release_lock("test_lock1") release_lock("test_lock1")
1 1
...@@ -407,12 +408,11 @@ get_lock("test_lock2", 20) ...@@ -407,12 +408,11 @@ get_lock("test_lock2", 20)
"Create an event which tries to acquire a mutex. The event locks on the mutex" "Create an event which tries to acquire a mutex. The event locks on the mutex"
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20); create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
"Let some time pass to the event starts" "Let some time pass to the event starts"
"Should have only 3 processes: the scheduler, our conn and the locked event" "Should have only 2 processes: the scheduler and the locked event"
show processlist; select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
Id User Host db Command Time State Info user host db command state info
# root localhost events_test Query # NULL show processlist event_scheduler localhost NULL Connect Sleeping NULL
# event_scheduler localhost NULL Connect # Sleeping NULL root localhost events_test Connect User lock select get_lock("test_lock2", 20)
# root localhost events_test Connect # User lock select get_lock("test_lock2", 20)
"Release the mutex, the event worker should finish." "Release the mutex, the event worker should finish."
select release_lock("test_lock2"); select release_lock("test_lock2");
release_lock("test_lock2") release_lock("test_lock2")
...@@ -423,23 +423,21 @@ select get_lock("test_lock2_1", 20); ...@@ -423,23 +423,21 @@ select get_lock("test_lock2_1", 20);
get_lock("test_lock2_1", 20) get_lock("test_lock2_1", 20)
1 1
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20); create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
"Should see 2 processes, one locked on get_lock(" "Should see 1 process, locked on get_lock("
"Shutting down the scheduler, it should wait for the running event" "Shutting down the scheduler, it should wait for the running event"
set global event_scheduler=0; set global event_scheduler=0;
"Should have only 3 processes: the scheduler, our conn and the locked event" "Should have only 2 processes: the scheduler and the locked event"
show processlist; select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
Id User Host db Command Time State Info user host db command state info
# root localhost events_test Query # NULL show processlist event_scheduler localhost NULL Connect Sleeping NULL
# event_scheduler localhost NULL Connect # Sleeping NULL root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
# root localhost events_test Connect # User lock select get_lock("test_lock2_1", 20)
"Release the lock so the child process should finish. Hence the scheduler also" "Release the lock so the child process should finish. Hence the scheduler also"
select release_lock("test_lock2_1"); select release_lock("test_lock2_1");
release_lock("test_lock2_1") release_lock("test_lock2_1")
1 1
"Should have only our process now:" "Should see 0 processes now:"
show processlist; select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
Id User Host db Command Time State Info user host db command state info
# root localhost events_test Query # NULL show processlist
drop event закачка21; drop event закачка21;
create table t_16 (s1 int); create table t_16 (s1 int);
create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5; create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
......
...@@ -29,11 +29,10 @@ select get_lock('test_bug16407', 60); ...@@ -29,11 +29,10 @@ select get_lock('test_bug16407', 60);
drop table "hashed_num"; drop table "hashed_num";
end| end|
"Now if everything is fine the event has compiled and is locked "Now if everything is fine the event has compiled and is locked
show processlist; select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
Id User Host db Command Time State Info user host db command state info
# root localhost events_test Query # NULL show processlist event_scheduler localhost NULL Connect Sleeping NULL
# event_scheduler localhost NULL Connect # Sleeping NULL root localhost events_test Connect User lock select get_lock('test_bug16407', 60)
# root localhost events_test Connect # User lock select get_lock('test_bug16407', 60)
select release_lock('test_bug16407'); select release_lock('test_bug16407');
release_lock('test_bug16407') release_lock('test_bug16407')
1 1
...@@ -54,7 +53,7 @@ create table events_smode_test(ev_name char(10), a date) engine=myisam; ...@@ -54,7 +53,7 @@ create table events_smode_test(ev_name char(10), a date) engine=myisam;
"This should never insert something" "This should never insert something"
create event ee_16407_2 on schedule every 60 second do create event ee_16407_2 on schedule every 60 second do
begin begin
select get_lock('ee_16407_2', 60); select get_lock('ee_16407_2', 60) /*ee_16407_2*/;
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02'); insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end| end|
insert into events_smode_test values ('test','1980-19-02')| insert into events_smode_test values ('test','1980-19-02')|
...@@ -62,7 +61,7 @@ ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1 ...@@ -62,7 +61,7 @@ ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1
"This is ok" "This is ok"
create event ee_16407_3 on schedule every 60 second do create event ee_16407_3 on schedule every 60 second do
begin begin
select get_lock('ee_16407_2', 60); select get_lock('ee_16407_2', 60) /*ee_16407_3*/;
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19'); insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19');
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29'); insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29');
end| end|
...@@ -70,7 +69,7 @@ set sql_mode=""| ...@@ -70,7 +69,7 @@ set sql_mode=""|
"This will insert rows but they will be truncated" "This will insert rows but they will be truncated"
create event ee_16407_4 on schedule every 60 second do create event ee_16407_4 on schedule every 60 second do
begin begin
select get_lock('ee_16407_2', 60); select get_lock('ee_16407_2', 60) /*ee_16407_4*/;
insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956'); insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
end| end|
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
...@@ -83,20 +82,18 @@ select get_lock('ee_16407_2', 60); ...@@ -83,20 +82,18 @@ select get_lock('ee_16407_2', 60);
get_lock('ee_16407_2', 60) get_lock('ee_16407_2', 60)
1 1
set global event_scheduler= 1; set global event_scheduler= 1;
show processlist; select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
Id User Host db Command Time State Info user host db command state info
# root localhost events_test Query # NULL show processlist event_scheduler localhost NULL Connect Sleeping NULL
# event_scheduler localhost NULL Connect # Sleeping NULL root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_2*/
# root localhost events_test Connect # User lock select get_lock('ee_16407_2', 60) root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_3*/
# root localhost events_test Connect # User lock select get_lock('ee_16407_2', 60) root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_4*/
# root localhost events_test Connect # User lock select get_lock('ee_16407_2', 60)
select release_lock('ee_16407_2'); select release_lock('ee_16407_2');
release_lock('ee_16407_2') release_lock('ee_16407_2')
1 1
show processlist; select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
Id User Host db Command Time State Info user host db command state info
# root localhost events_test Query # NULL show processlist event_scheduler localhost NULL Connect Sleeping NULL
# event_scheduler localhost NULL Connect # Sleeping NULL
set global event_scheduler= 0; set global event_scheduler= 0;
select * from events_smode_test order by ev_name, a; select * from events_smode_test order by ev_name, a;
ev_name a ev_name a
...@@ -119,12 +116,12 @@ create procedure ee_16407_5_pendant() begin insert into events_test.events_smode ...@@ -119,12 +116,12 @@ create procedure ee_16407_5_pendant() begin insert into events_test.events_smode
create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end| create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
create event ee_16407_5 on schedule every 60 second do create event ee_16407_5 on schedule every 60 second do
begin begin
select get_lock('ee_16407_5', 60); select get_lock('ee_16407_5', 60) /*ee_16407_5*/;
call events_test.ee_16407_5_pendant(); call events_test.ee_16407_5_pendant();
end| end|
create event ee_16407_6 on schedule every 60 second do create event ee_16407_6 on schedule every 60 second do
begin begin
select get_lock('ee_16407_5', 60); select get_lock('ee_16407_5', 60) /*ee_16407_6*/;
call events_test.ee_16407_6_pendant(); call events_test.ee_16407_6_pendant();
end| end|
set sql_mode='ansi'; set sql_mode='ansi';
...@@ -132,19 +129,19 @@ select get_lock('ee_16407_5', 60); ...@@ -132,19 +129,19 @@ select get_lock('ee_16407_5', 60);
get_lock('ee_16407_5', 60) get_lock('ee_16407_5', 60)
1 1
set global event_scheduler= 1; set global event_scheduler= 1;
show processlist; "Should have 2 locked processes"
Id User Host db Command Time State Info select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
# root localhost events_test Query # NULL show processlist user host db command state info
# event_scheduler localhost NULL Connect # Sleeping NULL event_scheduler localhost NULL Connect Sleeping NULL
# root localhost events_test Connect # User lock select get_lock('ee_16407_5', 60) root localhost events_test Connect User lock select get_lock('ee_16407_5', 60) /*ee_16407_5*/
# root localhost events_test Connect # User lock select get_lock('ee_16407_5', 60) root localhost events_test Connect User lock select get_lock('ee_16407_5', 60) /*ee_16407_6*/
select release_lock('ee_16407_5'); select release_lock('ee_16407_5');
release_lock('ee_16407_5') release_lock('ee_16407_5')
1 1
show processlist; "Should have 0 processes locked"
Id User Host db Command Time State Info select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
# root localhost events_test Query # NULL show processlist user host db command state info
# event_scheduler localhost NULL Connect # Sleeping NULL event_scheduler localhost NULL Connect Sleeping NULL
select * from events_smode_test order by ev_name, a; select * from events_smode_test order by ev_name, a;
ev_name a ev_name a
ee_16407_6 2004-02-29 ee_16407_6 2004-02-29
......
...@@ -190,10 +190,10 @@ CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing"; ...@@ -190,10 +190,10 @@ CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
--replace_column 8 # 9 # --replace_column 8 # 9 #
SHOW EVENTS; SHOW EVENTS;
ALTER TABLE mysql.event ADD dummy INT FIRST; ALTER TABLE mysql.event ADD dummy INT FIRST;
--error 1525 --error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
SHOW EVENTS; SHOW EVENTS;
ALTER TABLE mysql.event DROP dummy, ADD dummy2 VARCHAR(64) FIRST; ALTER TABLE mysql.event DROP dummy, ADD dummy2 VARCHAR(64) FIRST;
--error 1525 --error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
SHOW EVENTS; SHOW EVENTS;
ALTER TABLE mysql.event DROP dummy2; ALTER TABLE mysql.event DROP dummy2;
--replace_column 8 # 9 # --replace_column 8 # 9 #
...@@ -206,7 +206,7 @@ ALTER TABLE mysql.event MODIFY db char(20) character set utf8 collate utf8_bin d ...@@ -206,7 +206,7 @@ ALTER TABLE mysql.event MODIFY db char(20) character set utf8 collate utf8_bin d
#wait a bit or we won't see the difference because of seconds resolution #wait a bit or we won't see the difference because of seconds resolution
--sleep 1 --sleep 1
SHOW CREATE TABLE mysql.event; SHOW CREATE TABLE mysql.event;
--error 1526 --error ER_CANNOT_LOAD_FROM_TABLE
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
--sleep 1 --sleep 1
ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin default ''; ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin default '';
...@@ -216,16 +216,16 @@ ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin d ...@@ -216,16 +216,16 @@ ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin d
SHOW EVENTS; SHOW EVENTS;
--sleep 1 --sleep 1
ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default ''; ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
--error 1526 --error ER_CANNOT_LOAD_FROM_TABLE
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
--sleep 1 --sleep 1
ALTER TABLE mysql.event MODIFY db varchar(64) character set utf8 collate utf8_bin default ''; ALTER TABLE mysql.event MODIFY db varchar(64) character set utf8 collate utf8_bin default '';
--error 1526 --error ER_CANNOT_LOAD_FROM_TABLE
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
--sleep 1 --sleep 1
ALTER TABLE mysql.event DROP comment, DROP starts; ALTER TABLE mysql.event DROP comment, DROP starts;
--sleep 1 --sleep 1
--error 1525 --error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
DROP TABLE mysql.event; DROP TABLE mysql.event;
CREATE TABLE mysql.event like event_like; CREATE TABLE mysql.event like event_like;
...@@ -317,9 +317,9 @@ drop event one_event; ...@@ -317,9 +317,9 @@ drop event one_event;
create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5; create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
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;
drop event e_26; drop event e_26;
--error 1503 --error 1504
create event e_26 on schedule at NULL disabled do set @a = 5; create event e_26 on schedule at NULL disabled do set @a = 5;
--error 1503 --error 1504
create event e_26 on schedule at 'definitely not a datetime' disabled do set @a = 5; create event e_26 on schedule at 'definitely not a datetime' disabled do set @a = 5;
set names utf8; set names utf8;
...@@ -341,9 +341,8 @@ create event закачка on schedule every 10 hour do select get_lock("test_l ...@@ -341,9 +341,8 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
--echo "Should return 1 row" --echo "Should return 1 row"
select definer, name, db from mysql.event; select definer, name, db from mysql.event;
--echo "Should be only 1 process" --echo "Should be 0 processes"
--replace_column 1 # 6 # select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
show processlist;
select release_lock("test_lock1"); select release_lock("test_lock1");
drop event закаÑка; drop event закаÑка;
--echo "Should have 0 events" --echo "Should have 0 events"
...@@ -359,9 +358,8 @@ select get_lock("test_lock2", 20); ...@@ -359,9 +358,8 @@ select get_lock("test_lock2", 20);
create event закаÑка on schedule every 10 hour do select get_lock("test_lock2", 20); create event закаÑка on schedule every 10 hour do select get_lock("test_lock2", 20);
--echo "Let some time pass to the event starts" --echo "Let some time pass to the event starts"
--sleep 2 --sleep 2
--echo "Should have only 3 processes: the scheduler, our conn and the locked event" --echo "Should have only 2 processes: the scheduler and the locked event"
--replace_column 1 # 6 # select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
show processlist;
--echo "Release the mutex, the event worker should finish." --echo "Release the mutex, the event worker should finish."
select release_lock("test_lock2"); select release_lock("test_lock2");
drop event закаÑка; drop event закаÑка;
...@@ -378,21 +376,18 @@ set global event_scheduler=1; ...@@ -378,21 +376,18 @@ set global event_scheduler=1;
select get_lock("test_lock2_1", 20); select get_lock("test_lock2_1", 20);
create event закаÑка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20); create event закаÑка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
--sleep 1 --sleep 1
--echo "Should see 2 processes, one locked on get_lock(" --echo "Should see 1 process, locked on get_lock("
#--replace_column 1 # 6 # #select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
#show processlist;
--echo "Shutting down the scheduler, it should wait for the running event" --echo "Shutting down the scheduler, it should wait for the running event"
set global event_scheduler=0; set global event_scheduler=0;
--sleep 1 --sleep 1
--echo "Should have only 3 processes: the scheduler, our conn and the locked event" --echo "Should have only 2 processes: the scheduler and the locked event"
--replace_column 1 # 6 # select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
show processlist;
--echo "Release the lock so the child process should finish. Hence the scheduler also" --echo "Release the lock so the child process should finish. Hence the scheduler also"
select release_lock("test_lock2_1"); select release_lock("test_lock2_1");
--sleep 1 --sleep 1
--echo "Should have only our process now:" --echo "Should see 0 processes now:"
--replace_column 1 # 6 # select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
show processlist;
drop event закаÑка21; drop event закаÑка21;
#### ####
...@@ -441,7 +436,7 @@ drop event e1; ...@@ -441,7 +436,7 @@ drop event e1;
##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; ##select /*7*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
##drop event закачка; ##drop event закачка;
##select release_lock("test_lock3"); ##select release_lock("test_lock3");
...@@ -451,15 +446,13 @@ drop event e1; ...@@ -451,15 +446,13 @@ drop event e1;
##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);
##--replace_column 1 # 6 # ##select /*8*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
##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);
##--replace_column 1 # 6 # ##select /*9*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
##show processlist;
##select count(*) from mysql.event; ##select count(*) from mysql.event;
drop database events_test; drop database events_test;
......
...@@ -41,8 +41,7 @@ end| ...@@ -41,8 +41,7 @@ end|
delimiter ;| delimiter ;|
--sleep 1 --sleep 1
--echo "Now if everything is fine the event has compiled and is locked --echo "Now if everything is fine the event has compiled and is locked
--replace_column 1 # 6 # select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
show processlist;
select release_lock('test_bug16407'); select release_lock('test_bug16407');
set global event_scheduler= 0; set global event_scheduler= 0;
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
...@@ -59,7 +58,7 @@ create table events_smode_test(ev_name char(10), a date) engine=myisam; ...@@ -59,7 +58,7 @@ create table events_smode_test(ev_name char(10), a date) engine=myisam;
delimiter |; delimiter |;
create event ee_16407_2 on schedule every 60 second do create event ee_16407_2 on schedule every 60 second do
begin begin
select get_lock('ee_16407_2', 60); select get_lock('ee_16407_2', 60) /*ee_16407_2*/;
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02'); insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end| end|
--error 1292 --error 1292
...@@ -67,7 +66,7 @@ insert into events_smode_test values ('test','1980-19-02')| ...@@ -67,7 +66,7 @@ insert into events_smode_test values ('test','1980-19-02')|
--echo "This is ok" --echo "This is ok"
create event ee_16407_3 on schedule every 60 second do create event ee_16407_3 on schedule every 60 second do
begin begin
select get_lock('ee_16407_2', 60); select get_lock('ee_16407_2', 60) /*ee_16407_3*/;
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19'); insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19');
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29'); insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29');
end| end|
...@@ -75,7 +74,7 @@ set sql_mode=""| ...@@ -75,7 +74,7 @@ set sql_mode=""|
--echo "This will insert rows but they will be truncated" --echo "This will insert rows but they will be truncated"
create event ee_16407_4 on schedule every 60 second do create event ee_16407_4 on schedule every 60 second do
begin begin
select get_lock('ee_16407_2', 60); select get_lock('ee_16407_2', 60) /*ee_16407_4*/;
insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956'); insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
end| end|
delimiter ;| delimiter ;|
...@@ -84,12 +83,10 @@ set sql_mode="ansi"; ...@@ -84,12 +83,10 @@ set sql_mode="ansi";
select get_lock('ee_16407_2', 60); select get_lock('ee_16407_2', 60);
set global event_scheduler= 1; set global event_scheduler= 1;
--sleep 1 --sleep 1
--replace_column 1 # 6 # select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
show processlist;
select release_lock('ee_16407_2'); select release_lock('ee_16407_2');
--sleep 3 --sleep 3
--replace_column 1 # 6 # select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
show processlist;
set global event_scheduler= 0; set global event_scheduler= 0;
select * from events_smode_test order by ev_name, a; select * from events_smode_test order by ev_name, a;
--echo "OK, last check before we drop them" --echo "OK, last check before we drop them"
...@@ -107,12 +104,12 @@ create procedure ee_16407_5_pendant() begin insert into events_test.events_smode ...@@ -107,12 +104,12 @@ create procedure ee_16407_5_pendant() begin insert into events_test.events_smode
create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end| create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
create event ee_16407_5 on schedule every 60 second do create event ee_16407_5 on schedule every 60 second do
begin begin
select get_lock('ee_16407_5', 60); select get_lock('ee_16407_5', 60) /*ee_16407_5*/;
call events_test.ee_16407_5_pendant(); call events_test.ee_16407_5_pendant();
end| end|
create event ee_16407_6 on schedule every 60 second do create event ee_16407_6 on schedule every 60 second do
begin begin
select get_lock('ee_16407_5', 60); select get_lock('ee_16407_5', 60) /*ee_16407_6*/;
call events_test.ee_16407_6_pendant(); call events_test.ee_16407_6_pendant();
end| end|
delimiter ;| delimiter ;|
...@@ -120,12 +117,12 @@ set sql_mode='ansi'; ...@@ -120,12 +117,12 @@ set sql_mode='ansi';
select get_lock('ee_16407_5', 60); select get_lock('ee_16407_5', 60);
set global event_scheduler= 1; set global event_scheduler= 1;
--sleep 1 --sleep 1
--replace_column 1 # 6 # --echo "Should have 2 locked processes"
show processlist; select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select release_lock('ee_16407_5'); select release_lock('ee_16407_5');
--sleep 3 --sleep 3
--replace_column 1 # 6 # --echo "Should have 0 processes locked"
show processlist; select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select * from events_smode_test order by ev_name, a; select * from events_smode_test order by ev_name, a;
--echo "And here we check one more time before we drop the events" --echo "And here we check one more time before we drop the events"
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
......
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