Skip to content

Commit

Permalink
scheduler: use right check for evict/grant leader scheduler (tikv#8758)…
Browse files Browse the repository at this point in the history
… (tikv#8778)

ref tikv#8756

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: okJiang <819421878@qq.com>

Co-authored-by: okJiang <819421878@qq.com>
  • Loading branch information
ti-chi-bot and okJiang authored Nov 7, 2024
1 parent 959b578 commit 7fe011a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugin/scheduler_example/evict_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (
func init() {
schedule.RegisterSliceDecoderBuilder(EvictLeaderType, func(args []string) schedule.ConfigDecoder {
return func(v interface{}) error {
if len(args) != 1 {
if len(args) < 1 {
return errors.New("should specify the store-id")
}
conf, ok := v.(*evictLeaderSchedulerConfig)
Expand Down Expand Up @@ -98,7 +98,7 @@ type evictLeaderSchedulerConfig struct {
}

func (conf *evictLeaderSchedulerConfig) BuildWithArgs(args []string) error {
if len(args) != 1 {
if len(args) < 1 {
return errors.New("should specify the store-id")
}

Expand Down
2 changes: 1 addition & 1 deletion server/schedulers/evict_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (conf *evictLeaderSchedulerConfig) getStores() []uint64 {
}

func (conf *evictLeaderSchedulerConfig) BuildWithArgs(args []string) error {
if len(args) != 1 {
if len(args) < 1 {
return errs.ErrSchedulerConfig.FastGenByArgs("id")
}

Expand Down
2 changes: 1 addition & 1 deletion server/schedulers/grant_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type grantLeaderSchedulerConfig struct {
}

func (conf *grantLeaderSchedulerConfig) BuildWithArgs(args []string) error {
if len(args) != 1 {
if len(args) < 1 {
return errs.ErrSchedulerConfig.FastGenByArgs("id")
}

Expand Down

0 comments on commit 7fe011a

Please sign in to comment.