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

stats: fix converting duration to timestamp #8174

Merged
merged 3 commits into from
Nov 5, 2018

Conversation

alivxxx
Copy link
Contributor

@alivxxx alivxxx commented Nov 5, 2018

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

  • Unit test

Code changes

  • Has exported function/method change

Side effects

  • None

Related changes

  • Need to cherry-pick to the release branch

PTAL @zz-jason @winoros @lzmhhh123

@shenli
Copy link
Member

shenli commented Nov 5, 2018

Will this affect the release-2.1?

@alivxxx
Copy link
Contributor Author

alivxxx commented Nov 5, 2018

@shenli Yes, I will cherry-pick it when this is merged.

@@ -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)
Copy link
Member

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)

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 5, 2018
Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala zimulala added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 5, 2018
@zimulala
Copy link
Contributor

zimulala commented Nov 5, 2018

/run-all-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/statistics status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants