From 31caa8c433ace692ea5f31c2c2ae0d872533e8de Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 13 Jul 2006 10:59:58 +0200 Subject: 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 --- mysql-test/t/events_restart_phase1.test | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 mysql-test/t/events_restart_phase1.test (limited to 'mysql-test/t/events_restart_phase1.test') diff --git a/mysql-test/t/events_restart_phase1.test b/mysql-test/t/events_restart_phase1.test new file mode 100644 index 00000000000..879591e6141 --- /dev/null +++ b/mysql-test/t/events_restart_phase1.test @@ -0,0 +1,17 @@ +# Can't test with embedded server that doesn't support grants +-- source include/not_embedded.inc + +--disable_warnings +create database if not exists mysqltest_events_test; +--enable_warnings + +use mysqltest_events_test; +set global event_scheduler=2; +create table execution_log(name char(10)); +create event abc1 on schedule every 1 second do insert into execution_log value('abc1'); +create event abc2 on schedule every 1 second do insert into execution_log value('abc2'); +create event abc3 on schedule every 1 second do insert into execution_log value('abc3'); + +insert into mysql.event values ('db1','bad','select 42','root@localhost',NULL,1000,'MICROSECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment1'); +insert into mysql.event values ('db1','bad2','sect','root@localhost',NULL,1000,'SECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment2'); +--echo "Now we restart the server" -- cgit v1.2.1