Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

cenkore
Copy link

@cenkore cenkore commented May 8, 2021

related: #161 #247 #269 ..

This PR is to fix the data integrity problem in timestamp conversion datetime scenarios.

Env

Variable_name Value
system_time_zone CST
time_zone +08:00

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 !

@dm-2
Copy link
Contributor

dm-2 commented Jan 4, 2022

Fixed merge conflict for testing

@dm-2 dm-2 temporarily deployed to production January 4, 2022 14:46 Inactive
@dm-2 dm-2 temporarily deployed to production January 4, 2022 16:51 Inactive
dm-2
dm-2 previously approved these changes Jul 6, 2022
@timvaillancourt timvaillancourt self-requested a review July 6, 2022 22:24
@timvaillancourt
Copy link
Collaborator

@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 localtests/ dir that would:

  1. Confirm master currently has a problem (test fails before changes in this PR)
  2. Confirm the logic in this PR resolves the problem?
    🤔

@timvaillancourt timvaillancourt self-requested a review July 6, 2022 22:29
Copy link
Collaborator

@timvaillancourt timvaillancourt left a 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 🙏

@dm-2 dm-2 modified the milestones: v1.1.5, v1.1.6 Jul 7, 2022
@cenkore
Copy link
Author

cenkore commented Jul 15, 2022

@cenkore see my previous comment 🙏

@timvaillancourt Sorry for taking a long time to reply you. PTAL.

@timvaillancourt timvaillancourt modified the milestones: v1.1.7, v1.1.8 Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants