From dcd6fb5a21eab2cd848ff3aff6ed42310855a415 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Sun, 28 Apr 2024 16:30:31 +0800 Subject: [PATCH] fix RegionStatsNeedUpdate condition Signed-off-by: Ryan Leung --- pkg/statistics/region_collection.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/statistics/region_collection.go b/pkg/statistics/region_collection.go index cb0de6f601b..565597b4efb 100644 --- a/pkg/statistics/region_collection.go +++ b/pkg/statistics/region_collection.go @@ -158,14 +158,14 @@ func (r *RegionStatistics) RegionStatsNeedUpdate(region *core.RegionInfo) bool { region.IsOversized(int64(r.conf.GetRegionMaxSize()), int64(r.conf.GetRegionMaxKeys())) { return true } - // expected to be zero for below type - if r.IsRegionStatsType(regionID, PendingPeer) && len(region.GetPendingPeers()) == 0 { + + if r.IsRegionStatsType(regionID, PendingPeer) != (len(region.GetPendingPeers()) != 0) { return true } - if r.IsRegionStatsType(regionID, DownPeer) && len(region.GetDownPeers()) == 0 { + if r.IsRegionStatsType(regionID, DownPeer) != (len(region.GetDownPeers()) != 0) { return true } - if r.IsRegionStatsType(regionID, LearnerPeer) && len(region.GetLearners()) == 0 { + if r.IsRegionStatsType(regionID, LearnerPeer) != (len(region.GetLearners()) != 0) { return true }