From 7e28af70e9f581ab64c5f1e9db201af3309ca772 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Wed, 25 Oct 2023 10:37:59 +0800 Subject: [PATCH] address comments Signed-off-by: Ryan Leung --- pkg/schedule/scatter/region_scatterer.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/schedule/scatter/region_scatterer.go b/pkg/schedule/scatter/region_scatterer.go index 0a83efb923f..898c4d052a7 100644 --- a/pkg/schedule/scatter/region_scatterer.go +++ b/pkg/schedule/scatter/region_scatterer.go @@ -189,8 +189,11 @@ func (r *RegionScatterer) ScatterRegionsByID(regionsID []uint64, group string, r return 0, nil, errEmptyRegion } if len(regionsID) == 1 { - scatterSkipNoRegionCounter.Inc() - return 0, nil, errRegionNotFound + region := r.cluster.GetRegion(regionsID[0]) + if region == nil { + scatterSkipNoRegionCounter.Inc() + return 0, nil, errRegionNotFound + } } failures := make(map[uint64]error, len(regionsID)) regions := make([]*core.RegionInfo, 0, len(regionsID))