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

domain: make ru_stats duration compatible with DST #52408

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

glorv
Copy link
Contributor

@glorv glorv commented Apr 8, 2024

What problem does this PR solve?

Issue Number: close #52353

Problem Summary:

What changed and how does it work?

Use the time API to calculate the start_time of ru_stats so it can be compatible with DST(daylight saving time).

Check List

Tests

  • Unit test
  • 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.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 8, 2024
@glorv glorv requested review from bb7133 and nolouch April 8, 2024 07:59
Copy link

tiprow bot commented Apr 8, 2024

Hi @glorv. 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/test-infra repository.

@glorv glorv added the needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. label Apr 8, 2024
@glorv
Copy link
Contributor Author

glorv commented Apr 8, 2024

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Apr 8, 2024
Copy link

codecov bot commented Apr 8, 2024

Codecov Report

Merging #52408 (546ecb9) into master (29ced7f) will increase coverage by 0.1910%.
Report is 8 commits behind head on master.
The diff coverage is 75.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #52408        +/-   ##
================================================
+ Coverage   74.1411%   74.3322%   +0.1910%     
================================================
  Files          1467       1467                
  Lines        354227     428958     +74731     
================================================
+ Hits         262628     318854     +56226     
- Misses        72389      90263     +17874     
- Partials      19210      19841       +631     
Flag Coverage Δ
integration 47.9437% <75.0000%> (?)
unit 71.1750% <75.0000%> (-1.7212%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9957% <ø> (-2.3014%) ⬇️
parser ∅ <ø> (∅)
br 49.5243% <ø> (+7.0906%) ⬆️

count := int64(now.Sub(start) / interval)
targetDur := time.Duration(count) * interval
// use UTC timezone to calculate target time so it can be compatible with DST.
return start.In(time.UTC).Add(targetDur).In(tz)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can tz be nil here?

Copy link
Contributor Author

@glorv glorv Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this caller should always pass a valid tz. Anyway, I added a check to set time.Local for nil tz.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 8, 2024
Copy link
Member

@nolouch nolouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link

ti-chi-bot bot commented Apr 8, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nolouch, wjhuang2016

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 8, 2024
Copy link

ti-chi-bot bot commented Apr 8, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-04-08 09:00:36.407447627 +0000 UTC m=+866497.934988170: ☑️ agreed by wjhuang2016.
  • 2024-04-08 09:10:25.280134896 +0000 UTC m=+867086.807675441: ☑️ agreed by nolouch.

@glorv
Copy link
Contributor Author

glorv commented Apr 8, 2024

/retest

@ti-chi-bot ti-chi-bot bot merged commit 33f5d05 into pingcap:master Apr 8, 2024
23 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #52413.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 8, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@glorv glorv deleted the fix-ru-stats-tz branch April 8, 2024 12:09
@glorv glorv removed the needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pkg/domain: Test case TestGetLastExpectedTime failed in Australia/Lord_Howe timezone.
4 participants