Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Nov 10, 2021
2 parents c642b9f + 71ec276 commit f29b788
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 4 additions & 2 deletions tests/pdctl/scheduler/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ func (s *schedulerTestSuite) TestScheduler(c *C) {
// test hot region config
echo = mustExec([]string{"-u", pdAddr, "scheduler", "config", "evict-leader-scheduler"}, nil)
c.Assert(strings.Contains(echo, "[404] scheduler not found"), IsTrue)
var conf map[string]interface{}
mustExec([]string{"-u", pdAddr, "scheduler", "config", "balance-hot-region-scheduler", "list"}, &conf)
expected1 := map[string]interface{}{
"min-hot-byte-rate": float64(100),
"min-hot-key-rate": float64(10),
Expand All @@ -277,6 +275,10 @@ func (s *schedulerTestSuite) TestScheduler(c *C) {
"strict-picking-store": "true",
"enable-for-tiflash": "true",
}
var conf map[string]interface{}
mustExec([]string{"-u", pdAddr, "scheduler", "config", "balance-hot-region-scheduler", "list"}, &conf)
c.Assert(conf, DeepEquals, expected1)
mustExec([]string{"-u", pdAddr, "scheduler", "config", "balance-hot-region-scheduler", "show"}, &conf)
c.Assert(conf, DeepEquals, expected1)
mustExec([]string{"-u", pdAddr, "scheduler", "config", "balance-hot-region-scheduler", "set", "src-tolerance-ratio", "1.02"}, nil)
expected1["src-tolerance-ratio"] = 1.02
Expand Down
16 changes: 12 additions & 4 deletions tools/pd-ctl/pdctl/command/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,22 @@ func newConfigHotRegionCommand() *cobra.Command {
Short: "balance-hot-region-scheduler config",
Run: listSchedulerConfigCommandFunc,
}

// Deprecated: list command will be deprecated in future version, use show command instead.
c.AddCommand(&cobra.Command{
Use: "list",
Short: "list the config item (will be deprecated in feature version, use show command instead)",
Run: listSchedulerConfigCommandFunc,
}, &cobra.Command{
Use: "show",
Short: "list the config item",
Run: listSchedulerConfigCommandFunc})
c.AddCommand(&cobra.Command{
Run: listSchedulerConfigCommandFunc,
}, &cobra.Command{
Use: "set <key> <value>",
Short: "set the config item",
Run: func(cmd *cobra.Command, args []string) { postSchedulerConfigCommandFunc(cmd, c.Name(), args) }})
Run: func(cmd *cobra.Command, args []string) { postSchedulerConfigCommandFunc(cmd, c.Name(), args) },
})

return c
}

Expand Down Expand Up @@ -511,7 +519,7 @@ func listSchedulerConfigCommandFunc(cmd *cobra.Command, args []string) {
return
}
p := cmd.Name()
if p == "list" {
if p == "list" || p == "show" {
p = cmd.Parent().Name()
}
path := path.Join(schedulerConfigPrefix, p, "list")
Expand Down

0 comments on commit f29b788

Please sign in to comment.