Why gh-ost set time_zone to UTC when applying DML events
- Dominant language
- Go
- Stars
- 13.6k
- Forks
- 1.4k
- Avg merge
- 2h 31m
- Merged PRs (30d)
- 4
Description
>**Env**
- `gh-ost` : 1.1.2
- `mysql` : 5.7.26
- `time_zone`: system(ShangHai)
>**Bug**
Mysql server is configured with `time_zone=system` and the server's time zone is `Shanghai`. The problem I encountered was that during the gh-ost run, after the insert statement involved the timestamp time field was successfully inserted, when the data was queried again, the time field increased by 8 hours.
>**question**
Looking at the source code, I found that `time_zone = '+00:00'` is defined in the `ApplyDMLEventQueries` function, which is equal to the UTC time zone. Because insert is written in `UTC`time zone, but select is read in `SYSTEM` time zone, the time field is increased by 8 hours.
**My question is why the UTC time zone is set when applying dml event instead of using the default time zone configuration?**
Contributor guide
Assessment
This issue has not been assessed yet.