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,statistics: support recving peer stat by store heartbeat #3665

Merged
merged 21 commits into from
May 14, 2021

Conversation

Yisaer
Copy link
Contributor

@Yisaer Yisaer commented May 11, 2021

Signed-off-by: yisaer disxiaofei@163.com

What problem does this PR solve?

What is changed and how it works?

Support receiving read info of hot peer stat from store heartbeat.

Check List

Tests

  • Unit test

Release note

  • No release note

@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 11, 2021
@Yisaer Yisaer force-pushed the support_store_report branch 3 times, most recently from 3950413 to e260fcb Compare May 12, 2021 06:49
Signed-off-by: yisaer <disxiaofei@163.com>
@Yisaer Yisaer marked this pull request as ready for review May 12, 2021 07:01
@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 May 12, 2021
Signed-off-by: yisaer <disxiaofei@163.com>
Signed-off-by: yisaer <disxiaofei@163.com>
Signed-off-by: yisaer <disxiaofei@163.com>
server/cluster/cluster.go Outdated Show resolved Hide resolved
}
}

// heartbeat twice for read stat in order to let hot degree become 3
Copy link
Contributor

Choose a reason for hiding this comment

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

heartbeat twice?

@Yisaer Yisaer force-pushed the support_store_report branch 3 times, most recently from db00b75 to a025e39 Compare May 12, 2021 08:46
flowQueue chan *core.RegionInfo
writeFlow *hotPeerCache
readFlow *hotPeerCache
writeFlowQueue chan *core.PeerInfo
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 [rwType] chan *core.PeerInfo

server/statistics/hot_peer_cache.go Show resolved Hide resolved
server/statistics/hot_peer_cache.go Outdated Show resolved Hide resolved
server/statistics/hot_peer_cache.go Show resolved Hide resolved
server/statistics/hot_peer_cache.go Outdated Show resolved Hide resolved
server/statistics/hot_peer_cache.go Show resolved Hide resolved
Signed-off-by: yisaer <disxiaofei@163.com>
@codecov
Copy link

codecov bot commented May 12, 2021

Codecov Report

Merging #3665 (b9c4977) into master (e997cb7) will decrease coverage by 0.07%.
The diff coverage is 85.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3665      +/-   ##
==========================================
- Coverage   74.84%   74.77%   -0.08%     
==========================================
  Files         244      244              
  Lines       24209    24291      +82     
==========================================
+ Hits        18119    18163      +44     
- Misses       4484     4517      +33     
- Partials     1606     1611       +5     
Flag Coverage Δ
unittests 74.77% <85.97%> (-0.08%) ⬇️

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

Impacted Files Coverage Δ
server/cluster/cluster.go 81.86% <44.11%> (-1.01%) ⬇️
server/statistics/hot_cache.go 90.27% <86.66%> (-4.27%) ⬇️
pkg/mock/mockcluster/mockcluster.go 95.75% <100.00%> (+1.33%) ⬆️
server/core/peer.go 84.61% <100.00%> (+1.28%) ⬆️
server/statistics/hot_peer_cache.go 96.92% <100.00%> (+2.08%) ⬆️
server/member/member.go 65.59% <0.00%> (-5.38%) ⬇️
server/tso/allocator_manager.go 76.08% <0.00%> (-5.19%) ⬇️
pkg/etcdutil/etcdutil.go 84.70% <0.00%> (-3.53%) ⬇️
server/election/leadership.go 87.05% <0.00%> (-2.36%) ⬇️
server/tso/tso.go 70.11% <0.00%> (-2.30%) ⬇️
... and 15 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 e997cb7...b9c4977. Read the comment docs.

Signed-off-by: yisaer <disxiaofei@163.com>
@JmPotato
Copy link
Member

/run-all-tests

server/cluster/cluster.go Outdated Show resolved Hide resolved
server/core/peer.go Outdated Show resolved Hide resolved
server/statistics/hot_cache.go Outdated Show resolved Hide resolved
// RandHotRegionFromStore randomly picks a hot region in specified store.
func (c *RaftCluster) RandHotRegionFromStore(store uint64, kind statistics.FlowKind) *core.RegionInfo {
// HotRegionsFromStore picks hot regions in specified store.
func (c *RaftCluster) HotRegionsFromStore(store uint64, kind statistics.FlowKind) []*core.RegionInfo {
Copy link
Member

Choose a reason for hiding this comment

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

Where do we use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only be used for mockCluster, removed.

server/cluster/cluster.go Outdated Show resolved Hide resolved
// CheckRegionFlow checks the flow information of region.
func (f *hotPeerCache) CheckRegionFlow(region *core.RegionInfo) (ret []*HotPeerStat) {
// it is only used for test.
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only mockcluster used it for test now.

Copy link
Member

Choose a reason for hiding this comment

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

CheckReadLeaderSync also uses it?

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems to be better to remove Check...Sync.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we can't remove Check...Sync, Check....Async isn't friendly enough to be used in unit-test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CheckRegionFlow now is removed and the related logic is ported in mockCluster.

server/statistics/hot_cache.go Outdated Show resolved Hide resolved
@@ -681,6 +713,9 @@ func (c *RaftCluster) processRegionHeartbeat(region *core.RegionInfo) error {
if c.regionStats != nil {
c.regionStats.Observe(region, c.getRegionStoresLocked(region))
}
for _, item := range expiredItems {
c.hotStat.Update(item)
Copy link
Member

Choose a reason for hiding this comment

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

Will it have a problem since there is another place that may update at the same time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

Signed-off-by: yisaer <disxiaofei@163.com>
JmPotato and others added 3 commits May 14, 2021 14:18
* Clean up useless parameters

Signed-off-by: JmPotato <ghzpotato@gmail.com>

* Define some const variables

Signed-off-by: JmPotato <ghzpotato@gmail.com>

Co-authored-by: ShuNing <nolouch@gmail.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
* Update to TiDB Dashboard v2021.04.16.1

Signed-off-by: Suhaha <jklopsdfw@gmail.com>

* Update to TiDB Dashboard v2021.05.12.1

Signed-off-by: Suhaha <jklopsdfw@gmail.com>

Co-authored-by: 混沌DM <hundundm@gmail.com>
Signed-off-by: yisaer <disxiaofei@163.com>
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 14, 2021
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 14, 2021
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 14, 2021
@purelind
Copy link
Contributor

/run-unit-test

server/statistics/hot_peer_cache.go Outdated Show resolved Hide resolved
server/statistics/hot_peer_cache.go Outdated Show resolved Hide resolved
server/statistics/hot_peer_cache.go Outdated Show resolved Hide resolved
Signed-off-by: yisaer <disxiaofei@163.com>
Signed-off-by: yisaer <disxiaofei@163.com>
@Yisaer
Copy link
Contributor Author

Yisaer commented May 14, 2021

/run-unit-test

@Yisaer
Copy link
Contributor Author

Yisaer commented May 14, 2021

/run-build

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lhy1024
  • rleungx

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@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 May 14, 2021
@Yisaer
Copy link
Contributor Author

Yisaer commented May 14, 2021

/merge

@ti-chi-bot
Copy link
Member

@Yisaer: 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: 1576704

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

sonarcloud bot commented May 14, 2021

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
3.4% 3.4% Duplication

@ti-chi-bot ti-chi-bot merged commit bac7569 into tikv:master May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

7 participants