Skip to content

Commit 7fe011a

Browse files
ti-chi-botokJiang
andauthored
scheduler: use right check for evict/grant leader scheduler (tikv#8758) (tikv#8778)
ref tikv#8756 Signed-off-by: ti-chi-bot <[email protected]> Signed-off-by: okJiang <[email protected]> Co-authored-by: okJiang <[email protected]>
1 parent 959b578 commit 7fe011a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

plugin/scheduler_example/evict_leader.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const (
4646
func init() {
4747
schedule.RegisterSliceDecoderBuilder(EvictLeaderType, func(args []string) schedule.ConfigDecoder {
4848
return func(v interface{}) error {
49-
if len(args) != 1 {
49+
if len(args) < 1 {
5050
return errors.New("should specify the store-id")
5151
}
5252
conf, ok := v.(*evictLeaderSchedulerConfig)
@@ -98,7 +98,7 @@ type evictLeaderSchedulerConfig struct {
9898
}
9999

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

server/schedulers/evict_leader.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (conf *evictLeaderSchedulerConfig) getStores() []uint64 {
9898
}
9999

100100
func (conf *evictLeaderSchedulerConfig) BuildWithArgs(args []string) error {
101-
if len(args) != 1 {
101+
if len(args) < 1 {
102102
return errs.ErrSchedulerConfig.FastGenByArgs("id")
103103
}
104104

server/schedulers/grant_leader.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ type grantLeaderSchedulerConfig struct {
8383
}
8484

8585
func (conf *grantLeaderSchedulerConfig) BuildWithArgs(args []string) error {
86-
if len(args) != 1 {
86+
if len(args) < 1 {
8787
return errs.ErrSchedulerConfig.FastGenByArgs("id")
8888
}
8989

0 commit comments

Comments
 (0)