Skip to content

Commit

Permalink
pass ut
Browse files Browse the repository at this point in the history
Signed-off-by: 童剑 <[email protected]>
  • Loading branch information
bufferflies committed Jan 10, 2025
1 parent 23ff7d0 commit 1e6d628
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
5 changes: 4 additions & 1 deletion pkg/mcs/scheduling/server/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,10 @@ func (c *Cluster) updateScheduler() {
)
// Create the newly added schedulers.
for _, scheduler := range latestSchedulersConfig {
schedulerType := types.ConvertOldStrToType[scheduler.Type]
schedulerType, ok := types.ConvertOldStrToType[scheduler.Type]
if !ok {
log.Warn("scheduler not found ", zap.String("type", scheduler.Type))
}
s, err := schedulers.CreateScheduler(
schedulerType,
c.coordinator.GetOperatorController(),
Expand Down
36 changes: 18 additions & 18 deletions pkg/schedule/types/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,24 @@ var (
//
// It is used to convert the old scheduler type to `CheckerSchedulerType`.
ConvertOldStrToType = map[string]CheckerSchedulerType{
"balance-leader": BalanceLeaderScheduler,
"balance-region": BalanceRegionScheduler,
"balance-witness": BalanceWitnessScheduler,
"evict-leader": EvictLeaderScheduler,
"evict-slow-store": EvictSlowStoreScheduler,
"evict-slow-trend": EvictSlowTrendScheduler,
"grant-leader": GrantLeaderScheduler,
"grant-hot-region": GrantHotRegionScheduler,
"hot-region": BalanceHotRegionScheduler,
"random-merge": RandomMergeScheduler,
"scatter-range": ScatterRangeScheduler,
"shuffle-hot-region": ShuffleHotRegionScheduler,
"shuffle-leader": ShuffleLeaderScheduler,
"shuffle-region": ShuffleRegionScheduler,
"split-bucket": SplitBucketScheduler,
"transfer-witness-leader": TransferWitnessLeaderScheduler,
"label": LabelScheduler,
"balance-key-range-scheduler": BalanceKeyRangeScheduler,
"balance-leader": BalanceLeaderScheduler,
"balance-region": BalanceRegionScheduler,
"balance-witness": BalanceWitnessScheduler,
"evict-leader": EvictLeaderScheduler,
"evict-slow-store": EvictSlowStoreScheduler,
"evict-slow-trend": EvictSlowTrendScheduler,
"grant-leader": GrantLeaderScheduler,
"grant-hot-region": GrantHotRegionScheduler,
"hot-region": BalanceHotRegionScheduler,
"random-merge": RandomMergeScheduler,
"scatter-range": ScatterRangeScheduler,
"shuffle-hot-region": ShuffleHotRegionScheduler,
"shuffle-leader": ShuffleLeaderScheduler,
"shuffle-region": ShuffleRegionScheduler,
"split-bucket": SplitBucketScheduler,
"transfer-witness-leader": TransferWitnessLeaderScheduler,
"label": LabelScheduler,
"balance-key-range": BalanceKeyRangeScheduler,
}

// StringToSchedulerType is a map to convert the scheduler string to the CheckerSchedulerType.
Expand Down

0 comments on commit 1e6d628

Please sign in to comment.