#At file:///opt/local/work/next-mr-kostja/ based on revid:kostja@stripped
2913 Konstantin Osipov 2009-10-13
Backport of the following revision from 6.0-codebase:
----------------------------------------------------------
revno: 2617.1.12
committer: kostja@bodhi.(none)
timestamp: Sun 2008-04-20 11:18:52 +0400
message:
A fix for Bug#32771 "events_bugs.test fails randomly".
In Event_scheduler::stop(), which may be called from destructor,
wait synchronously for the parallel Event_scheduler::stop() to
complete before returning. This fixes a race between
MySQL shutdown thread and the scheduler thread who could call
stop() in parallel.
@ sql/event_scheduler.cc
There was a race condition between the shutdown thread and
the scheduler thread: the shutdown thread could delete the scheduler
mutex before the sheduler has stopped.
modified:
sql/event_scheduler.cc
=== modified file 'sql/event_scheduler.cc'
--- a/sql/event_scheduler.cc 2009-09-10 09:18:29 +0000
+++ b/sql/event_scheduler.cc 2009-10-13 18:29:28 +0000
@@ -607,7 +607,12 @@ Event_scheduler::stop()
LOCK_DATA();
DBUG_PRINT("info", ("state before action %s", scheduler_states_names[state].str));
if (state != RUNNING)
+ {
+ /* Synchronously wait until the scheduler stops. */
+ while (state != INITIALIZED)
+ COND_STATE_WAIT(thd, NULL, "Waiting for the scheduler to stop");
goto end;
+ }
/* Guarantee we don't catch spurious signals */
do {
Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20091013182928-tqjhz98o1hpo8s3h.bundle
| Thread |
|---|
| • bzr commit into mysql-5.5.0-next-mr-runtime branch (kostja:2913)Bug#32771 | Konstantin Osipov | 13 Oct |