Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pd-ctl: hidden some hot scheduler config #7892

Merged
merged 6 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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