[MDEV-16246] insert timestamp into spider table from mysqldump gets wrong time zone. Created: 2018-05-22 Updated: 2020-08-25 Resolved: 2018-07-09 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Spider |
| Affects Version/s: | 10.3.7 |
| Fix Version/s: | 10.3.9, 10.4.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Mattias Jonsson | Assignee: | Jacob Mathew (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux |
||
| Issue Links: |
|
||||||||||||
| Description |
|
From a dump file generated by:
Load it to a spider table:
And it fails with:
How to reproduce:
create the servers:
Create the spider table:
Use the dumpfile:
and load with mysql test < timestamp.dump and it fails with:
This is of course a simplified table structure etc. from what we are using, but it shows the bug in an easier fashion. |
| Comments |
| Comment by Jacob Mathew (Inactive) [ 2018-05-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Upon precisely following the instructions for reproducing in the bug description using the latest MariaDB Server 10.3 code, the load succeeds. The reported problem does not reproduce:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Mattias Jonsson [ 2018-05-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, sorry I missed a piece for reproducing this: time_zone on the spider head and datanodes was set to 'SYSTEM' which was CEST. I.e. the reason for this failure is that the time in the dump is in UTC, but when inserting to spider (which locally and remote are set to CEST due to the SYSTEM time_zone) it loses the session time_zone (UTC) in between the spider head and the datanodes and tries to insert it as CET/CEST which is in DST transition, meaning there is no such hour between 02:00 and 02:59:59 resulting in a failure to insert. Another way to check this bug should be to SELECT FROM_UNIXTIME(timestamp_col) which should show the difference in time zone from the INSERT session and the time zone on the head/datanode. I believe it should be possible to adjust the test for other time zones. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2018-05-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I've recently fixed a similar bug FederatedX ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-06-22 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This reported problem will not occur if the spider_sync_time_zone configuration variable is set to TRUE. It can be initialized to TRUE in my.cnf. It can also be set to TRUE before executing a block of SQL statements that uses a different time zone, and then reset afterwards:
This will cause the time zone to be synchronized at the beginning of every transaction until the variable is reset to FALSE. I am looking at other ways to do the synchronization that synchronize less frequently and which do not involve setting and resetting the configuration variable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2018-06-22 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
RIght, spider_sync_time_zone=TRUE indeed fixes the original reported problem. But it generally doesn't fix the third issue mentioned in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-06-22 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The third issue in the above comment refers to timestamps for the hour in October or November when we transition from daylight savings time to standard time, when the 2:00 am to 3:00 am hour occurs twice. We need to differentiate between time values in the two occurrences of that hour on that day. A problem can occur when the time zone on a data node is not UTC nor another time zone that does not have daylight savings time. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2018-06-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Note, according to comments above, the bug reporter uses CET/CEST time zone and this timestamp ambiguity is a real, not a hypothetical, issue for him. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-06-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Kentoku, please review my fix for this problem in commit 4c4c4f9 on my branch. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kentoku Shiba (Inactive) [ 2018-07-05 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Jacob, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-07-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Kentoku, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-07-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Fix is pushed to 10.3. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-07-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Fix is pushed to 10.4. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Mattias Jonsson [ 2018-07-31 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
We have tested and verified that the fix works. |