Egeri Egeri - 2 months ago 7
MySQL Question

MySQL Event Scheduler does not work but everything is set

My MySQL events never want to execute.

I use the latest 5.6.10 release but the problem was also in the 5.5 versions.

I have 1 Master- Many Slaves configuration. I want to run the event on the Master.



  1. In my.ini i have already set
    event_scheduler=ON



2, Checking this:

show variables like '%event_scheduler%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| event_scheduler | ON |
+-----------------+-------+

show processlist\G

Id: 1
User: event_scheduler
Host: localhost
db: NULL
Command: Daemon
Time: 720
State: Waiting on empty queue
Info: NULL
...


3, Next i have a recurring event on the master server.

This never want to execute. I also tried to change the date to different time.

CREATE EVENT IF NOT EXISTS dbname.event_xyz
ON SCHEDULE EVERY 1 DAY STARTS '2013-02-05 00:15:00'
ON COMPLETION PRESERVE
DISABLE ON SLAVE
COMMENT 'Collect data from ...'
DO CALL dbname._procedurename;


I have no errors calling the "_procedurename" procedure directly.

4, The creator of the event and the procedure is the "root".

5, The output of the

show events\G

Db: dbname
Name: event_xyz
Definer: root@localhost
Time zone: SYSTEM
Type: RECURRING
Execute at: NULL
Interval value: 1
Interval field: DAY
Starts: 2013-02-05 00:15:00
Ends: NULL
Status: SLAVESIDE_DISABLED
Originator: 1
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: utf8_general_ci


6, Restarting the master server i get the following lines in the
masterservername.err:

...
Event Scheduler: Purging the queue. 0 events
...
Event Scheduler: Loaded 0 events
...


and the

show processlist\G


shows that the event_scheduler

State: Waiting on empty queue !


So, my question is why does not run the event on my master server?

Why the event scheduler does not know anything about the previously defined event?

Am I missing something?

Answer

Perhaps this is a bug.

The solution was to remove the

DISABLE ON SLAVE

parameter from the event declaration command.

After this, the event state changed to "ENABLED" status and fired by the Event Scheduler on the Master server.

On the slaves the State of this event replicated with "SLAVESIDE_DISABLED" status.

So, for what purpose exists the "DISABLE ON SLAVE" parameter in the CREATE EVENT syntax?

Comments