summaryrefslogtreecommitdiff
path: root/sql/event_queue.cc
diff options
context:
space:
mode:
authorunknown <kostja@bodhi.local>2007-04-03 14:34:37 +0400
committerunknown <kostja@bodhi.local>2007-04-03 14:34:37 +0400
commit7b1bfbb77a2c753a705b5b594ed4b75d7fb3c9e2 (patch)
tree6e120dc301ebc2a12e142e8b8dcb20f4a8fe3986 /sql/event_queue.cc
parent516b8b2137e27661960372c8bf5f757ffb2f2883 (diff)
parentc1020aa4c67d48e061065f60400127d04a0adb30 (diff)
downloadmariadb-git-7b1bfbb77a2c753a705b5b594ed4b75d7fb3c9e2.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into bodhi.local:/opt/local/work/mysql-5.1-runtime mysql-test/r/events_bugs.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/t/events.test: Auto merged sql/event_data_objects.cc: Auto merged sql/event_data_objects.h: Auto merged sql/event_db_repository.h: Auto merged sql/event_queue.cc: Auto merged sql/events.cc: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/item_func.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_servers.cc: Auto merged sql/sql_view.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.h: Auto merged sql/share/errmsg.txt: Auto merged mysql-test/r/events.result: Manual merge. sql/event_db_repository.cc: Manual merge. sql/sql_parse.cc: Manual merge.
Diffstat (limited to 'sql/event_queue.cc')
-rw-r--r--sql/event_queue.cc31
1 files changed, 11 insertions, 20 deletions
diff --git a/sql/event_queue.cc b/sql/event_queue.cc
index b9c7af1a1a2..f958102e269 100644
--- a/sql/event_queue.cc
+++ b/sql/event_queue.cc
@@ -32,16 +32,6 @@
#define LOCK_QUEUE_DATA() lock_data(SCHED_FUNC, __LINE__)
#define UNLOCK_QUEUE_DATA() unlock_data(SCHED_FUNC, __LINE__)
-struct event_queue_param
-{
- THD *thd;
- Event_queue *queue;
- pthread_mutex_t LOCK_loaded;
- pthread_cond_t COND_loaded;
- bool loading_finished;
-};
-
-
/*
Compares the execute_at members of two Event_queue_element instances.
Used as callback for the prioritized queue when shifting
@@ -62,7 +52,7 @@ struct event_queue_param
execute_at.second_part is not considered during comparison
*/
-static int
+static int
event_queue_element_compare_q(void *vptr, byte* a, byte *b)
{
my_time_t lhs = ((Event_queue_element *)a)->execute_at;
@@ -148,7 +138,7 @@ Event_queue::init_queue(THD *thd)
0 /*max_on_top*/, event_queue_element_compare_q,
NULL, EVENT_QUEUE_EXTENT))
{
- sql_print_error("SCHEDULER: Can't initialize the execution queue");
+ sql_print_error("Event Scheduler: Can't initialize the execution queue");
goto err;
}
@@ -183,7 +173,7 @@ Event_queue::deinit_queue()
}
-/*
+/**
Adds an event to the queue.
SYNOPSIS
@@ -210,7 +200,7 @@ Event_queue::create_event(THD *thd, Event_queue_element *new_element)
LOCK_QUEUE_DATA();
queue_insert_safe(&queue, (byte *) new_element);
dbug_dump_queue(thd->query_start());
- pthread_cond_broadcast(&COND_queue_state);
+ pthread_cond_broadcast(&COND_queue_state);
UNLOCK_QUEUE_DATA();
}
DBUG_VOID_RETURN;
@@ -258,7 +248,7 @@ Event_queue::update_event(THD *thd, LEX_STRING dbname, LEX_STRING name,
{
DBUG_PRINT("info", ("new event in the queue: 0x%lx", (long) new_element));
queue_insert_safe(&queue, (byte *) new_element);
- pthread_cond_broadcast(&COND_queue_state);
+ pthread_cond_broadcast(&COND_queue_state);
}
dbug_dump_queue(thd->query_start());
@@ -289,7 +279,7 @@ Event_queue::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name)
find_n_remove_event(dbname, name);
dbug_dump_queue(thd->query_start());
UNLOCK_QUEUE_DATA();
-
+
/*
We don't signal here because the scheduler will catch the change
next time it wakes up.
@@ -311,7 +301,7 @@ Event_queue::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name)
RETURN VALUE
>=0 Number of dropped events
-
+
NOTE
Expected is the caller to acquire lock on LOCK_event_queue
*/
@@ -343,7 +333,7 @@ Event_queue::drop_matching_events(THD *thd, LEX_STRING pattern,
i++;
}
/*
- We don't call pthread_cond_broadcast(&COND_queue_state);
+ We don't call pthread_cond_broadcast(&COND_queue_state);
If we remove the top event:
1. The queue is empty. The scheduler will wake up at some time and
realize that the queue is empty. If create_event() comes inbetween
@@ -465,7 +455,8 @@ Event_queue::empty_queue()
uint i;
DBUG_ENTER("Event_queue::empty_queue");
DBUG_PRINT("enter", ("Purging the queue. %u element(s)", queue.elements));
- sql_print_information("SCHEDULER: Purging queue. %u events", queue.elements);
+ sql_print_information("Event Scheduler: Purging the queue. %u events",
+ queue.elements);
/* empty the queue */
for (i= 0; i < queue.elements; ++i)
{
@@ -598,7 +589,7 @@ Event_queue::get_top_for_execution_if_time(THD *thd,
if (top->status == Event_queue_element::DISABLED)
{
DBUG_PRINT("info", ("removing from the queue"));
- sql_print_information("SCHEDULER: Last execution of %s.%s. %s",
+ sql_print_information("Event Scheduler: Last execution of %s.%s. %s",
top->dbname.str, top->name.str,
top->dropped? "Dropping.":"");
delete top;