1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

WL#3337 (Event scheduler new architecture)

This patch introduces specialized Event data objects
Event_basic as parent.
Event_queue_element used for queue storage
Event_timed used for SHOW EVENTS/ I_S.EVENTS / SHOW CREATE EVENT
Event_job_data using during execution.
Methods were moved out of Event_timed to other classes.

This patch also introduces Events::LOCK_event_metadata.
This patch gives new implementation of Events::dump_internal_status().
Now both the Event_scheduler and Event_queue return information during
their ::dump_internal_status().

Shortened a bit the runtime for executing events test cases.
This commit is contained in:
andrey@lmy004.
2006-07-10 13:44:43 +02:00
parent 3b840adee7
commit e3d0524bbd
21 changed files with 2305 additions and 1702 deletions

View File

@ -17,13 +17,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
class sp_name;
class Event_timed;
class Event_basic;
class Event_db_repository;
class Event_job_data;
class Event_queue_element;
class THD;
typedef bool * (*event_timed_identifier_comparator)(Event_timed*, Event_timed*);
class Event_scheduler_ng;
class Event_queue
@ -46,14 +45,14 @@ public:
/* Methods for queue management follow */
int
create_event(THD *thd, Event_parse_data *et);
create_event(THD *thd, LEX_STRING dbname, LEX_STRING name);
int
update_event(THD *thd, Event_parse_data *et, LEX_STRING *new_schema,
LEX_STRING *new_name);
update_event(THD *thd, LEX_STRING dbname, LEX_STRING name,
LEX_STRING *new_schema, LEX_STRING *new_name);
bool
drop_event(THD *thd, sp_name *name);
void
drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name);
void
drop_schema_events(THD *thd, LEX_STRING schema);
@ -61,32 +60,20 @@ public:
uint
events_count();
uint
events_count_no_lock();
static bool
check_system_tables(THD *thd);
void
recalculate_queue(THD *thd);
void
empty_queue();
recalculate_activation_times(THD *thd);
Event_timed *
Event_job_data *
get_top_for_execution_if_time(THD *thd, time_t now, struct timespec *abstime);
Event_timed*
get_top();
void
remove_top();
void
top_changed();
bool
dump_internal_status(THD *thd);
protected:
Event_timed *
Event_queue_element *
find_event(LEX_STRING db, LEX_STRING name, bool remove_from_q);
int
@ -94,14 +81,16 @@ protected:
void
drop_matching_events(THD *thd, LEX_STRING pattern,
bool (*)(Event_timed *,LEX_STRING *));
bool (*)(LEX_STRING *, Event_basic *));
void
empty_queue();
/* LOCK_event_queue is the mutex which protects the access to the queue. */
pthread_mutex_t LOCK_event_queue;
Event_db_repository *db_repository;
uint mutex_last_locked_at_line;
uint mutex_last_unlocked_at_line;
const char* mutex_last_locked_in_func;
@ -123,10 +112,8 @@ protected:
Event_scheduler_ng *scheduler;
//public:
/* The sorted queue with the Event_timed objects */
/* The sorted queue with the Event_job_data objects */
QUEUE queue;
};
#endif /* _EVENT_QUEUE_H_ */