1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

BUG#16420: Events: timestamps become UTC

BUG#26429: SHOW CREATE EVENT is incorrect for an event that
           STARTS NOW()
BUG#26431: Impossible to re-create an event from backup if its
           STARTS clause is in the past
WL#3698: Events: execution in local time zone

The problem was that local times specified by the user in AT, STARTS
and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC,
and the original time zone was forgotten.  This way, event scheduler
couldn't honor Daylight Saving Time shifts, and times shown to the
user were also in UTC.  Additionally, CREATE EVENT didn't allow times
in the past, thus preventing straightforward event restoration from
old backups.

This patch reworks event scheduler time computations, performing them
in the time zone associated with the event.  Also it allows times to
be in the past.

The patch adds time_zone column to mysql.event table.

NOTE: The patch is almost final, but the bug#9953 should be pushed
first.
This commit is contained in:
kroki/tomash@moonlight.home
2007-03-16 17:31:07 +03:00
parent 245668efb0
commit 6d8f6b5bfd
29 changed files with 1382 additions and 382 deletions

View File

@@ -58,15 +58,20 @@ public:
LEX_STRING name;
LEX_STRING definer;// combination of user and host
Time_zone *time_zone;
Event_basic();
virtual ~Event_basic();
virtual int
load_from_row(TABLE *table) = 0;
load_from_row(THD *thd, TABLE *table) = 0;
protected:
bool
load_string_fields(Field **fields, ...);
bool
load_time_zone(THD *thd, const LEX_STRING tz_name);
};
@@ -92,11 +97,11 @@ public:
enum enum_on_completion on_completion;
enum enum_status status;
TIME last_executed;
TIME execute_at;
TIME starts;
TIME ends;
my_time_t last_executed;
my_time_t execute_at;
my_time_t starts;
my_time_t ends;
my_bool starts_null;
my_bool ends_null;
my_bool execute_at_null;
@@ -112,7 +117,7 @@ public:
virtual ~Event_queue_element();
virtual int
load_from_row(TABLE *table);
load_from_row(THD *thd, TABLE *table);
bool
compute_next_execution_time();
@@ -168,7 +173,7 @@ public:
init();
virtual int
load_from_row(TABLE *table);
load_from_row(THD *thd, TABLE *table);
int
get_create_event(THD *thd, String *buf);
@@ -192,7 +197,7 @@ public:
virtual ~Event_job_data();
virtual int
load_from_row(TABLE *table);
load_from_row(THD *thd, TABLE *table);
int
execute(THD *thd);
@@ -224,6 +229,11 @@ public:
};
enum enum_on_completion on_completion;
enum enum_status status;
/*
do_not_create will be set if STARTS time is in the past and
on_completion == ON_COMPLETION_DROP.
*/
bool do_not_create;
const uchar *body_begin;
@@ -237,9 +247,9 @@ public:
Item* item_ends;
Item* item_execute_at;
TIME starts;
TIME ends;
TIME execute_at;
my_time_t starts;
my_time_t ends;
my_time_t execute_at;
my_bool starts_null;
my_bool ends_null;
my_bool execute_at_null;
@@ -284,6 +294,9 @@ private:
void
report_bad_value(const char *item_name, Item *bad_item);
void
check_if_in_the_past(THD *thd, my_time_t ltime_utc);
Event_parse_data(const Event_parse_data &); /* Prevent use of these */
void operator=(Event_parse_data &);
};