New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix data-integrity: timestamp convert to datetime scenario #969
base: master
Are you sure you want to change the base?
Conversation
Fixed merge conflict for testing |
@cenkore / @dm-2 / @rashiq: as this converts data I'd like to be very sure it works now and in the future Are there any tests that we can add to the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cenkore see my previous comment 🙏
@timvaillancourt Sorry for taking a long time to reply you. PTAL. |
related: #161 #247 #269 ..
This PR is to fix the data integrity problem in timestamp conversion datetime scenarios.
Env
Reason
The timestamp time_zone parsed from binlog is CST +08:00, go-sql-driver will convert it to UTC +00:00 by default, and finally when applying to the database, even though add session query
set @@session.time_zone='+00:00'
, but because the column type has been changed to datetime, the time zone did not do conversion again, so the time zone was actually only converted by half, causing the data written to _xx_gho is 8 hours smaller.Solution
In this case, change the time zone from +00:00 to the local system time zone, which is the opposite of datetime convert to timestamp.
Thank you !