From 0222af023dc5c5b0bdb3b1c6b3721c282c5eaf25 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Thu, 23 Nov 2023 17:38:42 +0800 Subject: [PATCH] schedule: fix panic when switching placement rules (#7415) close tikv/pd#7414 Signed-off-by: Ryan Leung Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com> --- pkg/schedule/checker/rule_checker.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/schedule/checker/rule_checker.go b/pkg/schedule/checker/rule_checker.go index 08ef5f7b45c..553ece09e65 100644 --- a/pkg/schedule/checker/rule_checker.go +++ b/pkg/schedule/checker/rule_checker.go @@ -132,6 +132,11 @@ func (c *RuleChecker) CheckWithFit(region *core.RegionInfo, fit *placement.Regio return } + // the placement rule is disabled + if fit == nil { + return + } + // If the fit is calculated by FitRegion, which means we get a new fit result, thus we should // invalid the cache if it exists c.ruleManager.InvalidCache(region.GetID())