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

未关闭
#1,289 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 10 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
go, mysql
领域
databases

调研方向

从 Go 源代码中的 ApplyDMLEventQueries 开始,检查它如何设置 time_zone。使用 SYSTEM/Shanghai 和一个带有 timestamp 的 DML 事件重现报告的 MySQL 5.7.26 案例,然后比较查询得到的值。达成一致的解释后即算完成;如果该行为并非预期,则还需要经过测试的更改或对预期时区行为的文档说明。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
Go
星标
13.6k
派生
1.4k
平均合并
9 天 19 小时
30 天内合并 PR
1

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/gh-ost 的其他 Issue

查看 github/gh-ost 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。