gh-ost icon indicating copy to clipboard operation
gh-ost copied to clipboard

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

Open leonadle opened this issue 3 years ago • 1 comments

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 UTCtime 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

leonadle avatar Jul 28 '23 10:07 leonadle

In 1.1.7, I had the same problem. why not use ApplierTimeZone instead of +00:00. Hopefully there will be a discussion

Ben2277 avatar Apr 08 '25 13:04 Ben2277