summaryrefslogtreecommitdiff
path: root/sql/event_queue.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-05-09 14:38:49 +0300
committerMichael Widenius <monty@askmonty.org>2011-05-09 14:38:49 +0300
commit4cb68c0e8940aca5c02363c27d09cab5a1b2fcd8 (patch)
treed75723d318d1867c5c8aa8380b84623ffcb67018 /sql/event_queue.cc
parenta50a5f64f87ddb5464610b773d8215982658be02 (diff)
downloadmariadb-git-4cb68c0e8940aca5c02363c27d09cab5a1b2fcd8.tar.gz
mysqltest: Write command to be executed to the log BEFORE executing the command.
Fixed race condition in event that could cause hang when stopping event scheduler with SET GLOBAL event_scheduler=OFF client/mysqltest.cc: Write command to be executed to the log BEFORE executing the command. This makes it easier to debug crashes as the log will contain the fatal command. mysql-test/r/mysqltest.result: Updated results (we now get more things logged) sql/event_queue.cc: Fixed race condition in event that could cause hang when stopping event scheduler with SET GLOBAL event_scheduler=OFF. The reason was that a kill signal could be sent between last check of thd->killed and before thd->enter_cond() in which case the signal would be missed and we would be stuck in Event_scheduler::stop() forever.
Diffstat (limited to 'sql/event_queue.cc')
-rw-r--r--sql/event_queue.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/sql/event_queue.cc b/sql/event_queue.cc
index d68dc8ef479..b9585dc9c51 100644
--- a/sql/event_queue.cc
+++ b/sql/event_queue.cc
@@ -734,12 +734,14 @@ Event_queue::cond_wait(THD *thd, struct timespec *abstime, const char* msg,
thd->enter_cond(&COND_queue_state, &LOCK_event_queue, msg);
- DBUG_PRINT("info", ("pthread_cond_%swait", abstime? "timed":""));
- if (!abstime)
- pthread_cond_wait(&COND_queue_state, &LOCK_event_queue);
- else
- pthread_cond_timedwait(&COND_queue_state, &LOCK_event_queue, abstime);
-
+ if (!thd->killed)
+ {
+ DBUG_PRINT("info", ("pthread_cond_%swait", abstime ? "timed" : ""));
+ if (!abstime)
+ pthread_cond_wait(&COND_queue_state, &LOCK_event_queue);
+ else
+ pthread_cond_timedwait(&COND_queue_state, &LOCK_event_queue, abstime);
+ }
mutex_last_locked_in_func= func;
mutex_last_locked_at_line= line;
mutex_queue_data_locked= TRUE;