mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug#39848 events_bugs fails sporadically on pushbuild (missing rows in table event_log) Details: Reimplement the subtest for BUG 28924 - check if the number of rows within the table event_log changes but don't print rows because the number varies depending on load on testing box - shift DROP USER befor DROP EVENT = Subtest fits again to old bug - remove no more needed comments + variables Bug#39863 events_bugs fails sporadically on pushbuild (extra processes in I_S.PROCESSLIST) Details: Abort with appropriate message to the protocol if release_lock() does not has the intended effect. This cannot prevent problems caused by the probably buggy release_lock() but it reveals if we had a problem in this area. Bug#39978 main.events_bugs does not clean up Detail: Restore global.event_scheduler = ON at end of test Bug#39569 events_bugs fails sporadically on pushbuild (should have failed with errno 1539) Detail: Set $wait_timeout to 4 instead of 2 - Fix two instabilities (result sets pulled from processlist in subtest for bug 16407) which were found during tests with high parallel I/O load - Minor improvements of formatting Details: - Add comments - Remove tabs and trailing blanks - Add line breaks for better readability
This commit is contained in:
@ -59,7 +59,8 @@ begin
|
|||||||
select get_lock('test_bug16407', 60);
|
select get_lock('test_bug16407', 60);
|
||||||
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"
|
||||||
select /*1*/ user, host, db, info from information_schema.processlist where command!='Daemon' and (info is null or info not like '%processlist%') order by info;
|
select /*1*/ user, host, db, info from information_schema.processlist
|
||||||
|
where info = 'select get_lock(\'test_bug16407\', 60)';
|
||||||
user host db info
|
user host db info
|
||||||
root localhost events_test select get_lock('test_bug16407', 60)
|
root localhost events_test select get_lock('test_bug16407', 60)
|
||||||
select release_lock('test_bug16407');
|
select release_lock('test_bug16407');
|
||||||
@ -114,18 +115,18 @@ event_schema event_name sql_mode
|
|||||||
events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
|
events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
|
||||||
events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
|
events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
|
||||||
events_test ee_16407_4
|
events_test ee_16407_4
|
||||||
select /*2*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
|
select /*2*/ user, host, db, info from information_schema.processlist
|
||||||
|
where info = 'select get_lock(\'ee_16407_2\', 60)';
|
||||||
user host db info
|
user host db info
|
||||||
event_scheduler localhost NULL NULL
|
|
||||||
root localhost events_test select get_lock('ee_16407_2', 60)
|
root localhost events_test select get_lock('ee_16407_2', 60)
|
||||||
root localhost events_test select get_lock('ee_16407_2', 60)
|
root localhost events_test select get_lock('ee_16407_2', 60)
|
||||||
root localhost events_test select get_lock('ee_16407_2', 60)
|
root localhost events_test 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
|
||||||
select /*3*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
|
select /*3*/ user, host, db, info from information_schema.processlist
|
||||||
|
where info = 'select get_lock(\'ee_16407_2\', 60)';
|
||||||
user host db info
|
user host db info
|
||||||
event_scheduler localhost NULL NULL
|
|
||||||
set global event_scheduler= off;
|
set global event_scheduler= off;
|
||||||
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
|
||||||
@ -164,7 +165,9 @@ select release_lock('ee_16407_5');
|
|||||||
call events_test.ee_16407_6_pendant();
|
call events_test.ee_16407_6_pendant();
|
||||||
end|
|
end|
|
||||||
"Should have 2 locked processes"
|
"Should have 2 locked processes"
|
||||||
select /*4*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
|
select /*4*/ user, host, db, info from information_schema.processlist
|
||||||
|
where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%')
|
||||||
|
order by info;
|
||||||
user host db info
|
user host db info
|
||||||
event_scheduler localhost NULL NULL
|
event_scheduler localhost NULL NULL
|
||||||
root localhost events_test select get_lock('ee_16407_5', 60)
|
root localhost events_test select get_lock('ee_16407_5', 60)
|
||||||
@ -173,7 +176,9 @@ select release_lock('ee_16407_5');
|
|||||||
release_lock('ee_16407_5')
|
release_lock('ee_16407_5')
|
||||||
1
|
1
|
||||||
"Should have 0 processes locked"
|
"Should have 0 processes locked"
|
||||||
select /*5*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
|
select /*5*/ user, host, db, info from information_schema.processlist
|
||||||
|
where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%')
|
||||||
|
order by info;
|
||||||
user host db info
|
user host db info
|
||||||
event_scheduler localhost NULL NULL
|
event_scheduler localhost NULL NULL
|
||||||
select * from events_smode_test order by ev_name, a;
|
select * from events_smode_test order by ev_name, a;
|
||||||
@ -566,10 +571,9 @@ SHOW GRANTS FOR CURRENT_USER;
|
|||||||
Grants for root@localhost
|
Grants for root@localhost
|
||||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||||
SET GLOBAL event_scheduler = ON;
|
SET GLOBAL event_scheduler = ON;
|
||||||
CREATE TABLE event_log (id int KEY AUTO_INCREMENT,
|
CREATE TABLE events_test.event_log
|
||||||
ev_nm char(40), ev_cnt int,
|
(id int KEY AUTO_INCREMENT, ev_nm char(40), ev_cnt int, ev_tm timestamp)
|
||||||
ev_tm timestamp) ENGINE=MyISAM;
|
ENGINE=MyISAM;
|
||||||
SET @ev_base_date = 20281224180000;
|
|
||||||
SET autocommit=0;
|
SET autocommit=0;
|
||||||
CREATE USER evtest1@localhost;
|
CREATE USER evtest1@localhost;
|
||||||
SET PASSWORD FOR evtest1@localhost = password('ev1');
|
SET PASSWORD FOR evtest1@localhost = password('ev1');
|
||||||
@ -582,41 +586,40 @@ GRANT USAGE ON *.* TO 'evtest1'@'localhost' IDENTIFIED BY PASSWORD '*3170F3644E3
|
|||||||
GRANT SELECT, INSERT ON `test`.* TO 'evtest1'@'localhost'
|
GRANT SELECT, INSERT ON `test`.* TO 'evtest1'@'localhost'
|
||||||
GRANT SELECT, INSERT, CREATE, EVENT ON `events_test`.* TO 'evtest1'@'localhost'
|
GRANT SELECT, INSERT, CREATE, EVENT ON `events_test`.* TO 'evtest1'@'localhost'
|
||||||
connection e1;
|
connection e1;
|
||||||
USE events_test;
|
|
||||||
CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND
|
CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND
|
||||||
DO BEGIN
|
DO BEGIN
|
||||||
SET AUTOCOMMIT = 0;
|
SET AUTOCOMMIT = 0;
|
||||||
SET @evname = 'ev_sched_1823';
|
SET @evname = 'ev_sched_1823';
|
||||||
SET @cnt = 0;
|
SET @cnt = 0;
|
||||||
SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname;
|
SELECT COUNT(*) INTO @cnt FROM events_test.event_log WHERE ev_nm = @evname;
|
||||||
IF @cnt < 6 THEN
|
IF @cnt < 6 THEN
|
||||||
INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
|
INSERT INTO events_test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
|
||||||
COMMIT;
|
COMMIT;
|
||||||
END IF;
|
END IF;
|
||||||
SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname;
|
SELECT COUNT(*) INTO @cnt FROM events_test.event_log WHERE ev_nm = @evname;
|
||||||
IF @cnt < 6 THEN
|
IF @cnt < 6 THEN
|
||||||
INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
|
INSERT INTO events_test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
END IF;
|
END IF;
|
||||||
END;|
|
END;|
|
||||||
|
Sleep till the first INSERT into events_test.event_log occured
|
||||||
|
SELECT COUNT(*) > 0 AS "Expect 1" FROM events_test.event_log;
|
||||||
|
Expect 1
|
||||||
|
1
|
||||||
connection default;
|
connection default;
|
||||||
DROP EVENT ev_sched_1823;
|
|
||||||
DROP USER evtest1@localhost;
|
DROP USER evtest1@localhost;
|
||||||
USE test;
|
Sleep 4 seconds
|
||||||
=====================================================================================
|
SELECT COUNT(*) INTO @row_cnt FROM events_test.event_log;
|
||||||
select id,ev_nm,ev_cnt from event_log order by id;
|
Sleep 4 seconds
|
||||||
id ev_nm ev_cnt
|
SELECT COUNT(*) > @row_cnt AS "Expect 0" FROM events_test.event_log;
|
||||||
1 ev_sched_1823 1
|
Expect 0
|
||||||
2 ev_sched_1823 2
|
0
|
||||||
3 ev_sched_1823 3
|
DROP EVENT events_test.ev_sched_1823;
|
||||||
4 ev_sched_1823 4
|
DROP TABLE events_test.event_log;
|
||||||
5 ev_sched_1823 5
|
|
||||||
6 ev_sched_1823 6
|
|
||||||
DROP TABLE event_log;
|
|
||||||
SET GLOBAL event_scheduler = OFF;
|
SET GLOBAL event_scheduler = OFF;
|
||||||
SET GLOBAL event_scheduler= ON;
|
SET GLOBAL event_scheduler= ON;
|
||||||
CREATE EVENT bug28641 ON SCHEDULE AT '2038.01.18 03:00:00'
|
CREATE EVENT bug28641 ON SCHEDULE AT '2038.01.18 03:00:00'
|
||||||
DO BEGIN
|
DO BEGIN
|
||||||
SELECT 1;
|
SELECT 1;
|
||||||
END;|
|
END;|
|
||||||
SET GLOBAL event_scheduler= OFF;
|
SET GLOBAL event_scheduler= OFF;
|
||||||
@ -736,3 +739,4 @@ select name from mysql.event where name = 'p' and sql_mode = @full_mode;
|
|||||||
name
|
name
|
||||||
drop event e1;
|
drop event e1;
|
||||||
DROP DATABASE events_test;
|
DROP DATABASE events_test;
|
||||||
|
SET GLOBAL event_scheduler = 'ON';
|
||||||
|
@ -13,4 +13,3 @@ federated_transactions : Bug#29523 Transactions do not work
|
|||||||
csv_alter_table : Bug#33696 2008-01-21 pcrews no .result file - bug allows NULL columns in CSV tables
|
csv_alter_table : Bug#33696 2008-01-21 pcrews no .result file - bug allows NULL columns in CSV tables
|
||||||
log_tables.test : Bug #37798: main.log_tables fails randomly on powermacg5 and windows
|
log_tables.test : Bug #37798: main.log_tables fails randomly on powermacg5 and windows
|
||||||
slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions
|
slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions
|
||||||
events-bugs.test : Bug #39848, Bug #39863, Bug #39569, Bug #37774
|
|
||||||
|
@ -1,3 +1,42 @@
|
|||||||
|
#### t/events_bugs.test
|
||||||
|
#
|
||||||
|
# Last change:
|
||||||
|
# 2008-10-16 mleich
|
||||||
|
# - Fix for
|
||||||
|
# Bug#39848 events_bugs fails sporadically on pushbuild
|
||||||
|
# (missing rows in table event_log)
|
||||||
|
# Bug#39863 events_bugs fails sporadically on pushbuild (extra processes
|
||||||
|
# in I_S.PROCESSLIST)
|
||||||
|
# Bug#39978 main.events_bugs does not clean up
|
||||||
|
# Bug#39569 events_bugs fails sporadically on pushbuild (should have
|
||||||
|
# failed with errno 1539)
|
||||||
|
# - Minor improvements of formatting
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Outcome of some experiments (mleich):
|
||||||
|
# 1. SET GLOBAL event_scheduler = 'ON';
|
||||||
|
# Immediate observation of the processlist.
|
||||||
|
# Effects:
|
||||||
|
# 1. There is no guarantee to find immediate the user 'event_scheduler'
|
||||||
|
# within information_schema.processlist.
|
||||||
|
# 2. Some states of the user 'event_scheduler' found in PROCESSLIST:
|
||||||
|
# USER HOST DB COMMAND TIME STATE INFO
|
||||||
|
# event_scheduler localhost NULL Daemon 0 Waiting on empty queue NULL
|
||||||
|
# event_scheduler localhost NULL Daemon 0 Initialized NULL
|
||||||
|
# 2. SET GLOBAL event_scheduler = 'OFF';
|
||||||
|
# Immediate observation of the processlist.
|
||||||
|
# Effects:
|
||||||
|
# 1. I never found the user 'event_scheduler' within the processlist.
|
||||||
|
# 2. Events just during execution could be found within the processlist
|
||||||
|
# = It does not look like "SET GLOBAL event_scheduler = 'OFF'" stops them.
|
||||||
|
# 3. An event gets executed
|
||||||
|
# USER evtest1 (Definer of event)
|
||||||
|
# DB events_test (DB during time of event creation)
|
||||||
|
# COMMAND Connect
|
||||||
|
# STATE NULL
|
||||||
|
# INFO SET @evname = 'ev_sched_1823' (Part of the event code)
|
||||||
|
#
|
||||||
|
|
||||||
# Can't test with embedded server that doesn't support grants
|
# Can't test with embedded server that doesn't support grants
|
||||||
-- source include/not_embedded.inc
|
-- source include/not_embedded.inc
|
||||||
|
|
||||||
@ -105,14 +144,39 @@ begin
|
|||||||
end|
|
end|
|
||||||
delimiter ;|
|
delimiter ;|
|
||||||
|
|
||||||
|
# The default session has the user lock.
|
||||||
|
# We wait till one event runs and hangs when trying to get the user lock.
|
||||||
let $wait_condition=
|
let $wait_condition=
|
||||||
select count(*) = 1 from information_schema.processlist
|
select count(*) > 0 from information_schema.processlist
|
||||||
where info = 'select get_lock(\'test_bug16407\', 60)';
|
where info = 'select get_lock(\'test_bug16407\', 60)';
|
||||||
--source include/wait_condition.inc
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
--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"
|
||||||
select /*1*/ user, host, db, info from information_schema.processlist where command!='Daemon' and (info is null or info not like '%processlist%') order by info;
|
# Expect to see one session in events_test waiting for the user lock.
|
||||||
|
select /*1*/ user, host, db, info from information_schema.processlist
|
||||||
|
where info = 'select get_lock(\'test_bug16407\', 60)';
|
||||||
select release_lock('test_bug16407');
|
select release_lock('test_bug16407');
|
||||||
|
# Try to avoid
|
||||||
|
# Bug#39863 events_bugs fails sporadically on pushbuild (extra processes in I_S.PROCESSLIST)
|
||||||
|
# which is most probably caused by
|
||||||
|
# Bug#32782 User lock hash fails to find lock
|
||||||
|
# "various issues related to missing or incorrect return results
|
||||||
|
# from release_lock()."
|
||||||
|
# Therefore we check here if the event executing session disappeared or
|
||||||
|
# we waited >= 5 seconds for this to happen.
|
||||||
|
let $wait_timeout= 5;
|
||||||
|
let $wait_condition=
|
||||||
|
select count(*) = 0 from information_schema.processlist
|
||||||
|
where info = 'select get_lock(\'test_bug16407\', 60)';
|
||||||
|
--source include/wait_condition.inc
|
||||||
|
if (!`$wait_condition`)
|
||||||
|
{
|
||||||
|
--echo ERROR: There must be no session with info = 'select get_lock('test_bug16407', 60) within the processlist.
|
||||||
|
--echo We probably hit Bug#32782 User lock hash fails to find lock
|
||||||
|
eval select * from information_schema.processlist;
|
||||||
|
--echo Abort
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
set global event_scheduler= off;
|
set global event_scheduler= off;
|
||||||
|
|
||||||
@ -164,17 +228,27 @@ let $wait_condition=
|
|||||||
where info = 'select get_lock(\'ee_16407_2\', 60)';
|
where info = 'select get_lock(\'ee_16407_2\', 60)';
|
||||||
--source include/wait_condition.inc
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
select /*2*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
|
select /*2*/ user, host, db, info from information_schema.processlist
|
||||||
|
where info = 'select get_lock(\'ee_16407_2\', 60)';
|
||||||
select release_lock('ee_16407_2');
|
select release_lock('ee_16407_2');
|
||||||
|
|
||||||
|
# Try to avoid
|
||||||
|
# Bug#39863 events_bugs fails sporadically on pushbuild (extra processes in I_S.PROCESSLIST)
|
||||||
|
# which is most probably caused by
|
||||||
|
# Bug#32782 User lock hash fails to find lock
|
||||||
|
# "various issues related to missing or incorrect return results
|
||||||
|
# from release_lock()."
|
||||||
|
# Therefore we check here if the event executing sessions disappeared or
|
||||||
|
# we waited >= 5 seconds for this to happen.
|
||||||
|
let $wait_timeout= 5;
|
||||||
let $wait_condition=
|
let $wait_condition=
|
||||||
select count(*) = 1 and user = 'event_scheduler' and info is null
|
select count(*) = 0
|
||||||
from information_schema.processlist
|
from information_schema.processlist
|
||||||
where (command!='Daemon' || user='event_scheduler')
|
where info = 'select get_lock(\'ee_16407_2\', 60)';
|
||||||
and (info is null or info not like '%processlist%');
|
|
||||||
--source include/wait_condition.inc
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
select /*3*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
|
select /*3*/ user, host, db, info from information_schema.processlist
|
||||||
|
where info = 'select get_lock(\'ee_16407_2\', 60)';
|
||||||
set global event_scheduler= off;
|
set global event_scheduler= off;
|
||||||
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"
|
||||||
@ -216,7 +290,9 @@ let $wait_condition=
|
|||||||
--source include/wait_condition.inc
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
--echo "Should have 2 locked processes"
|
--echo "Should have 2 locked processes"
|
||||||
select /*4*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
|
select /*4*/ user, host, db, info from information_schema.processlist
|
||||||
|
where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%')
|
||||||
|
order by info;
|
||||||
select release_lock('ee_16407_5');
|
select release_lock('ee_16407_5');
|
||||||
|
|
||||||
let $wait_condition=
|
let $wait_condition=
|
||||||
@ -227,7 +303,9 @@ let $wait_condition=
|
|||||||
--source include/wait_condition.inc
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
--echo "Should have 0 processes locked"
|
--echo "Should have 0 processes locked"
|
||||||
select /*5*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
|
select /*5*/ user, host, db, info from information_schema.processlist
|
||||||
|
where (command!='Daemon' || user='event_scheduler') and (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;
|
||||||
@ -239,7 +317,7 @@ set global event_scheduler= off;
|
|||||||
drop table events_smode_test;
|
drop table events_smode_test;
|
||||||
set sql_mode=@old_sql_mode;
|
set sql_mode=@old_sql_mode;
|
||||||
#
|
#
|
||||||
# End - 16407: Events: Changes in sql_mode won't be taken into account
|
# End - 16407: Events: Changes in sql_mode won't be taken into account
|
||||||
#
|
#
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -401,39 +479,39 @@ CREATE USER mysqltest_u1@localhost;
|
|||||||
GRANT EVENT ON events_test.* TO mysqltest_u1@localhost;
|
GRANT EVENT ON events_test.* TO mysqltest_u1@localhost;
|
||||||
|
|
||||||
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
||||||
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
||||||
DROP EVENT e1;
|
DROP EVENT e1;
|
||||||
|
|
||||||
CREATE DEFINER=CURRENT_USER EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
CREATE DEFINER=CURRENT_USER EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
||||||
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
||||||
ALTER DEFINER=mysqltest_u1@localhost EVENT e1 ON SCHEDULE EVERY 1 HOUR;
|
ALTER DEFINER=mysqltest_u1@localhost EVENT e1 ON SCHEDULE EVERY 1 HOUR;
|
||||||
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
||||||
DROP EVENT e1;
|
DROP EVENT e1;
|
||||||
|
|
||||||
CREATE DEFINER=CURRENT_USER() EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
CREATE DEFINER=CURRENT_USER() EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
||||||
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
||||||
DROP EVENT e1;
|
DROP EVENT e1;
|
||||||
|
|
||||||
CREATE DEFINER=mysqltest_u1@localhost EVENT e1 ON SCHEDULE EVERY 1 DAY DO
|
CREATE DEFINER=mysqltest_u1@localhost EVENT e1 ON SCHEDULE EVERY 1 DAY DO
|
||||||
SELECT 1;
|
SELECT 1;
|
||||||
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
||||||
DROP EVENT e1;
|
DROP EVENT e1;
|
||||||
|
|
||||||
connect (conn1, localhost, mysqltest_u1, , events_test);
|
connect (conn1, localhost, mysqltest_u1, , events_test);
|
||||||
|
|
||||||
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
||||||
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
||||||
DROP EVENT e1;
|
DROP EVENT e1;
|
||||||
|
|
||||||
CREATE DEFINER=CURRENT_USER EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
CREATE DEFINER=CURRENT_USER EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
||||||
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
||||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||||
ALTER DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 HOUR;
|
ALTER DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 HOUR;
|
||||||
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
||||||
DROP EVENT e1;
|
DROP EVENT e1;
|
||||||
|
|
||||||
CREATE DEFINER=CURRENT_USER() EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
CREATE DEFINER=CURRENT_USER() EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
||||||
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
|
||||||
DROP EVENT e1;
|
DROP EVENT e1;
|
||||||
|
|
||||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||||
@ -664,21 +742,18 @@ CREATE EVENT new_event ON SCHEDULE AT NOW() ENDS NOW() DO SELECT 1;
|
|||||||
CREATE EVENT new_event ON SCHEDULE AT NOW() STARTS NOW() ENDS NOW() DO SELECT 1;
|
CREATE EVENT new_event ON SCHEDULE AT NOW() STARTS NOW() ENDS NOW() DO SELECT 1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# START - BUG#28924 If I drop the user who is the definer of an active event then server cores
|
# START - BUG#28924 If I drop the user who is the definer of an active event
|
||||||
|
# then server cores
|
||||||
#
|
#
|
||||||
let $engine=MyISAM;
|
let $engine=MyISAM;
|
||||||
USE test;
|
USE test;
|
||||||
SHOW GRANTS FOR CURRENT_USER;
|
SHOW GRANTS FOR CURRENT_USER;
|
||||||
SET GLOBAL event_scheduler = ON;
|
SET GLOBAL event_scheduler = ON;
|
||||||
eval CREATE TABLE event_log (id int KEY AUTO_INCREMENT,
|
eval
|
||||||
ev_nm char(40), ev_cnt int,
|
CREATE TABLE events_test.event_log
|
||||||
ev_tm timestamp) ENGINE=$engine;
|
(id int KEY AUTO_INCREMENT, ev_nm char(40), ev_cnt int, ev_tm timestamp)
|
||||||
SET @ev_base_date = 20281224180000;
|
ENGINE=$engine;
|
||||||
--disable_warnings
|
|
||||||
SET autocommit=0;
|
SET autocommit=0;
|
||||||
#DROP DATABASE IF EXISTS ev_db_1;
|
|
||||||
#CREATE DATABASE ev_db_1;
|
|
||||||
--enable_warnings
|
|
||||||
CREATE USER evtest1@localhost;
|
CREATE USER evtest1@localhost;
|
||||||
SET PASSWORD FOR evtest1@localhost = password('ev1');
|
SET PASSWORD FOR evtest1@localhost = password('ev1');
|
||||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM evtest1@localhost;
|
REVOKE ALL PRIVILEGES, GRANT OPTION FROM evtest1@localhost;
|
||||||
@ -689,53 +764,70 @@ SHOW GRANTS FOR evtest1@localhost;
|
|||||||
--echo connection e1;
|
--echo connection e1;
|
||||||
--replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
|
--replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
|
||||||
connect (e1,localhost,evtest1,ev1,events_test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
connect (e1,localhost,evtest1,ev1,events_test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||||
USE events_test;
|
|
||||||
|
|
||||||
DELIMITER |;
|
DELIMITER |;
|
||||||
CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND
|
CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND
|
||||||
DO BEGIN
|
DO BEGIN
|
||||||
SET AUTOCOMMIT = 0;
|
SET AUTOCOMMIT = 0;
|
||||||
SET @evname = 'ev_sched_1823';
|
SET @evname = 'ev_sched_1823';
|
||||||
SET @cnt = 0;
|
SET @cnt = 0;
|
||||||
SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname;
|
SELECT COUNT(*) INTO @cnt FROM events_test.event_log WHERE ev_nm = @evname;
|
||||||
IF @cnt < 6 THEN
|
IF @cnt < 6 THEN
|
||||||
INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
|
INSERT INTO events_test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
|
||||||
COMMIT;
|
COMMIT;
|
||||||
END IF;
|
END IF;
|
||||||
SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname;
|
SELECT COUNT(*) INTO @cnt FROM events_test.event_log WHERE ev_nm = @evname;
|
||||||
IF @cnt < 6 THEN
|
IF @cnt < 6 THEN
|
||||||
INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
|
INSERT INTO events_test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
END IF;
|
END IF;
|
||||||
END;|
|
END;|
|
||||||
DELIMITER ;|
|
DELIMITER ;|
|
||||||
|
# 1. Show that the new created event is runnable and gets executed within a
|
||||||
--sleep 6
|
# reasonable time like 4 seconds. Till ~ 2 seconds could pass on a heavy
|
||||||
|
# loaded testing box before something gets executed).
|
||||||
|
# Detection of execution is via the records inserted by the event.
|
||||||
|
--echo Sleep till the first INSERT into events_test.event_log occured
|
||||||
|
let $wait_timeout= 4;
|
||||||
|
let $wait_condition=
|
||||||
|
SELECT COUNT(*) > 0 FROM events_test.event_log;
|
||||||
|
--source include/wait_condition.inc
|
||||||
|
SELECT COUNT(*) > 0 AS "Expect 1" FROM events_test.event_log;
|
||||||
|
#
|
||||||
--echo connection default;
|
--echo connection default;
|
||||||
DROP EVENT ev_sched_1823;
|
|
||||||
connection default;
|
connection default;
|
||||||
DROP USER evtest1@localhost;
|
DROP USER evtest1@localhost;
|
||||||
|
# 2. If we meet BUG#28924 again than a server crash happens within the next
|
||||||
--sleep 6
|
# few seconds
|
||||||
USE test;
|
# 3. Check that the event is never executed again
|
||||||
--echo =====================================================================================
|
# It could be that an event execution was running before the DROP USER
|
||||||
--sleep 5
|
# and all implicite actions belonging to this are completed.
|
||||||
#--disable_result_log
|
# Lets assume that ~ 4 seconds waiting are enough for the event
|
||||||
select id,ev_nm,ev_cnt from event_log order by id;
|
# scheduler to detect that
|
||||||
#--enable_result_log
|
--echo Sleep 4 seconds
|
||||||
DROP TABLE event_log;
|
sleep 4;
|
||||||
#DROP DATABASE ev_db_1;
|
SELECT COUNT(*) INTO @row_cnt FROM events_test.event_log;
|
||||||
|
# Give the event mechanism ~ 4 seconds to do something wrong
|
||||||
|
# (execute the event of the dropped user -> inser rows).
|
||||||
|
--echo Sleep 4 seconds
|
||||||
|
sleep 4;
|
||||||
|
SELECT COUNT(*) > @row_cnt AS "Expect 0" FROM events_test.event_log;
|
||||||
|
#
|
||||||
|
# Cleanup
|
||||||
|
disconnect e1;
|
||||||
|
DROP EVENT events_test.ev_sched_1823;
|
||||||
|
DROP TABLE events_test.event_log;
|
||||||
SET GLOBAL event_scheduler = OFF;
|
SET GLOBAL event_scheduler = OFF;
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#28641 CREATE EVENT with '2038.01.18 03:00:00' let server crash.
|
# Bug#28641 CREATE EVENT with '2038.01.18 03:00:00' let server crash.
|
||||||
#
|
#
|
||||||
SET GLOBAL event_scheduler= ON;
|
SET GLOBAL event_scheduler= ON;
|
||||||
DELIMITER |;
|
DELIMITER |;
|
||||||
CREATE EVENT bug28641 ON SCHEDULE AT '2038.01.18 03:00:00'
|
CREATE EVENT bug28641 ON SCHEDULE AT '2038.01.18 03:00:00'
|
||||||
DO BEGIN
|
DO BEGIN
|
||||||
SELECT 1;
|
SELECT 1;
|
||||||
END;|
|
END;|
|
||||||
|
|
||||||
DELIMITER ;|
|
DELIMITER ;|
|
||||||
SET GLOBAL event_scheduler= OFF;
|
SET GLOBAL event_scheduler= OFF;
|
||||||
@ -868,7 +960,7 @@ SET GLOBAL EVENT_SCHEDULER = ON;
|
|||||||
|
|
||||||
--echo # Waiting for the event scheduler to execute and drop event e1...
|
--echo # Waiting for the event scheduler to execute and drop event e1...
|
||||||
|
|
||||||
let $wait_timeout = 2;
|
let $wait_timeout = 4;
|
||||||
let $wait_condition =
|
let $wait_condition =
|
||||||
SELECT COUNT(*) = 0
|
SELECT COUNT(*) = 0
|
||||||
FROM INFORMATION_SCHEMA.EVENTS
|
FROM INFORMATION_SCHEMA.EVENTS
|
||||||
@ -957,7 +1049,7 @@ select name from mysql.event where name = 'p' and sql_mode = @full_mode;
|
|||||||
drop event e1;
|
drop event e1;
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
#
|
#
|
||||||
# End of tests
|
# End of tests
|
||||||
#
|
#
|
||||||
# !!! KEEP this section AT THE END of this file !!!
|
# !!! KEEP this section AT THE END of this file !!!
|
||||||
@ -970,5 +1062,8 @@ let $wait_condition=
|
|||||||
--source include/wait_condition.inc
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
DROP DATABASE events_test;
|
DROP DATABASE events_test;
|
||||||
|
# Restore the original state (option with no argument in events_bugs-master.opt
|
||||||
|
# turns the scheduler on).
|
||||||
|
SET GLOBAL event_scheduler = 'ON';
|
||||||
|
|
||||||
# THIS MUST BE THE LAST LINE in this file.
|
# THIS MUST BE THE LAST LINE in this file.
|
||||||
|
Reference in New Issue
Block a user