Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
Signed-off-by: yisaer <disxiaofei@163.com>
  • Loading branch information
Yisaer committed May 12, 2021
1 parent 4f9989b commit 37031ce
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions server/statistics/hot_peer_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const (
// WriteReportInterval indicates the interval between write interval
WriteReportInterval = RegionHeartBeatReportInterval
// ReadReportInterval indicates the interval between read stats report
// TODO: use StoreHeartBeatReportInterval in future
ReadReportInterval = StoreHeartBeatReportInterval

rollingWindowsSize = 5
Expand Down Expand Up @@ -208,7 +207,7 @@ func (f *hotPeerCache) CheckPeerFlow(peer *core.PeerInfo, region *core.RegionInf
loads[i] = deltaLoads[i] / float64(interval)
}
justTransferLeader := f.justTransferLeader(region)
// transfer read leader or remove write peer
// remove peer
isExpired := f.isPeerExpired(peer, region)
oldItem := f.getOldHotPeerStat(region.GetID(), storeID)
if isExpired && oldItem != nil {
Expand Down Expand Up @@ -284,14 +283,7 @@ func (f *hotPeerCache) getOldHotPeerStat(regionID, storeID uint64) *HotPeerStat

func (f *hotPeerCache) isPeerExpired(peer *core.PeerInfo, region *core.RegionInfo) bool {
storeID := peer.GetStoreID()
switch f.kind {
case WriteFlow:
return region.GetStorePeer(storeID) == nil
//TODO: make readFlow isPeerExpired condition as same as the writeFlow
case ReadFlow:
return region.GetLeader().GetStoreId() != storeID
}
return false
return region.GetStorePeer(storeID) == nil
}

func (f *hotPeerCache) calcHotThresholds(storeID uint64) []float64 {
Expand Down

0 comments on commit 37031ce

Please sign in to comment.