Skip to content

Commit

Permalink
pd-ctl: hidden some hot scheduler config (#7892)
Browse files Browse the repository at this point in the history
ref #5691

Signed-off-by: lhy1024 <admin@liudos.us>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
lhy1024 and ti-chi-bot[bot] authored Apr 12, 2024
1 parent 33ae3b6 commit 5da6def
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 22 deletions.
29 changes: 29 additions & 0 deletions tools/pd-ctl/pdctl/command/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,18 @@ func addStoreToSchedulerConfig(cmd *cobra.Command, schedulerName string, args []
postJSON(cmd, path.Join(schedulerConfigPrefix, schedulerName, "config"), input)
}

var hiddenHotConfig = []string{
"max-zombie-rounds",
"max-peer-number",
"byte-rate-rank-step-ratio",
"key-rate-rank-step-ratio",
"query-rate-rank-step-ratio",
"count-rank-step-ratio",
"great-dec-ratio",
"minor-dec-ratio",
"enable-for-tiflash",
}

func listSchedulerConfigCommandFunc(cmd *cobra.Command, args []string) {
if len(args) != 0 {
cmd.Println(cmd.UsageString())
Expand All @@ -667,6 +679,23 @@ func listSchedulerConfigCommandFunc(cmd *cobra.Command, args []string) {
cmd.Println(err)
return
}
if p == "balance-hot-region-scheduler" {
schedulerConfig := make(map[string]any)
err := json.Unmarshal([]byte(r), &schedulerConfig)
if err != nil {
cmd.Println(err)
return
}
for _, config := range hiddenHotConfig {
delete(schedulerConfig, config)
}
b, err := json.MarshalIndent(schedulerConfig, "", " ")
if err != nil {
cmd.Println(err)
return
}
r = string(b)
}
cmd.Println(r)
}

Expand Down
35 changes: 13 additions & 22 deletions tools/pd-ctl/tests/scheduler/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,28 +386,19 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *pdTests.TestCluster) {

// test hot region config
expected1 := map[string]any{
"min-hot-byte-rate": float64(100),
"min-hot-key-rate": float64(10),
"min-hot-query-rate": float64(10),
"max-zombie-rounds": float64(3),
"max-peer-number": float64(1000),
"byte-rate-rank-step-ratio": 0.05,
"key-rate-rank-step-ratio": 0.05,
"query-rate-rank-step-ratio": 0.05,
"count-rank-step-ratio": 0.01,
"great-dec-ratio": 0.95,
"minor-dec-ratio": 0.99,
"src-tolerance-ratio": 1.05,
"dst-tolerance-ratio": 1.05,
"read-priorities": []any{"byte", "key"},
"write-leader-priorities": []any{"key", "byte"},
"write-peer-priorities": []any{"byte", "key"},
"strict-picking-store": "true",
"enable-for-tiflash": "true",
"rank-formula-version": "v2",
"split-thresholds": 0.2,
"history-sample-duration": "5m0s",
"history-sample-interval": "30s",
"min-hot-byte-rate": float64(100),
"min-hot-key-rate": float64(10),
"min-hot-query-rate": float64(10),
"src-tolerance-ratio": 1.05,
"dst-tolerance-ratio": 1.05,
"read-priorities": []any{"byte", "key"},
"write-leader-priorities": []any{"key", "byte"},
"write-peer-priorities": []any{"byte", "key"},
"strict-picking-store": "true",
"rank-formula-version": "v2",
"split-thresholds": 0.2,
"history-sample-duration": "5m0s",
"history-sample-interval": "30s",
}
checkHotSchedulerConfig := func(expect map[string]any) {
testutil.Eventually(re, func() bool {
Expand Down

0 comments on commit 5da6def

Please sign in to comment.