From: Date: September 1 2006 1:11pm Subject: bk commit into 5.1 tree (andrey:1.2286) List-Archive: http://lists.mysql.com/commits/11246 Message-Id: <20060901111137.A714A14564@andrey.hristov.com> Below is the list of changes that have just been committed into a local 5.1 repository of andrey. When andrey does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2006-09-01 13:11:24+02:00, andrey@stripped +1 -0 Merge ahristov@stripped:/home/bk/mysql-5.1-wl3337 into example.com:/work/mysql-5.1-runtime-wl3337 MERGE: 1.2284.1.1 sql/events.cc@stripped, 2006-09-01 13:11:18+02:00, andrey@stripped +0 -0 Auto merged MERGE: 1.60.1.1 # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: andrey # Host: example.com # Root: /work/mysql-5.1-runtime-wl3337/RESYNC --- 1.61/sql/events.cc 2006-09-01 13:11:37 +02:00 +++ 1.62/sql/events.cc 2006-09-01 13:11:37 +02:00 @@ -59,17 +59,39 @@ eligible for execution. */ -const char *event_scheduler_state_names[]= - { "OFF", "0", "ON", "1", "SUSPEND", "2", NullS }; +/* + Keep the order of the first to as in var_typelib + sys_var_event_scheduler::value_ptr() references this array. Keep in + mind! +*/ +static const char *opt_event_scheduler_state_names[]= + { "OFF", "ON", "0", "1", "DISABLED", NullS }; TYPELIB Events::opt_typelib= { - array_elements(event_scheduler_state_names)-1, + array_elements(opt_event_scheduler_state_names)-1, + "", + opt_event_scheduler_state_names, + NULL +}; + + +/* + The order should not be changed. We consider OFF to be equivalent of INT 0 + And ON of 1. If OFF & ON are interchanged the logic in + sys_var_event_scheduler::update() will be broken! +*/ +static const char *var_event_scheduler_state_names[]= { "OFF", "ON", NullS }; + +TYPELIB Events::var_typelib= +{ + array_elements(var_event_scheduler_state_names)-1, "", - event_scheduler_state_names, + var_event_scheduler_state_names, NULL }; + static Event_queue events_event_queue; @@ -81,7 +103,8 @@ Event_db_repository events_event_db_repo Events Events::singleton; -ulong Events::opt_event_scheduler= 2; +enum Events::enum_opt_event_scheduler Events::opt_event_scheduler= + Events::EVENTS_OFF; /* @@ -607,6 +630,9 @@ Events::init() bool res= FALSE; DBUG_ENTER("Events::init"); + if (opt_event_scheduler == Events::EVENTS_DISABLED) + DBUG_RETURN(FALSE); + /* We need a temporary THD during boot */ if (!(thd= new THD())) { @@ -637,12 +663,10 @@ Events::init() } scheduler->init_scheduler(event_queue); - if (opt_event_scheduler) - { - DBUG_ASSERT(opt_event_scheduler == 1 || opt_event_scheduler == 2); - if (opt_event_scheduler == 1) - res= scheduler->start(); - } + DBUG_ASSERT(opt_event_scheduler == Events::EVENTS_ON || + opt_event_scheduler == Events::EVENTS_OFF); + if (opt_event_scheduler == Events::EVENTS_ON) + res= scheduler->start(); end: delete thd; @@ -667,10 +691,11 @@ void Events::deinit() { DBUG_ENTER("Events::deinit"); - - if (likely(!check_system_tables_error)) + if (likely(!check_system_tables_error) && + scheduler->get_state() > Event_scheduler::UNINITIALIZED) { scheduler->stop(); + DBUG_ASSERT(scheduler->get_state() == Event_scheduler::INITIALIZED); scheduler->deinit_scheduler(); event_queue->deinit_queue();