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

Support refresh configuration only when reload #625

Merged
merged 1 commit into from
Jul 24, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions components/cluster/command/reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
)

func newReloadCmd() *cobra.Command {
var skipRestart bool
cmd := &cobra.Command{
Use: "reload <cluster-name>",
Short: "Reload a TiDB cluster's config and restart if needed",
Expand Down Expand Up @@ -59,7 +60,7 @@ func newReloadCmd() *cobra.Command {
return err
}

t, err := buildReloadTask(clusterName, metadata, gOpt)
t, err := buildReloadTask(clusterName, metadata, gOpt, skipRestart)
if err != nil {
return err
}
Expand All @@ -83,6 +84,7 @@ func newReloadCmd() *cobra.Command {
cmd.Flags().StringSliceVarP(&gOpt.Nodes, "node", "N", nil, "Only start specified nodes")
cmd.Flags().Int64Var(&gOpt.APITimeout, "transfer-timeout", 300, "Timeout in seconds when transferring PD and TiKV store leaders")
cmd.Flags().BoolVarP(&gOpt.IgnoreConfigCheck, "ignore-config-check", "", false, "Ignore the config check result")
cmd.Flags().BoolVar(&skipRestart, "skip-restart", false, "Only refresh configuration to remote and do not restart services")

return cmd
}
Expand All @@ -91,6 +93,7 @@ func buildReloadTask(
clusterName string,
metadata *spec.ClusterMeta,
options operator.Options,
skipRestart bool,
) (task.Task, error) {

var refreshConfigTasks []task.Task
Expand Down Expand Up @@ -146,16 +149,16 @@ func buildReloadTask(
}
}

t := task.NewBuilder().
tb := task.NewBuilder().
SSHKeySet(
spec.ClusterPath(clusterName, "ssh", "id_rsa"),
spec.ClusterPath(clusterName, "ssh", "id_rsa.pub")).
ClusterSSH(metadata.Topology, metadata.User, gOpt.SSHTimeout).
Parallel(refreshConfigTasks...).
ClusterOperate(metadata.Topology, operator.UpgradeOperation, options).
Build()

return t, nil
Parallel(refreshConfigTasks...)
if !skipRestart {
tb = tb.ClusterOperate(metadata.Topology, operator.UpgradeOperation, options)
}
return tb.Build(), nil
}

func validRoles(roles []string) error {
Expand Down
2 changes: 2 additions & 0 deletions tests/tiup-cluster/script/scale_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ function scale_core() {

tiup-cluster display $name

tiup-cluster reload $name --skip-restart

total_sub_one=18

echo "start scale in tidb"
Expand Down