Bug #30601 Event does not execute as scheduled
Submitted: 23 Aug 2007 16:34 Modified: 27 Aug 2007 4:32
Reporter: Scott Noyes Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:5.1.20 OS:Windows (w2k)
Assigned to: CPU Architecture:Any

[23 Aug 2007 16:34] Scott Noyes
Description:
A scheduled event does not execute, and the debug output shows next execution time of never. Have attempted restarting the server after event creation.

How to repeat:
USE test;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY);
DROP EVENT IF EXISTS e;
CREATE EVENT e ON SCHEDULE EVERY 5 SECOND DO INSERT INTO test.t1 VALUES (NULL);

-- Wait 5 seconds

SELECT * FROM t1; -- Empty set. Should be populated.

Run mysqladmin debug, and view error log.

Events status:
LLA = Last Locked At  LUA = Last Unlocked At
WOC = Waiting On Condition  DL = Data Locked

Event scheduler status:
State      : INITIALIZED
Thread id  : 0
LLA        : n/a:0
LUA        : n/a:0
WOC        : NO
Workers    : 0
Executed   : 0
Data locked: NO

Event queue status:
Element count   : 1
Data locked     : NO
Attempting lock : NO
LLA             : <unknown>:240
LUA             : <unknown>:252
WOC             : NO
Next activation : never

Suggested fix:
Fix event scheduler - the event shown should insert a new row into test.t1 every 5 seconds.
[24 Aug 2007 7:41] Sveta Smirnova
Thank you for the report.

Please provide output of show variables like 'event_scheduler';
[24 Aug 2007 12:17] MySQL Verification Team
Aha, it was off by default. Turned it on, and it runs as expected. Sorry, I should have checked that first.
[27 Aug 2007 4:32] Valeriy Kravchuk
So, this problem was not a result of bug in MySQL's code.