github / github/gh-ost

Why gh-ost set time_zone to UTC when applying DML events

Open
#1,289 1 comment 0 reactions 0 assignees View on GitHub
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?**

image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.