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

cluster: move stats update into a better place #3901

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Jul 22, 2021

What problem does this PR solve?

Issue Number: Close #3286, close #3558, close #3199, ref #5648.

What is changed and how does it work?

Check List

Tests

  • Unit test

Release note

None

@rleungx rleungx added the component/cluster Cluster logic. label Jul 22, 2021
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 22, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JmPotato
  • disksing

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 the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jul 22, 2021
@codecov
Copy link

codecov bot commented Jul 22, 2021

Codecov Report

Attention: Patch coverage is 97.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 75.56%. Comparing base (776003b) to head (d3f1da6).
Report is 1232 commits behind head on master.

Files Patch % Lines
server/cluster/cluster.go 92.85% 0 Missing and 1 partial ⚠️
server/cluster/coordinator.go 97.22% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3901      +/-   ##
==========================================
- Coverage   75.61%   75.56%   -0.05%     
==========================================
  Files         329      329              
  Lines       32965    32984      +19     
==========================================
  Hits        24925    24925              
- Misses       5896     5911      +15     
- Partials     2144     2148       +4     
Flag Coverage Δ
unittests 75.56% <97.77%> (-0.05%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -714,6 +714,11 @@ func (c *RaftCluster) processRegionHeartbeat(region *core.RegionInfo) error {
c.regionStats.Observe(region, c.getRegionStoresLocked(region))
}

// Updates the label level isolation statistics.
if c.labelLevelStats != nil {
c.labelLevelStats.Observe(region, c.getRegionStoresLocked(region), c.opt.GetLocationLabels())
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it‘s may cost many CPUs.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@disksing
Copy link
Contributor

I think even if update statistics in heartbeat, it can still lose sync.

@disksing disksing removed their request for review August 24, 2021 03:07
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 16, 2021
@ti-chi-bot ti-chi-bot added do-not-merge/invalid-commit-message and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 23, 2021
@rleungx rleungx changed the title cluster: fix the incorrect label counter cluster: move stats update into a better place Nov 23, 2021
@rleungx
Copy link
Member Author

rleungx commented Nov 23, 2021

I think even if update statistics in heartbeat, it can still lose sync.

Yes. I decide to leave it in region heartbeat process for now.

Comment on lines 61 to 63
// persistLimitRetryTimes is used to reduce the probability of the persistent error
// since the once the store is add or remove, we shouldn't return an error even if the store limit is failed to persist.
defaultStatsJobLimit = 10000
Copy link
Member

Choose a reason for hiding this comment

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

The comments above will mismatch.

server/cluster/coordinator_test.go Show resolved Hide resolved
server/cluster/cluster_test.go Outdated Show resolved Hide resolved
server/cluster/cluster.go Outdated Show resolved Hide resolved
@rleungx
Copy link
Member Author

rleungx commented Nov 23, 2021

/run-unit-tests

@rleungx
Copy link
Member Author

rleungx commented Nov 24, 2021

/run-unit-tests

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 24, 2021
@rleungx
Copy link
Member Author

rleungx commented Nov 24, 2021

/run-all-tests

@rleungx rleungx force-pushed the fix-label-counter branch 2 times, most recently from 81a0ff5 to 5bfd31c Compare December 28, 2021 03:26
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 11, 2022
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 16, 2022
@rleungx rleungx force-pushed the fix-label-counter branch 2 times, most recently from 3c623f2 to f2127d1 Compare December 6, 2022 07:06
@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/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Dec 9, 2022
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
@rleungx
Copy link
Member Author

rleungx commented Dec 12, 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 Dec 12, 2022
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 12, 2023
@ti-chi-bot
Copy link
Member

@rleungx: PR needs rebase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/cluster Cluster logic. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
5 participants