Skip to content

Commit

Permalink
try to fix version issue above.
Browse files Browse the repository at this point in the history
  • Loading branch information
3AceShowHand committed Jun 10, 2021
1 parent 4f5dacc commit d3388e1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/cluster/template/scripts/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,25 @@ func (c *CDCScript) AppendEndpoints(ends ...*PDScript) *CDCScript {

// PatchByVersion update fields by cluster version
func (c *CDCScript) PatchByVersion(clusterVersion, dataDir string) *CDCScript {
// for those version, cdc does not support --data-dir
ignore := map[string]struct{}{
"v5.0.0-rc": {},
"v5.1.0-alpha": {},
}

if _, ok := ignore[clusterVersion]; !ok && semver.Compare(clusterVersion, "v4.0.13") >= 0 {
// config support since v4.0.13, ignore v5.0.0-rc
// the same to data-dir, but we treat it as --sort-dir
if semver.Compare(clusterVersion, "v4.0.13") >= 0 && clusterVersion != "v5.0.0-rc" {
c = c.WithConfigFileEnabled().WithDataDir(dataDir)
}

// cdc support --data-dir since v4.0.14 and v5.0.3, but not the ignore above
if semver.Major(clusterVersion) == "v4" && semver.Compare(clusterVersion, "v4.0.14") >= 0 {
c = c.WithDataDirEnabled()
}

if semver.Compare(clusterVersion, "v4.0.14") >= 0 || semver.Compare(clusterVersion, "v5.0.3") >= 0 {
if semver.Major(clusterVersion) == "v5" && semver.Compare(clusterVersion, "v5.0.3") >= 0 {
if _, ok := ignore[clusterVersion]; !ok {
c = c.WithDataDirEnabled()
}
}
Expand Down

0 comments on commit d3388e1

Please sign in to comment.