Skip to content

Commit

Permalink
remove version
Browse files Browse the repository at this point in the history
Signed-off-by: husharp <[email protected]>
  • Loading branch information
HuSharp committed Dec 19, 2023
1 parent c452cda commit d780444
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion components/playground/instance/drainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (d *Drainer) NodeID() string {
}

// Start implements Instance interface.
func (d *Drainer) Start(ctx context.Context, version utils.Version) error {
func (d *Drainer) Start(ctx context.Context) error {
endpoints := pdEndpoints(d.pds, true)

args := []string{
Expand Down
4 changes: 3 additions & 1 deletion components/playground/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type instance struct {
StatusPort int // client port for PD
ConfigPath string
BinPath string
Version utils.Version
}

// MetricAddr will be used by prometheus scrape_configs.
Expand All @@ -59,7 +60,7 @@ type Instance interface {
Pid() int
// Start the instance process.
// Will kill the process once the context is done.
Start(ctx context.Context, version utils.Version) error
Start(ctx context.Context) error
// Component Return the component name.
Component() string
// LogFile return the log file name
Expand Down Expand Up @@ -88,6 +89,7 @@ func (inst *instance) PrepareBinary(componentName string, version utils.Version)
return "", err
}
inst.BinPath = instanceBinPath
inst.Version = version
return instanceBinPath, nil
}

Expand Down
2 changes: 1 addition & 1 deletion components/playground/instance/pd.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (inst *PDInstance) Name() string {
}

// Start calls set inst.cmd and Start
func (inst *PDInstance) Start(ctx context.Context, version utils.Version) error {
func (inst *PDInstance) Start(ctx context.Context) error {
uid := inst.Name()
var args []string
switch inst.Role {
Expand Down
2 changes: 1 addition & 1 deletion components/playground/instance/pump.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (p *Pump) Addr() string {
}

// Start implements Instance interface.
func (p *Pump) Start(ctx context.Context, version utils.Version) error {
func (p *Pump) Start(ctx context.Context) error {
endpoints := pdEndpoints(p.pds, true)

args := []string{
Expand Down
4 changes: 2 additions & 2 deletions components/playground/instance/ticdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func NewTiCDC(binPath string, dir, host, configPath string, id int, port int, pd
}

// Start implements Instance interface.
func (c *TiCDC) Start(ctx context.Context, version utils.Version) error {
func (c *TiCDC) Start(ctx context.Context) error {
endpoints := pdEndpoints(c.pds, true)

args := []string{
Expand All @@ -63,7 +63,7 @@ func (c *TiCDC) Start(ctx context.Context, version utils.Version) error {
fmt.Sprintf("--pd=%s", strings.Join(endpoints, ",")),
fmt.Sprintf("--log-file=%s", c.LogFile()),
}
clusterVersion := string(version)
clusterVersion := string(c.Version)
if tidbver.TiCDCSupportConfigFile(clusterVersion) {
if c.ConfigPath != "" {
args = append(args, fmt.Sprintf("--config=%s", c.ConfigPath))
Expand Down
2 changes: 1 addition & 1 deletion components/playground/instance/tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewTiDBInstance(binPath string, dir, host, configPath string, id, port int,
}

// Start calls set inst.cmd and Start
func (inst *TiDBInstance) Start(ctx context.Context, version utils.Version) error {
func (inst *TiDBInstance) Start(ctx context.Context) error {
configPath := filepath.Join(inst.Dir, "tidb.toml")
if err := prepareConfig(
configPath,
Expand Down
6 changes: 3 additions & 3 deletions components/playground/instance/tiflash.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ func (inst *TiFlashInstance) StatusAddrs() (addrs []string) {
}

// Start calls set inst.cmd and Start
func (inst *TiFlashInstance) Start(ctx context.Context, version utils.Version) error {
if !tidbver.TiFlashPlaygroundNewStartMode(version.String()) {
return inst.startOld(ctx, version)
func (inst *TiFlashInstance) Start(ctx context.Context) error {
if !tidbver.TiFlashPlaygroundNewStartMode(inst.Version.String()) {
return inst.startOld(ctx, inst.Version)
}

proxyConfigPath := filepath.Join(inst.Dir, "tiflash_proxy.toml")
Expand Down
2 changes: 1 addition & 1 deletion components/playground/instance/tikv.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (inst *TiKVInstance) Addr() string {
}

// Start calls set inst.cmd and Start
func (inst *TiKVInstance) Start(ctx context.Context, version utils.Version) error {
func (inst *TiKVInstance) Start(ctx context.Context) error {
configPath := filepath.Join(inst.Dir, "tikv.toml")
if err := prepareConfig(
configPath,
Expand Down
2 changes: 1 addition & 1 deletion components/playground/instance/tikv_cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewTiKVCDC(binPath string, dir, host, configPath string, id int, pds []*PDI
}

// Start implements Instance interface.
func (c *TiKVCDC) Start(ctx context.Context, version utils.Version) error {
func (c *TiKVCDC) Start(ctx context.Context) error {
endpoints := pdEndpoints(c.pds, true)

args := []string{
Expand Down
2 changes: 1 addition & 1 deletion components/playground/instance/tiproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (c *TiProxy) MetricAddr() (r MetricAddr) {
}

// Start implements Instance interface.
func (c *TiProxy) Start(ctx context.Context, version utils.Version) error {
func (c *TiProxy) Start(ctx context.Context) error {
endpoints := pdEndpoints(c.pds, true)

configPath := filepath.Join(c.Dir, "config", "proxy.toml")
Expand Down
4 changes: 2 additions & 2 deletions components/playground/playground.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,13 +446,13 @@ func (p *Playground) startInstance(ctx context.Context, inst instance.Instance)
return err
}

instanceBinPath, err := inst.PrepareBinary(inst.Component(), version)
instanceBinPath, err := inst.PrepareBinary(component, version)
if err != nil {
return err
}
fmt.Printf("Start %s instance:%s\n", inst.Component(), instanceBinPath)

err = inst.Start(ctx, version)
err = inst.Start(ctx)
if err != nil {
return err
}
Expand Down

0 comments on commit d780444

Please sign in to comment.