summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <andrey@example.com>2006-09-14 13:49:26 +0200
committerunknown <andrey@example.com>2006-09-14 13:49:26 +0200
commit2d8bd8767527864e4b9b2328e3d9b8d4bf676e4a (patch)
treef729496059a760faba152328c5e1b32d41de64d5
parentb0220fb363e42a16a1d5d72d5357106a04262a19 (diff)
downloadmariadb-git-2d8bd8767527864e4b9b2328e3d9b8d4bf676e4a.tar.gz
Temporary fix for a deadlock. Needed so we can go with cloning
5.1.12. sql/event_queue.cc: Temporary workaround to drop the event outside of the scope where LOCK_queue is locked. If it's done inside the scope a possible deadlock can happen, and it happens quite often, escpecially on Windows.
-rw-r--r--sql/event_queue.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/sql/event_queue.cc b/sql/event_queue.cc
index a6eb84305a8..539d0ab2734 100644
--- a/sql/event_queue.cc
+++ b/sql/event_queue.cc
@@ -707,6 +707,9 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data)
bool ret= FALSE;
struct timespec top_time;
struct timespec *abstime;
+ Event_queue_element *top= NULL;
+ bool to_free= FALSE;
+ bool to_drop= FALSE;
*job_data= NULL;
DBUG_ENTER("Event_queue::get_top_for_execution_if_time");
@@ -715,7 +718,6 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data)
for (;;)
{
int res;
- Event_queue_element *top= NULL;
thd->end_time();
time_t now= thd->query_start();
@@ -788,9 +790,8 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data)
sql_print_information("SCHEDULER: Last execution of %s.%s. %s",
top->dbname.str, top->name.str,
top->dropped? "Dropping.":"");
- if (top->dropped)
- top->drop(thd);
- delete top;
+ to_free= TRUE;
+ to_drop= top->dropped;
queue_remove(&queue, 0);
}
else
@@ -801,7 +802,14 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data)
}
end:
UNLOCK_QUEUE_DATA();
-
+ if (to_drop)
+ {
+ DBUG_PRINT("info", ("Dropping from disk"));
+ top->drop(thd);
+ }
+ if (to_free)
+ delete top;
+
DBUG_PRINT("info", ("returning %d. et_new=0x%lx abstime.tv_sec=%d ",
ret, *job_data, abstime? abstime->tv_sec:0));