tidb
tidb copied to clipboard
types: interpret timestamp in DST transition backwards consistently as the first occurrence
What problem does this PR solve?
Issue Number: close #61368
Problem Summary:
TiDB uses golang time.Date(location) for converting from a datetime + time zone to timestamp, which is not defined how it will interpret datetimes in the range when Daylight Saving Time ends, and the clock moves backwards, i.e. when a time happens twice. This PR defines it as always interpret it as the first time.
Example, we are using 'Europe/Amsterdam' time_zone and insert '2025-10-26 02:30:00', we cannot know if it should be interpreted as '02:30:00+02:00' (first occurrence, still in DST) or '02:30:00+01:00' (second occurrence, now in normal time). This PR will consistently interpret it as '02:30:00+02:00', same as MySQL seems to do.
What changed and how does it work?
Check List
Tests
- [ ] Unit test
- [x] Integration test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test
- [ ] I checked and no code files have been changed.
Side effects
- [ ] Performance regression: Consumes more CPU
- [ ] Performance regression: Consumes more Memory
- [ ] Breaking backward compatibility
Documentation
- [ ] Affects user behaviors
- [ ] Contains syntax changes
- [ ] Contains variable changes
- [ ] Contains experimental features
- [ ] Changes MySQL compatibility
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
When converting to TIMESTAMP, if the value is in the range when transitioning from Daylight Saving Time to normal time (i.e. the clock moves back) always interpret the time as if t was in normal time.
Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all
/retest
Hi @mjonss. Thanks for your PR.
PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.
I understand the commands that are listed here.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
@mjonss: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/retest
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 73.5775%. Comparing base (805da7c) to head (c51c3c3).
:warning: Report is 94 commits behind head on master.
:warning: Current head c51c3c3 differs from pull request most recent head 2ea514a
Please upload reports for the commit 2ea514a to get more accurate results.
Additional details and impacted files
@@ Coverage Diff @@
## master #61447 +/- ##
================================================
+ Coverage 72.7284% 73.5775% +0.8491%
================================================
Files 1848 1727 -121
Lines 498383 479947 -18436
================================================
- Hits 362466 353133 -9333
+ Misses 113900 105315 -8585
+ Partials 22017 21499 -518
| Flag | Coverage Δ | |
|---|---|---|
| integration | 42.4748% <100.0000%> (?) |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Components | Coverage Δ | |
|---|---|---|
| dumpling | 52.7804% <ø> (-0.0897%) |
:arrow_down: |
| parser | ∅ <ø> (∅) |
|
| br | 47.4489% <ø> (+1.0482%) |
:arrow_up: |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
/retest
@mjonss: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/retest
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
/retest
@mjonss: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/retest
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
@mjonss: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:
| Test name | Commit | Details | Required | Rerun command |
|---|---|---|---|---|
| idc-jenkins-ci-tidb/unit-test | c51c3c36acf461e600f4af6526571ed99e777db8 | link | true | /test unit-test |
| pull-integration-realcluster-test-next-gen | c51c3c36acf461e600f4af6526571ed99e777db8 | link | true | /test pull-integration-realcluster-test-next-gen |
| pull-unit-test-next-gen | c51c3c36acf461e600f4af6526571ed99e777db8 | link | true | /test pull-unit-test-next-gen |
Full PR test history. Your PR dashboard.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign sdojjy for approval. For more information see the Code Review Process. Please ensure that each of them provides their approval before proceeding.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment