Description:
The event queue is not cleared of events even after events have been deleted.
This is fine for correctness, as the scheduler will simply move onto the next event if the current one has been deleted. However, until the timer runs out, the state of the event_scheduler thread will show 'waiting for next activation' even though there are no events to actually run.
This causes mtr tests that run show processlist to become flaky.
How to repeat:
eg. This combination of mtr tests running right after another will cause a failure:
./mtr --no-reorder main.ddl_i18n_utf8 main.sp-threads
(but this can happen to any tests that create scheduled events, then run processlist)
Suggested fix:
Easiest way to is to restart mysqld at the end of event tests, and have mtr_check.sql enforce this by checking show processlist (today it filters out event_scheduler).
An alternative is to make sure that all mtr tests run show processlist with special filtering for event_scheduler.