Skip to content

Commit

Permalink
playground: add data-dir to ticdc (#1631)
Browse files Browse the repository at this point in the history
  • Loading branch information
nexustar authored Nov 22, 2021
1 parent 6b1719c commit d4de166
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/playground/instance/ticdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"strings"

"github.com/pingcap/tiup/pkg/utils"
"golang.org/x/mod/semver"
)

// TiCDC represent a ticdc instance.
Expand Down Expand Up @@ -59,6 +60,15 @@ 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)
if semver.Compare(clusterVersion, "v4.0.13") >= 0 {
if (semver.Major(clusterVersion) == "v4" && semver.Compare(clusterVersion, "v4.0.14") >= 0) ||
(semver.Major(clusterVersion) == "v5" && semver.Compare(clusterVersion, "v5.0.3") >= 0) {
args = append(args, fmt.Sprintf("--data-dir=%s", filepath.Join(c.Dir, "data")))
} else {
args = append(args, fmt.Sprintf("--sort-dir=%s/tmp/sorter", filepath.Join(c.Dir, "data")))
}
}

var err error
if c.Process, err = NewComponentProcess(ctx, c.Dir, c.BinPath, "cdc", version, args...); err != nil {
Expand Down

0 comments on commit d4de166

Please sign in to comment.