diff options
author | unknown <andrey@lmy004.> | 2006-01-18 20:41:22 +0100 |
---|---|---|
committer | unknown <andrey@lmy004.> | 2006-01-18 20:41:22 +0100 |
commit | 6bd58a2a3ce27eb744a8d35893f5bfefd9e173dd (patch) | |
tree | 364b1773d1b0b50d5005939089eefee7bc15af75 /sql/event_executor.cc | |
parent | ef3a610638a4d0742a8b4a33e329f5f963e55bec (diff) | |
download | mariadb-git-6bd58a2a3ce27eb744a8d35893f5bfefd9e173dd.tar.gz |
- fix bug #16435 (Weekly events execute every second) (WL#1034 Internal CRON)
Before the interval expression was considered to be in seconds, now it is
just a number and the type of interval is considered.
- this changeset introduces also fix for bug#16432 (Events: error re interval
misrepresents the facts)
the code of event_timed::set_interval() was refactored anyway so it is meaningful to
fix the bug in the same changeset.
include/my_time.h:
- move enum interval_type to include/my_time.h so it can be used by functions
in the whole server
sql/event.cc:
- don't use second_part
- fix small problem with create event xyz, when xyz exists -> make it error
instead of warning if create_if_not is false.
sql/event.h:
pass thd to mark_last_executed() to be able to call thd->end_time()
sql/event_executor.cc:
- pass thd to event_timed::compute_next_execution_time()
- a bit more DBUG info in the server log
- handle error returned by event_timed::compute_next_execution_time()
sql/event_priv.h:
- define the maximal possible value for interval_value
sql/event_timed.cc:
- more docs
- add static get_next_time() which sums a TIME with an interval
- fix bug #16435 (Weekly events execute every second)
Before the interval expression was considered to be in seconds, now it is
just a number and the type of interval is considered.
- fix for bug#16432 (Events: error re interval misrepresents the facts)
(return an error if a value is too big or is negative - errmsg changed)
sql/item_timefunc.cc:
- export get_interval_date()
- refactor Item_date_add_interval::get_date() and extract the core
to date_add_interval() in time.cc so it can be reused by the
scheduler code in event_timed.cc
sql/item_timefunc.h:
- export get_interval_value() so it can be reused in event_timed.cc in
function static get_next_time()
- move enum interval_type to include/my_time.h so it can be used by functions
in the whole server
sql/mysql_priv.h:
export the new function date_add_interval() added to time.cc
sql/share/errmsg.txt:
- change error message to be appropriate as fix for bug#16432
(Events: error re interval misrepresents the facts)
sql/sql_yacc.yy:
- change error message to be appropriate as fix for bug#16432
(Events: error re interval misrepresents the facts)
sql/time.cc:
extract the core of Item_date_add_interval::get_date()
to a function per Serg's request. The code can be reused
to add und substract interval from a date.
Diffstat (limited to 'sql/event_executor.cc')
-rw-r--r-- | sql/event_executor.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sql/event_executor.cc b/sql/event_executor.cc index dd426c32545..1cb289efc74 100644 --- a/sql/event_executor.cc +++ b/sql/event_executor.cc @@ -334,9 +334,19 @@ event_executor_main(void *arg) { pthread_t th; - DBUG_PRINT("evex main thread",("mark_last_executed")); - et->mark_last_executed(); - et->compute_next_execution_time(); + DBUG_PRINT("evex main thread", ("[%10s] this exec at [%llu]", et->name.str, + TIME_to_ulonglong_datetime(&et->execute_at))); + et->mark_last_executed(thd); + if (et->compute_next_execution_time()) + { + sql_print_error("Error while computing time of %s.%s . " + "Disabling after execution.", + et->dbname.str, et->name.str); + et->status= MYSQL_EVENT_DISABLED; + } + DBUG_PRINT("evex main thread", ("[%10s] next exec at [%llu]", et->name.str, + TIME_to_ulonglong_datetime(&et->execute_at))); + et->update_fields(thd); DBUG_PRINT("info", (" Spawning a thread %d", ++iter_num)); #ifndef DBUG_FAULTY_THR @@ -599,7 +609,12 @@ evex_load_events_from_db(THD *thd) } // let's find when to be executed - et->compute_next_execution_time(); + if (et->compute_next_execution_time()) + { + sql_print_error("Error while computing execution time of %s.%s. Skipping", + et->dbname.str, et->name.str); + continue; + } DBUG_PRINT("evex_load_events_from_db", ("Adding to the exec list.")); |