AndyGambles
AndyGambles

Reputation: 331

MySQL Scheduled Event Not Firing

I have so far been unsuccessful in getting any Scheduled Events to fire.

The following query is used to create a scheduled event to clear out the sessions table (this is verbatim). The query itself works.

CREATE EVENT cleanup_session_data
ON SCHEDULE EVERY 1 DAY
ON COMPLETION PRESERVE
DISABLE ON SLAVE
DO
DELETE FROM session_data WHERE created_at < DATE_SUB(NOW(), INTERVAL 1 DAY);

However the Scheduled event simply does not fire.

Upvotes: 3

Views: 1911

Answers (1)

AndyGambles
AndyGambles

Reputation: 331

Turns out the answer was to remove the

DISABLE ON SLAVE

Either it is my own misunderstanding or this does not work as expected. By not including the the EVENT status is "ENABLED" whereas with it included it is "SLAVESIDE_DISABLED"

The EVENTS now fire as expected. They are also not replicated to the SLAVE.

Upvotes: 1

Related Questions