diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-07-17 18:51:12 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-07-17 18:51:12 +0200 |
commit | c1d6a2d7e194225ccc19a68ea5d0f368632620d0 (patch) | |
tree | bd13736fa139caac8c6e21484d2f03f6f0d30d57 /sql/events.cc | |
parent | 1b82512914db8d5779395017e2ed4a66a48b561c (diff) | |
download | mariadb-git-c1d6a2d7e194225ccc19a68ea5d0f368632620d0.tar.gz |
merge few bug fixes from 5.6
Diffstat (limited to 'sql/events.cc')
-rw-r--r-- | sql/events.cc | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/sql/events.cc b/sql/events.cc index b9c51b77f05..acf842dea44 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -808,7 +808,16 @@ Events::init(bool opt_noacl_or_bootstrap) */ thd->thread_stack= (char*) &thd; thd->store_globals(); - + /* + Set current time for the thread that handles events. + Current time is stored in data member start_time of THD class. + Subsequently, this value is used to check whether event was expired + when make loading events from storage. Check for event expiration time + is done at Event_queue_element::compute_next_execution_time() where + event's status set to Event_parse_data::DISABLED and dropped flag set + to true if event was expired. + */ + thd->set_time(); /* We will need Event_db_repository anyway, even if the scheduler is disabled - to perform events DDL. @@ -1098,8 +1107,7 @@ Events::load_events_from_db(THD *thd) while (!(read_record_info.read_record(&read_record_info))) { Event_queue_element *et; - bool created; - bool drop_on_completion; + bool created, dropped; if (!(et= new Event_queue_element)) goto end; @@ -1114,10 +1122,13 @@ Events::load_events_from_db(THD *thd) delete et; goto end; } - drop_on_completion= (et->on_completion == - Event_parse_data::ON_COMPLETION_DROP); - + /** + Since the Event_queue_element object could be deleted inside + Event_queue::create_event we should save the value of dropped flag + into the temporary variable. + */ + dropped= et->dropped; if (event_queue->create_event(thd, et, &created)) { /* Out of memory */ @@ -1126,7 +1137,7 @@ Events::load_events_from_db(THD *thd) } if (created) count++; - else if (drop_on_completion) + else if (dropped) { /* If not created, a stale event - drop if immediately if |