From bb072ef732e5cd098882a0af1efad121530e23ce Mon Sep 17 00:00:00 2001 From: 9547 Date: Fri, 13 Nov 2020 16:46:47 +0800 Subject: [PATCH] cluster: enable service after scale out (#905) --- components/cluster/command/scale_out.go | 24 +----------------------- tests/tiup-cluster/script/scale_core.sh | 4 +++- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/components/cluster/command/scale_out.go b/components/cluster/command/scale_out.go index 5a61ee2756..d504287a4b 100644 --- a/components/cluster/command/scale_out.go +++ b/components/cluster/command/scale_out.go @@ -14,14 +14,11 @@ package command import ( - "context" "io/ioutil" "path/filepath" "github.com/pingcap/tiup/pkg/cluster" "github.com/pingcap/tiup/pkg/cluster/executor" - operator "github.com/pingcap/tiup/pkg/cluster/operation" - "github.com/pingcap/tiup/pkg/cluster/report" "github.com/pingcap/tiup/pkg/cluster/spec" "github.com/pingcap/tiup/pkg/cluster/task" "github.com/pingcap/tiup/pkg/utils" @@ -78,15 +75,6 @@ func newScaleOutCmd() *cobra.Command { return cmd } -// Deprecated -func convertStepDisplaysToTasks(t []*task.StepDisplay) []task.Task { - tasks := make([]task.Task, 0, len(t)) - for _, sd := range t { - tasks = append(tasks, sd) - } - return tasks -} - func final(builder *task.Builder, name string, meta spec.Metadata) { builder.UpdateTopology(name, tidbSpec.Path(name), @@ -96,15 +84,5 @@ func final(builder *task.Builder, name string, meta spec.Metadata) { } func postScaleOutHook(builder *task.Builder, newPart spec.Topology) { - nodeInfoTask := task.NewBuilder().Func("Check status", func(ctx *task.Context) error { - var err error - teleNodeInfos, err = operator.GetNodeInfo(context.Background(), ctx, newPart) - _ = err - // intend to never return error - return nil - }).BuildAsStep("Check status").SetHidden(true) - - if report.Enable() { - builder.Parallel(false, convertStepDisplaysToTasks([]*task.StepDisplay{nodeInfoTask})...) - } + postDeployHook(builder, newPart) } diff --git a/tests/tiup-cluster/script/scale_core.sh b/tests/tiup-cluster/script/scale_core.sh index ef51697588..8936aaccf8 100755 --- a/tests/tiup-cluster/script/scale_core.sh +++ b/tests/tiup-cluster/script/scale_core.sh @@ -46,6 +46,8 @@ function scale_core() { topo=./topo/full_scale_in_tidb.yaml sed "s/__IPPREFIX__/$ipprefix/g" $topo.tpl > $topo tiup-cluster $client --yes scale-out $name $topo + # after scale-out, ensure the service is enabled + tiup-cluster $client exec $name -N $ipprefix.101 --command "systemctl status tidb-4000 | grep Loaded |grep 'enabled; vendor'" # echo "start scale in tikv" # tiup-cluster --yes scale-in $name -N $ipprefix.103:20160 @@ -67,7 +69,7 @@ function scale_core() { topo=./topo/full_scale_in_pd.yaml sed "s/__IPPREFIX__/$ipprefix/g" $topo.tpl > $topo tiup-cluster $client --yes scale-out $name $topo - # after scalue-out, ensure this instance come back + # after scale-out, ensure this instance come back tiup-cluster $client exec $name -N $ipprefix.101 --command "grep -q $ipprefix.103:2379 /home/tidb/deploy/tidb-4000/scripts/run_tidb.sh" echo "start scale in tidb"