Bug #95649 | MySQL 8.0 INFORMATION_SCHEMA.EVENTS not observing custom timezone for last_execu | ||
---|---|---|---|
Submitted: | 5 Jun 2019 9:40 | Modified: | 9 Oct 2019 15:00 |
Reporter: | Egidijus Grismanauskas | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Information schema | Severity: | S3 (Non-critical) |
Version: | 8.x | OS: | Linux |
Assigned to: | Paul DuBois | CPU Architecture: | x86 |
[5 Jun 2019 9:40]
Egidijus Grismanauskas
[5 Jun 2019 12:06]
MySQL Verification Team
Hi, Thank you for your bug report. Last_executed column is based on the system timezone and hence it works as expected. However, it is not documented properly. Also, your last comment points to yet another small inconsistency in our documentation. Hence, I am verifying this bug as a documentation bug.
[5 Jun 2019 14:58]
MySQL Verification Team
Hi, Our documentation should also state whether global or session settings are used.
[9 Aug 2019 13:08]
Paul DuBois
Posted by developer: re: "Based on MySQL 8 documentation, Last executed from INFORMATION_SCHEMA.EVENTS should return using the event timezone however regardless of set time_zone parameter last executed always seems to return in UTC." If you find someplace in the documentation that states last executed uses the event time zone, please reopen this bug and provide the URL of the page that says so. Otherwise, last executed is documented to use UTC. * The INFORMATION_SCHEMA.EVENTS page (https://dev.mysql.com/doc/refman/8.0/en/events-table.html) says this under Notes: "Times in the EVENTS table are displayed using the event time zone, the current session time zone, or UTC, as described in Section 24.4.4, “Event Metadata”." * The event metadata page (https://dev.mysql.com/doc/refman/8.0/en/events-metadata.html) says this: "For representation of event information in the mysql.event table, the execute_at, starts, and ends times are converted to UTC and stored along with the event time zone. This enables event execution to proceed as defined regardless of any subsequent changes to the server time zone or daylight saving time effects. The last_executed time is also stored in UTC." Note that last sentence.
[9 Aug 2019 13:12]
MySQL Verification Team
Thank you, Paul.
[9 Aug 2019 14:39]
Paul DuBois
Posted by developer: Actually, after further investigation, I'm re-opening this bug and reclassifying it as a server bug, because there are two differences in the I_S.EVENTS table between MySQL 5.7 and 8.0. I suspect these have to do with the transition from the mysql.event table in 5.7 to the data dictionary in 8.0. I do see now that the documentation at https://dev.mysql.com/doc/refman/8.0/en/events-metadata.html has a table at the end indicating the I_S.EVENTS.LAST_EXECUTED should be in the ETZ. Summary: * I_S.EVENTS.LAST_EXECUTED is in UTC, not the ETZ. * I_S.EVENTS.LAST_ALTERED is in the STZ, but it does not get updated. (Appears to be initialized to the CREATED time, but not updated when ALTER TABLE is executed). Test script: SET sql_mode='STRICT_TRANS_TABLES'; DROP EVENT IF EXISTS myevt; CREATE EVENT myevt ON SCHEDULE EVERY 5 SECOND STARTS '2019-08-01 00:00:00' ENDS '2019-08-31 00:00:00' DO DO 1+1; DO SLEEP(10); ALTER EVENT myevt COMMENT 'event comment'; SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='myevt'\G SELECT * FROM mysql.event WHERE name='myevt'\G Run this script at the same time in 5.7 and 8.0 (the SELECT from mysql.event will fail in 8.0, of course), and diff the results. Here are the important differences in I_S.EVENT contents (5.7: - lines; 8.0: + lines) CREATED: 2019-08-09 09:27:37 - LAST_ALTERED: 2019-08-09 09:27:47 - LAST_EXECUTED: 2019-08-09 09:27:45 + LAST_ALTERED: 2019-08-09 09:27:37 + LAST_EXECUTED: 2019-08-09 14:27:45 Note that LAST_ALTERED in 5.7 is 10 seconds later than CREATED, as it should be. In 8.0, it did not get updated. Note that LAST_EXECUTED in 8.0 gets converted to UTC (2019-08-09 14:27:45); it should be reported in the ETZ (2019-08-09 09:27:45).
[9 Aug 2019 14:55]
Paul DuBois
Posted by developer: I will take care of removing references to the mysql.event table in the MySQL 8.0 documentation. That table's contents now are represented in the data dictionary.
[12 Aug 2019 12:15]
MySQL Verification Team
Paul, I do agree that it is a code bug .....
[9 Oct 2019 15:00]
Paul DuBois
Posted by developer: Fixed in 8.0.19. The LAST_EXECUTED value in the INFORMATION_SCHEMA.EVENTS table was incorrectly reported in UTC, not in the event time zone.
[10 Oct 2019 12:04]
MySQL Verification Team
Thank you, Paul .........