Skip to content

Commit

Permalink
cluster: enable service after scale out (#905)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsvisa authored Nov 13, 2020
1 parent 92d6fab commit bb072ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
24 changes: 1 addition & 23 deletions components/cluster/command/scale_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
Expand All @@ -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)
}
4 changes: 3 additions & 1 deletion tests/tiup-cluster/script/scale_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit bb072ef

Please sign in to comment.