Skip to content

Commit

Permalink
scheduler: fix flaky test TestRegionLabelDenyScheduler (tikv#8340)
Browse files Browse the repository at this point in the history
close tikv#8339

Ignore the specified operator instead of skipping all operators

Signed-off-by: okJiang <819421878@qq.com>

Co-authored-by: Hu# <jinhao.hu@pingcap.com>
  • Loading branch information
okJiang and HuSharp authored Jul 2, 2024
1 parent f9c2366 commit a7f2632
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/schedule/schedulers/scheduler_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ retry:

// If we have schedule, reset interval to the minimal interval.
s.nextInterval = s.Scheduler.GetMinInterval()
for _, op := range ops {
region := s.cluster.GetRegion(op.RegionID())
for i := 0; i < len(ops); i++ {
region := s.cluster.GetRegion(ops[i].RegionID())
if region == nil {
continue retry
}
Expand All @@ -492,9 +492,13 @@ retry:
// Refer: https://docs.pingcap.com/tidb-in-kubernetes/stable/restart-a-tidb-cluster#perform-a-graceful-restart-to-a-single-tikv-pod
if labelMgr.ScheduleDisabled(region) && !isEvictLeaderScheduler {
denySchedulersByLabelerCounter.Inc()
continue retry
ops = append(ops[:i], ops[i+1:]...)
i--
}
}
if len(ops) == 0 {
continue
}
return ops
}
s.nextInterval = s.Scheduler.GetNextInterval(s.nextInterval)
Expand Down

0 comments on commit a7f2632

Please sign in to comment.