Skip to content

Commit

Permalink
address the comment
Browse files Browse the repository at this point in the history
Signed-off-by: yisaer <disxiaofei@163.com>
  • Loading branch information
Yisaer committed Jul 27, 2021
1 parent fcd72d2 commit 807a828
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
6 changes: 2 additions & 4 deletions server/schedulers/hot_region_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import (
)

const (
// NonePriority indicates there is no dim priority for hot-region-scheduler
NonePriority = ""
// BytePriority indicates hot-region-scheduler prefer byte dim
BytePriority = "byte"
// KeyPriority indicates hot-region-scheduler prefer key dim
Expand All @@ -54,8 +52,8 @@ func initHotRegionScheduleConfig() *hotRegionSchedulerConfig {
MaxPeerNum: 1000,
SrcToleranceRatio: 1.05, // Tolerate 5% difference
DstToleranceRatio: 1.05, // Tolerate 5% difference
ReadPriorities: []string{},
WritePriorities: []string{},
ReadPriorities: []string{KeyPriority, BytePriority},
WritePriorities: []string{BytePriority, KeyPriority},
}
}

Expand Down
18 changes: 8 additions & 10 deletions tools/pd-ctl/pdctl/command/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,17 +530,15 @@ func postSchedulerConfigCommandFunc(cmd *cobra.Command, schedulerName string, ar
}
if schedulerName == "balance-hot-region-scheduler" && (key == "read-priorities" || key == "write-priorities") {
priorities := make([]string, 0)
if value != "none" {
for _, priority := range strings.Split(value, ",") {
if priority != schedulers.BytePriority && priority != schedulers.KeyPriority {
cmd.Println(fmt.Sprintf("priority should be one of %s,%s,%s",
schedulers.BytePriority,
schedulers.KeyPriority,
"none"))
return
}
priorities = append(priorities, priority)
for _, priority := range strings.Split(value, ",") {
if priority != schedulers.BytePriority && priority != schedulers.KeyPriority {
cmd.Println(fmt.Sprintf("priority should be one of %s,%s,%s",
schedulers.BytePriority,
schedulers.KeyPriority,
"none"))
return
}
priorities = append(priorities, priority)
}
input[key] = priorities
} else {
Expand Down

0 comments on commit 807a828

Please sign in to comment.