mirror of
https://github.com/MariaDB/server.git
synced 2026-05-02 21:25:36 +02:00
WL #3337 (Events new architecture)
Final stroke, events should be loaded from disk on server startup. Also check the validity of their bodies if possible during loading. sql/event_data_objects.cc: Remove Event_job_data::free_sp(), move the code to the destructor Change the way we change the security context Steal some code from sql_parse.cc sql/event_data_objects.h: Remove free_sp() Make compile() public, to be used when booting for verifying the integrity of mysql.event sql/event_queue.cc: Make the queue load events from disk on server boot. Compile and thus check for integrity the events. sql/event_queue.h: shift methods around. add queue_loaded boolean. sql/event_scheduler.cc: Rename init_event_thread() to pre_init_event_thread() and make it more generic. Add post_init_event_thread() Export these two as well as deinit_event_thread(). Now it is quite easy to write code to spawn a new event thread whenever needed. sql/event_scheduler.h: export pre_init_event_thread(), post_init_event_thread() and deinit_event_thread() to simplify writing of thread functions. sql/events.cc: Events::init() returns only one error code, then make it bool sql/events.h: Events::init() returns only one error code, then make it bool sql/mysqld.cc: Check the return code of Events::init() sql/sp_head.cc: Add trace info sql/sql_class.cc: Reorganize thd::change_security_context() to load main_security_ctx sql/sql_class.h: Reorganize thd::change_security_context() to load main_security_ctx sql/sql_lex.cc: Initialize lex->spname sql/sql_yacc.yy: Add a comment
This commit is contained in:
parent
628be8a716
commit
31caa8c433
22 changed files with 315 additions and 161 deletions
|
|
@ -68,12 +68,13 @@ public:
|
|||
bool
|
||||
dump_internal_status(THD *thd);
|
||||
|
||||
int
|
||||
load_events_from_db(THD *thd);
|
||||
|
||||
protected:
|
||||
Event_queue_element *
|
||||
find_n_remove_event(LEX_STRING db, LEX_STRING name);
|
||||
|
||||
int
|
||||
load_events_from_db(THD *thd);
|
||||
|
||||
void
|
||||
drop_matching_events(THD *thd, LEX_STRING pattern,
|
||||
|
|
@ -82,11 +83,24 @@ protected:
|
|||
void
|
||||
empty_queue();
|
||||
|
||||
void
|
||||
notify_observers();
|
||||
|
||||
void
|
||||
dbug_dump_queue(time_t now);
|
||||
|
||||
/* LOCK_event_queue is the mutex which protects the access to the queue. */
|
||||
pthread_mutex_t LOCK_event_queue;
|
||||
|
||||
Event_db_repository *db_repository;
|
||||
|
||||
Event_scheduler *scheduler;
|
||||
|
||||
/* The sorted queue with the Event_job_data objects */
|
||||
QUEUE queue;
|
||||
|
||||
bool queue_loaded;
|
||||
|
||||
uint mutex_last_locked_at_line;
|
||||
uint mutex_last_unlocked_at_line;
|
||||
uint mutex_last_attempted_lock_at_line;
|
||||
|
|
@ -95,24 +109,13 @@ protected:
|
|||
const char* mutex_last_attempted_lock_in_func;
|
||||
bool mutex_queue_data_locked;
|
||||
bool mutex_queue_data_attempting_lock;
|
||||
|
||||
|
||||
/* helper functions for working with mutexes & conditionals */
|
||||
void
|
||||
lock_data(const char *func, uint line);
|
||||
|
||||
void
|
||||
unlock_data(const char *func, uint line);
|
||||
|
||||
void
|
||||
notify_observers();
|
||||
|
||||
void
|
||||
dbug_dump_queue(time_t now);
|
||||
|
||||
Event_scheduler *scheduler;
|
||||
|
||||
/* The sorted queue with the Event_job_data objects */
|
||||
QUEUE queue;
|
||||
};
|
||||
|
||||
#endif /* _EVENT_QUEUE_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue