-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
stats: fix converting duration to timestamp #8174
Conversation
Will this affect the release-2.1? |
@shenli Yes, I will cherry-pick it when this is merged. |
statistics/handle.go
Outdated
@@ -109,6 +109,11 @@ func (h *Handle) GetQueryFeedback() []*QueryFeedback { | |||
return h.feedback | |||
} | |||
|
|||
// DurationToTS converts duration to timestamp. | |||
func DurationToTS(d time.Duration) uint64 { | |||
return oracle.ComposeTS(int64(d)/int64(time.Millisecond), 0) |
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.
how about:
d.Nanoseconds()/int64(time.Millisecond)
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.
LGTM
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.
LGTM
/run-all-tests |
What problem does this PR solve?
The deleted stats is not removed for a long time.
Fix #8115
What is changed and how it works?
We will delete the stats that have been deleted in 10 stats-lease ago. But when converting the stats lease to timestamp, which is the version info used in stats, we forgot to divide the million second unit, thus resulting in long stale time.
Check List
Tests
Code changes
Side effects
Related changes
PTAL @zz-jason @winoros @lzmhhh123