Bug #17346 Events: multiple-day events happen daily
Submitted: 13 Feb 2006 17:44 Modified: 10 Apr 2006 11:56
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:5.1.7-alpha-debug OS:Linux (SUSE 10.0)
Assigned to: Andrey Hristov CPU Architecture:Any

[13 Feb 2006 17:44] Peter Gulutzan
Description:
I have events scheduled every WEEK / MONTH / QUARTER / YEAR.
Using the operating system, I change the system date and time
to 5 days in the future,  take down + restart the mysqld server,
and say "set global event_scheduler = 1".
Using the operating system, I change the system date and time
to 6 days in the future,  take down + restart the mysqld server,
and say "set global event_scheduler = 1".
I see that all the WEEK / MONTH / QUARTER / YEAR events have
happened each time. But not even  1 week has passed.

How to repeat:
Assume the current database is db1.

/* Use Operating System tools to set date = 2006-01-31
   Take mysqld server down.
   Start mysqld server again. */

create table t1 (s1 char(100), s2 timestamp);

create event e_day on schedule every 1 day do insert into db1.t1 values ('e_day', current_timestamp);
create event e_week on schedule every 1 week do insert into db1.t1 values ('e_week',current_timestamp);
create event e_month on schedule every 1 month do insert into db1.t1 values ('e_month',current_timestamp);
create event e_quarter on schedule every 1 quarter do insert into db1.t1 values ('e_quarter',current_timestamp);
create event e_year on schedule every 1 year do insert into db1.t1 values ('e_year',current_timestamp);

Set global event_scheduler = 1; /* Wait 5 seconds after this */

/* Use Operating System tools to set date = 2006-02-05
   Take mysqld server down.
   Start mysqld server again. */

set global event_scheduler = 1; /* Wait 5 seconds after this */

/* Use Operating System tools to set date = 2006-02-06
   Take mysqld server down.
   Start mysqld server again. */

set global event_scheduler = 1; /* Wait 5 seconds after this */

mysql> select * from db1.t1;
+-----------+---------------------+
| s1        | s2                  |
+-----------+---------------------+
| e_day     | 2006-01-31 10:20:48 |
| e_week    | 2006-01-31 10:20:48 |
| e_quarter | 2006-01-31 10:20:48 |
| e_year    | 2006-01-31 10:20:48 |
| e_month   | 2006-01-31 10:20:48 |
| e_day     | 2006-02-05 10:24:12 |
| e_week    | 2006-02-05 10:24:12 |
| e_quarter | 2006-02-05 10:24:12 |
| e_year    | 2006-02-05 10:24:12 |
| e_month   | 2006-02-05 10:24:12 |
| e_day     | 2006-02-06 10:28:06 |
| e_week    | 2006-02-06 10:28:06 |
| e_quarter | 2006-02-06 10:28:06 |
| e_year    | 2006-02-06 10:28:06 |
| e_month   | 2006-02-06 10:28:06 |
+-----------+---------------------+
15 rows in set (0.01 sec)
[9 Mar 2006 10:37] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3624
[9 Mar 2006 13:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3636
[10 Mar 2006 15:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3715
[13 Mar 2006 17:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3798
[10 Apr 2006 11:56] Andrey Hristov
Fixed as part of fix for #17494