diff options
author | unknown <andrey@lmy004.> | 2006-06-08 23:07:11 +0200 |
---|---|---|
committer | unknown <andrey@lmy004.> | 2006-06-08 23:07:11 +0200 |
commit | 99438424ac4654e6ecd357e04263aaabc6391022 (patch) | |
tree | 2e3f4a442820fb0bbe2874da5d578c0d8764ca06 /sql/event_scheduler.cc | |
parent | 27e10733054ca854b24668a2a2aab2f8d183ec40 (diff) | |
download | mariadb-git-99438424ac4654e6ecd357e04263aaabc6391022.tar.gz |
Reorganize, physically the events code
Unify method naming -> create/update/drop_event
Move class Event_timed to event_timed.h
class Events is in events.h (renamed from event.h)
The implementation is in events.cc (renamed from event.h)
BitKeeper/deleted/.del-event_executor.cc~f4a4645b973838ab:
Delete: sql/event_executor.cc
include/my_time.h:
add a boundary
libmysqld/CMakeLists.txt:
event.cc -> events.cc
libmysqld/Makefile.am:
event.cc -> event.cc
sql/CMakeLists.txt:
event.cc -> events.cc
sql/Makefile.am:
event.cc -> events.cc
event_priv.h -> events_priv.h
sql/event_scheduler.cc:
event.h -> events.h
add_event -> create_event
replace_event -> update_event()
event_timed_compare_q is only used in event_scheduler.cc , so moving it
from event.cc and making it static
sql/event_scheduler.h:
add_event -> create_event
replace_event -> update_event
sql/event_timed.cc:
moved extern interval_type_to_name to mysql_priv.h
sql/mysql_priv.h:
moved my_time_compare to time.cc
sql/mysqld.cc:
event.h -> events.h
sql/sql_db.cc:
event.h -> events.h
sql/sql_parse.cc:
event.h -> events.h
class Event_timed moved to event_timed.h
sql/sql_show.cc:
event.h -> events.h
class Event_timed moved to event_timed.h
sql/sql_yacc.yy:
event.h -> events.h
class Event_timed moved to event_timed.h
sql/events.cc:
add_event -> create_event
replace_event -> update_event
event_timed_compare_q moved to event_scheduler.cc
sql/events.h:
class Event_timed moved to event_timed.h
sql/events_priv.h:
my_time_compare moved to mysql_priv.h
event_timed_compare_q is static in event_scheduler.cc
sql/time.cc:
moved interval_type_to_name from event.cc to here.
BitKeeper/etc/ignore:
Added libmysqld/events.cc to the ignore list
Diffstat (limited to 'sql/event_scheduler.cc')
-rw-r--r-- | sql/event_scheduler.cc | 53 |
1 files changed, 42 insertions, 11 deletions
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index e360254fdd2..10e641dceed 100644 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -14,8 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "event_priv.h" -#include "event.h" +#include "mysql_priv.h" +#include "events_priv.h" +#include "events.h" +#include "event_timed.h" #include "event_scheduler.h" #include "sp_head.h" @@ -46,8 +48,8 @@ The scheduler only manages execution of the events. Their creation, alteration and deletion is delegated to other routines found in event.cc . These routines interact with the scheduler : - - CREATE EVENT -> Event_scheduler::add_event() - - ALTER EVENT -> Event_scheduler::replace_event() + - CREATE EVENT -> Event_scheduler::create_event() + - ALTER EVENT -> Event_scheduler::update_event() - DROP EVENT -> Event_scheduler::drop_event() There is one mutex in the single Event_scheduler object which controls @@ -299,6 +301,35 @@ public: /* + Compares the execute_at members of 2 Event_timed instances. + Used as callback for the prioritized queue when shifting + elements inside. + + SYNOPSIS + event_timed_compare_q() + + vptr - not used (set it to NULL) + a - first Event_timed object + b - second Event_timed object + + RETURN VALUE + -1 - a->execute_at < b->execute_at + 0 - a->execute_at == b->execute_at + 1 - a->execute_at > b->execute_at + + NOTES + execute_at.second_part is not considered during comparison +*/ + +static int +event_timed_compare_q(void *vptr, byte* a, byte *b) +{ + return my_time_compare(&((Event_timed *)a)->execute_at, + &((Event_timed *)b)->execute_at); +} + + +/* Prints the stack of infos, warnings, errors from thd to the console so it can be fetched by the logs-into-tables and checked later. @@ -740,10 +771,10 @@ Event_scheduler::destroy() /* - Adds an event to the scheduler queue + Creates an event in the scheduler queue SYNOPSIS - Event_scheduler::add_event() + Event_scheduler::create_event() et The event to add check_existence Whether to check if already loaded. @@ -753,11 +784,11 @@ Event_scheduler::destroy() */ enum Event_scheduler::enum_error_code -Event_scheduler::add_event(THD *thd, Event_timed *et, bool check_existence) +Event_scheduler::create_event(THD *thd, Event_timed *et, bool check_existence) { enum enum_error_code res; Event_timed *et_new; - DBUG_ENTER("Event_scheduler::add_event"); + DBUG_ENTER("Event_scheduler::create_event"); DBUG_PRINT("enter", ("thd=%p et=%p lock=%p",thd,et,&LOCK_scheduler_data)); LOCK_SCHEDULER_DATA(); @@ -859,7 +890,7 @@ Event_scheduler::drop_event(THD *thd, Event_timed *et) /* - Replaces an event in the scheduler queue + Updates an event from the scheduler queue SYNOPSIS Event_scheduler::replace_event() @@ -873,14 +904,14 @@ Event_scheduler::drop_event(THD *thd, Event_timed *et) */ enum Event_scheduler::enum_error_code -Event_scheduler::replace_event(THD *thd, Event_timed *et, LEX_STRING *new_schema, +Event_scheduler::update_event(THD *thd, Event_timed *et, LEX_STRING *new_schema, LEX_STRING *new_name) { enum enum_error_code res; Event_timed *et_old, *et_new= NULL; LEX_STRING old_schema, old_name; - DBUG_ENTER("Event_scheduler::replace_event"); + DBUG_ENTER("Event_scheduler::update_event"); DBUG_PRINT("enter", ("thd=%p et=%p et=[%s.%s] lock=%p", thd, et, et->dbname.str, et->name.str, &LOCK_scheduler_data)); |