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

statistics: fix the hot region API cannot work without hot scheduler #4424

Merged
merged 10 commits into from
Jan 20, 2022

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Dec 5, 2021

What problem does this PR solve?

close #3879. But this PR should be reviewed after the following PRs are merged:

What is changed and how it works?

This PR mainly makes the following changes:

  • remove hasHotStatus interface
  • no need to run a hot scheduler to get hot statistics
  • move all calculation logic of hot region into statistics package

Check List

Tests

  • Unit test

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 5, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • bufferflies
  • lhy1024

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.

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 Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/invalid-commit-message labels Dec 5, 2021
@codecov
Copy link

codecov bot commented Dec 5, 2021

Codecov Report

Merging #4424 (4f68846) into master (d1b59c1) will decrease coverage by 0.14%.
The diff coverage is 97.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4424      +/-   ##
==========================================
- Coverage   74.96%   74.82%   -0.15%     
==========================================
  Files         277      279       +2     
  Lines       27627    27627              
==========================================
- Hits        20711    20671      -40     
- Misses       5082     5106      +24     
- Partials     1834     1850      +16     
Flag Coverage Δ
unittests 74.82% <97.54%> (-0.15%) ⬇️

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

Impacted Files Coverage Δ
server/schedulers/metrics.go 100.00% <ø> (ø)
server/schedulers/utils.go 91.04% <ø> (-3.10%) ⬇️
server/statistics/store_load.go 95.76% <60.00%> (-1.61%) ⬇️
server/statistics/collector.go 93.75% <93.75%> (ø)
server/cluster/cluster.go 84.25% <100.00%> (-0.58%) ⬇️
server/cluster/coordinator.go 75.59% <100.00%> (-1.21%) ⬇️
server/core/basic_cluster.go 91.66% <100.00%> (+0.18%) ⬆️
server/schedulers/grant_hot_region.go 58.54% <100.00%> (ø)
server/schedulers/hot_region.go 82.58% <100.00%> (-0.24%) ⬇️
server/schedulers/shuffle_hot_region.go 65.65% <100.00%> (ø)
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4242300...4f68846. Read the comment docs.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/invalid-commit-message release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Dec 6, 2021
@rleungx rleungx changed the title statistics: fix the hot region API cannot work when hot scheduler is disabled statistics: fix the hot region API cannot work without hot scheduler Dec 6, 2021
@rleungx rleungx marked this pull request as ready for review December 13, 2021 10:06
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 13, 2021
@rleungx
Copy link
Member Author

rleungx commented Dec 14, 2021

/run-unit-tests

@rleungx
Copy link
Member Author

rleungx commented Dec 16, 2021

The lock problem needs to pay attention to.

@rleungx rleungx requested review from nolouch and removed request for JmPotato December 22, 2021 06:48
@@ -535,35 +517,33 @@ func (c *coordinator) resetSchedulerMetrics() {

func (c *coordinator) collectHotSpotMetrics() {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is some difference between collection and GetHotXXXXRegions.

@rleungx rleungx added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 28, 2021
@rleungx
Copy link
Member Author

rleungx commented Jan 4, 2022

/hold cancel

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 4, 2022
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 19, 2022
@rleungx rleungx requested a review from JmPotato January 19, 2022 04:20
@@ -1590,23 +1581,17 @@ func (checker *prepareChecker) collect(region *core.RegionInfo) {

// GetHotWriteRegions gets hot write regions' info.
func (c *RaftCluster) GetHotWriteRegions(storeIDs ...uint64) *statistics.StoreHotPeersInfos {
c.RLock()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we no longer need locks?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think so.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@rleungx rleungx requested a review from lhy1024 January 19, 2022 09:53
@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 Jan 19, 2022
@rleungx
Copy link
Member Author

rleungx commented Jan 20, 2022

/merge

@ti-chi-bot
Copy link
Member

@rleungx: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

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

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

Commit hash: 4f68846

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 20, 2022
@ti-chi-bot ti-chi-bot merged commit f605a2c into tikv:master Jan 20, 2022
disksing pushed a commit to oh-my-tidb/pd that referenced this pull request Feb 8, 2022
…ikv#4424)

* refacter store load in hot region scheduler

ref tikv#3879

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* resolve conflicts

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* fix the hot region API cannot work when hot scheduler is disabled

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* resolve conflicts

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* clean up

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* make drop region atomically

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* address the comment

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@nolouch nolouch added the needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. label Feb 20, 2023
@nolouch
Copy link
Contributor

nolouch commented Feb 20, 2023

/run-cherry-pick

@nolouch nolouch removed the needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. label Feb 20, 2023
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Feb 20, 2023
ref tikv#3879

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@rleungx rleungx deleted the remove-interface branch February 21, 2023 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/statistics Statistics for scheduling. release-note-none Denotes a PR that doesn't merit a release note. 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.

hot region should work if hot region schedule is disable
5 participants