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: print warn information when set max-replica to less than current #8983

Merged
merged 7 commits into from
Jan 13, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tools/pd-ctl/pdctl/command/config_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

"github.com/spf13/cobra"

sc "github.com/tikv/pd/pkg/schedule/config"
"github.com/tikv/pd/pkg/schedule/placement"
"github.com/tikv/pd/pkg/utils/apiutil"
"github.com/tikv/pd/pkg/utils/reflectutil"
Expand Down Expand Up @@ -374,6 +375,12 @@ func postConfigDataWithPath(cmd *cobra.Command, key, value, path string) error {
val = value
}
data[key] = val
if key == "max-replicas" {
replica, err := strconv.ParseInt(value, 10, 64)
if err == nil && replica < sc.DefaultMaxReplicas {
cmd.Println("Setting max-replica to less than 3 may be a mistake and carries high risk. Please confirm the setting.")
lhy1024 marked this conversation as resolved.
Show resolved Hide resolved
}
}
reqData, err := json.Marshal(data)
if err != nil {
return err
Expand Down
Loading