From a6322478486be37611e0c7db28d22ba368319745 Mon Sep 17 00:00:00 2001 From: HunDunDM Date: Tue, 27 Jul 2021 22:53:09 +0800 Subject: [PATCH] fix typo Signed-off-by: HunDunDM --- server/schedulers/utils.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/server/schedulers/utils.go b/server/schedulers/utils.go index 86498d1c623b..8fc5f9699a54 100644 --- a/server/schedulers/utils.go +++ b/server/schedulers/utils.go @@ -401,8 +401,10 @@ func (s *storeInfo) addInfluence(infl *Influence, w float64) { return } if s.PendingSum == nil { - s.PendingSum = new(Influence) - s.PendingSum.Loads = make([]float64, len(infl.Loads)) + s.PendingSum = &Influence{ + Loads: make([]float64, len(infl.Loads)), + Count: 0, + } } for i, load := range infl.Loads { s.PendingSum.Loads[i] += load * w @@ -514,12 +516,6 @@ func summaryStoresLoad( } loads[statistics.QueryDim] = storeLoads[statistics.StoreWriteQuery] } - if !isTiFlash { - // The TiFlash flow is isolated from TiKV, so it is not counted in the sum. - for i := range allLoadSum { - allLoadSum[i] += loads[i] - } - } // Find all hot peers first var hotPeers []*statistics.HotPeerStat @@ -554,6 +550,13 @@ func summaryStoresLoad( hotPeerSummary.WithLabelValues(ty, fmt.Sprintf("%v", id)).Set(peerLoadSum[statistics.QueryDim]) } } + + if !isTiFlash { + // The TiFlash flow is isolated from TiKV, so it is not counted in the sum. + for i := range allLoadSum { + allLoadSum[i] += loads[i] + } + } allCount += float64(len(hotPeers)) // Build store load prediction from current load and pending influence.