Skip to content

statistics: avoid mutate global variable#28678

Merged
ti-chi-bot merged 5 commits intopingcap:masterfrom
tisonkun:issue-28676
Oct 9, 2021
Merged

statistics: avoid mutate global variable#28678
ti-chi-bot merged 5 commits intopingcap:masterfrom
tisonkun:issue-28676

Conversation

@tisonkun
Copy link
Contributor

@tisonkun tisonkun commented Oct 9, 2021

This closes #28676 .

Signed-off-by: tison wander4096@gmail.com

Release note

None

This closes pingcap#28676 .

Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun requested review from qw4990 and winoros October 9, 2021 04:09
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Oct 9, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • qw4990
  • winoros

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Details

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 9, 2021
@tisonkun
Copy link
Contributor Author

tisonkun commented Oct 9, 2021

cc @feitian124

Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 9, 2021

// splitBuckets split the histogram buckets according to the feedback.
func splitBuckets(h *Histogram, feedback *QueryFeedback) ([]bucket, []bool, int64) {
func splitBuckets(h *Histogram, feedback *QueryFeedback, bucketCount int) ([]bucket, []bool, int64) {
Copy link
Contributor

Choose a reason for hiding this comment

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

how about add splitBucketsWithBucketCount for test purpose, likeUpdateHistogramWithBucketCount ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a private method with limited usage. It'd be better to just change the signature as using less global variable as possible.

Copy link
Contributor

Choose a reason for hiding this comment

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

since I found that the meaning of bucketCount param in splitBuckets is not so clear after above change.
add splitBucketsWithBucketCount maybe better, or rename it to defaultBucketCount too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Naming is hard. I tend to use capacity actually, but it is originally count. I don't think carefully on changing the name and the reason we don't introduce splitBucketsWithBucketCount is already present.

@feitian124
Copy link
Contributor

sorry for inject this bug and thanks for help fix.
maybe minor enhance comment inline.
rest LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 9, 2021
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 9, 2021
@qw4990
Copy link
Contributor

qw4990 commented Oct 9, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

DetailsCommit hash: 91441f6

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Oct 9, 2021
@ti-chi-bot
Copy link
Member

@tisonkun: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Details

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot merged commit 219c02e into pingcap:master Oct 9, 2021
@tisonkun tisonkun deleted the issue-28676 branch December 14, 2021 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unstable tests TestUpdateHistogram

5 participants