From 80451f53b1f3628e7038bb61ee0587d7397dcc0b Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 22 Oct 2024 17:53:37 +0800 Subject: [PATCH] add comments Signed-off-by: lhy1024 --- pkg/mcs/scheduling/server/cluster.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/mcs/scheduling/server/cluster.go b/pkg/mcs/scheduling/server/cluster.go index ca4f347b6d7..66cf1e97518 100644 --- a/pkg/mcs/scheduling/server/cluster.go +++ b/pkg/mcs/scheduling/server/cluster.go @@ -187,10 +187,11 @@ func (c *Cluster) GetHotPeerStat(rw utils.RWType, regionID, storeID uint64) *sta // GetHotPeerStats returns the read or write statistics for hot regions. // It returns a map where the keys are store IDs and the values are slices of HotPeerStat. // The result only includes peers that are hot enough. +// GetHotPeerStats is a thread-safe method. func (c *Cluster) GetHotPeerStats(rw utils.RWType) map[uint64][]*statistics.HotPeerStat { - // GetHotPeerStats is a thread-safe method threshold := c.persistConfig.GetHotRegionCacheHitsThreshold() if rw == utils.Read { + // As read stats are reported by store heartbeat, the threshold needs to be adjusted. threshold = c.persistConfig.GetHotRegionCacheHitsThreshold() * (utils.RegionHeartBeatReportInterval / utils.StoreHeartBeatReportInterval) }