reproducing this is time sensitive. And occurs just once a year ...
Server is set to timezone Europe/Brussels
at 2018-03-25 02:00:00 clocks would move to 03:00:00 (wintertime->summertime changeover) making times between 2AM and 3 AM invalid.
1 hour before this Timezone change I noticed errors inserting records into a table that had a column defined as:
+-----------+------------------+------+-----+---------------------+-------+
|
| Field | Type | Null | Key | Default | Extra |
|
+-----------+------------------+------+-----+---------------------+-------+
|
[...]
|
| expires | timestamp | NO | | 0000-00-00 00:00:00 | |
|
+-----------+------------------+------+-----+---------------------+-------+
|
The value inserted was calculated on insert by mariadb itself using ADDTIME(NOW(),'01:00:00') as value for the expires field.
Mariadb was using the system Timezones:
MariaDB [(none)]> SELECT @@global.time_zone, @@session.time_zone;
|
+--------------------+---------------------+
|
| @@global.time_zone | @@session.time_zone |
|
+--------------------+---------------------+
|
| SYSTEM | SYSTEM |
|
+--------------------+---------------------+
|
1 row in set (0.00 sec)
|
Essentially ADDTIME creates invalid dates as it doesn't account for timezone changes.
While at the same time (pun not intended) mariadb does enforce the validity of such timestamps when inserted in a field in the database.
MariaDB [adminsite]> select now();
|
+---------------------+
|
| now() |
|
+---------------------+
|
| 2018-03-25 01:38:44 |
|
+---------------------+
|
1 row in set (0.00 sec)
|
|
MariaDB [adminsite]> select ADDTIME(NOW(),'01:00:00');
|
+---------------------------+
|
| ADDTIME(NOW(),'01:00:00') |
|
+---------------------------+
|
| 2018-03-25 02:39:34 |
|
+---------------------------+
|
1 row in set (0.00 sec)
|
Actual insert error message (Time ran out, sorry, DST change occurred before I could fully document it) example:
PHP message: mysqli::execute: Incorrect datetime value: '2018-03-25 02:29:27' for column 'expires'
Issuing a "set time_zone='+00:00';" before using the database connection from the application worked around the the problem (I don't mind not using local time at all - in fact using localtime only started after a server swap and did go by unnoticed till now).
Still if the database insists on valid time, it should also calculate valid time itself.
{"report":{"fcp":2012.9000000357628,"ttfb":974.1999999880791,"pageVisibility":"visible","entityId":66490,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"899416ad-b085-4649-98a2-a12439f28345","navigationType":0,"readyForUser":2101.699999988079,"redirectCount":0,"resourceLoadedEnd":2280.5,"resourceLoadedStart":980.3000000119209,"resourceTiming":[{"duration":525.1999999880791,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":980.3000000119209,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":980.3000000119209,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1505.5,"responseStart":0,"secureConnectionStart":0},{"duration":525.3000000119209,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":980.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":980.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1505.800000011921,"responseStart":0,"secureConnectionStart":0},{"duration":577.3000000119209,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":980.6999999880791,"connectEnd":980.6999999880791,"connectStart":980.6999999880791,"domainLookupEnd":980.6999999880791,"domainLookupStart":980.6999999880791,"fetchStart":980.6999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":980.6999999880791,"responseEnd":1558,"responseStart":1558,"secureConnectionStart":980.6999999880791},{"duration":638.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":980.9000000357628,"connectEnd":980.9000000357628,"connectStart":980.9000000357628,"domainLookupEnd":980.9000000357628,"domainLookupStart":980.9000000357628,"fetchStart":980.9000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":980.9000000357628,"responseEnd":1619.699999988079,"responseStart":1619.699999988079,"secureConnectionStart":980.9000000357628},{"duration":642.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":981.1000000238419,"connectEnd":981.1000000238419,"connectStart":981.1000000238419,"domainLookupEnd":981.1000000238419,"domainLookupStart":981.1000000238419,"fetchStart":981.1000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":981.1000000238419,"responseEnd":1623.6000000238419,"responseStart":1623.6000000238419,"secureConnectionStart":981.1000000238419},{"duration":642.9000000357628,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":981.1999999880791,"connectEnd":981.1999999880791,"connectStart":981.1999999880791,"domainLookupEnd":981.1999999880791,"domainLookupStart":981.1999999880791,"fetchStart":981.1999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":981.1999999880791,"responseEnd":1624.1000000238419,"responseStart":1624.1000000238419,"secureConnectionStart":981.1999999880791},{"duration":643,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":981.5,"connectEnd":981.5,"connectStart":981.5,"domainLookupEnd":981.5,"domainLookupStart":981.5,"fetchStart":981.5,"redirectEnd":0,"redirectStart":0,"requestStart":981.5,"responseEnd":1624.5,"responseStart":1624.5,"secureConnectionStart":981.5},{"duration":720.5999999642372,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":981.6000000238419,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":981.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1702.199999988079,"responseStart":0,"secureConnectionStart":0},{"duration":643.1999999880791,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":981.8000000119209,"connectEnd":981.8000000119209,"connectStart":981.8000000119209,"domainLookupEnd":981.8000000119209,"domainLookupStart":981.8000000119209,"fetchStart":981.8000000119209,"redirectEnd":0,"redirectStart":0,"requestStart":981.8000000119209,"responseEnd":1625,"responseStart":1625,"secureConnectionStart":981.8000000119209},{"duration":720.3999999761581,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":981.9000000357628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":981.9000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1702.300000011921,"responseStart":0,"secureConnectionStart":0},{"duration":643.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":982.1000000238419,"connectEnd":982.1000000238419,"connectStart":982.1000000238419,"domainLookupEnd":982.1000000238419,"domainLookupStart":982.1000000238419,"fetchStart":982.1000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":982.1000000238419,"responseEnd":1625.6000000238419,"responseStart":1625.6000000238419,"secureConnectionStart":982.1000000238419},{"duration":1015.6999999880791,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":983.4000000357628,"connectEnd":983.4000000357628,"connectStart":983.4000000357628,"domainLookupEnd":983.4000000357628,"domainLookupStart":983.4000000357628,"fetchStart":983.4000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":983.4000000357628,"responseEnd":1999.1000000238419,"responseStart":1999.1000000238419,"secureConnectionStart":983.4000000357628},{"duration":1292.3999999761581,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":988.1000000238419,"connectEnd":988.1000000238419,"connectStart":988.1000000238419,"domainLookupEnd":988.1000000238419,"domainLookupStart":988.1000000238419,"fetchStart":988.1000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":988.1000000238419,"responseEnd":2280.5,"responseStart":2280.400000035763,"secureConnectionStart":988.1000000238419},{"duration":285.5999999642372,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1713.9000000357628,"connectEnd":1713.9000000357628,"connectStart":1713.9000000357628,"domainLookupEnd":1713.9000000357628,"domainLookupStart":1713.9000000357628,"fetchStart":1713.9000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":1713.9000000357628,"responseEnd":1999.5,"responseStart":1999.5,"secureConnectionStart":1713.9000000357628},{"duration":350,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":2030.800000011921,"connectEnd":2030.800000011921,"connectStart":2030.800000011921,"domainLookupEnd":2030.800000011921,"domainLookupStart":2030.800000011921,"fetchStart":2030.800000011921,"redirectEnd":0,"redirectStart":0,"requestStart":2030.800000011921,"responseEnd":2380.800000011921,"responseStart":2380.800000011921,"secureConnectionStart":2030.800000011921},{"duration":356.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/f51ef5507eea4c158f257c66c93b2a3f-CDN/lu2bu7/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":2031.300000011921,"connectEnd":2031.300000011921,"connectStart":2031.300000011921,"domainLookupEnd":2031.300000011921,"domainLookupStart":2031.300000011921,"fetchStart":2031.300000011921,"redirectEnd":0,"redirectStart":0,"requestStart":2031.300000011921,"responseEnd":2387.800000011921,"responseStart":2387.800000011921,"secureConnectionStart":2031.300000011921}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":735,"responseStart":974,"responseEnd":981,"domLoading":978,"domInteractive":2320,"domContentLoadedEventStart":2320,"domContentLoadedEventEnd":2373,"domComplete":2671,"loadEventStart":2671,"loadEventEnd":2671,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2282.400000035763},{"name":"bigPipe.sidebar-id.end","time":2283.300000011921},{"name":"bigPipe.activity-panel-pipe-id.start","time":2283.400000035763},{"name":"bigPipe.activity-panel-pipe-id.end","time":2288.699999988079},{"name":"activityTabFullyLoaded","time":2390.800000011921}],"measures":[],"correlationId":"4af71995342d9d","effectiveType":"4g","downlink":9.2,"rtt":0,"serverDuration":168,"dbReadsTimeInMs":18,"dbConnsTimeInMs":28,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
My local timezone has a 2am to 3am jump at beginning of DST as tested here:
| SYSTEM | SYSTEM |
| @@sql_mode |
| STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
| @@version |
| 10.3.6-MariaDB-log |
| 2018-10-07 01:57:35 |
So not fixed in 10.3.
Notably adddate doesn't doesn't perform the same timezone calculations and results in an invalid time:
| 2018-10-07 02:01:18 |