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

mkdir for raftdb-path #2198

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion pkg/cluster/manager/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ func buildScaleOutTask(
tb := task.NewSimpleUerSSH(m.logger, inst.GetManageHost(), inst.GetSSHPort(), base.User, gOpt, p, sshType).
Mkdir(base.User, inst.GetManageHost(), deployDirs...).
Mkdir(base.User, inst.GetManageHost(), dataDirs...).
Mkdir(base.User, inst.GetManageHost(), logDir)
Mkdir(base.User, inst.GetManageHost(), logDir).
Mkdir(base.User, inst.GetManageHost(), inst.ExtraDirs()...)

srcPath := ""
if patchedComponents.Exist(inst.ComponentName()) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/cluster/manager/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ func (m *Manager) Deploy(

t := task.NewSimpleUerSSH(m.logger, inst.GetManageHost(), inst.GetSSHPort(), globalOptions.User, gOpt, sshProxyProps, globalOptions.SSHType).
Mkdir(globalOptions.User, inst.GetManageHost(), deployDirs...).
Mkdir(globalOptions.User, inst.GetManageHost(), dataDirs...)
Mkdir(globalOptions.User, inst.GetManageHost(), dataDirs...).
Mkdir(globalOptions.User, inst.GetManageHost(), inst.ExtraDirs()...)

if deployerInstance, ok := inst.(DeployerInstance); ok {
deployerInstance.Deploy(t, "", deployDir, version, name, clusterVersion)
Expand Down
5 changes: 5 additions & 0 deletions pkg/cluster/spec/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ type Instance interface {
GetNumaNode() string
GetNumaCores() string
DeployDir() string
ExtraDirs() []string
UsedPorts() []int
UsedDirs() []string
Status(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, pdList ...string) string
Expand Down Expand Up @@ -393,6 +394,10 @@ func (i *BaseInstance) DeployDir() string {
return reflect.Indirect(reflect.ValueOf(i.InstanceSpec)).FieldByName("DeployDir").String()
}

func (i *BaseInstance) ExtraDirs() []string {
return nil
}

// TLSDir implements Instance interface
func (i *BaseInstance) TLSDir() string {
return i.DeployDir()
Expand Down
10 changes: 10 additions & 0 deletions pkg/cluster/spec/tikv.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"net/url"
"os"
"path/filepath"
"reflect"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -461,6 +462,15 @@ func (i *TiKVInstance) PostRestart(ctx context.Context, topo Topology, tlsCfg *t
return nil
}

func (i *TiKVInstance) ExtraDirs() []string {
configMap := reflect.Indirect(reflect.ValueOf(i.InstanceSpec)).FieldByName("Config").Interface().(map[string]interface{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

spec := i.InstanceSpec.(*TiKVSpec)
raftDir := spec.Config["raftstore.raftdb-path"]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

raftDir := configMap["raftstore.raftdb-path"]
if raftDir == nil {
return nil
}
return []string{raftDir.(string)}
}

func addr(spec *TiKVSpec) string {
if spec.AdvertiseAddr != "" {
return spec.AdvertiseAddr
Expand Down
Loading