Skip to content

Commit

Permalink
cluster: change initial_commit_ts to initial-commit-ts (#1776)
Browse files Browse the repository at this point in the history
  • Loading branch information
nexustar authored and AstroProfundis committed Mar 10, 2022
1 parent 5a577eb commit c971f67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/cluster/ansible/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func parseDirs(ctx context.Context, user string, ins spec.InstanceSpec, sshTimeo
tsArg := strings.Split(line, " ")[4] // 4 whitespaces ahead
tmpTs, _ := strconv.Atoi(strings.TrimPrefix(tsArg, "--initial-commit-ts="))
newIns.Config = make(map[string]interface{})
newIns.Config["initial_commit_ts"] = int64(tmpTs)
newIns.Config["initial-commit-ts"] = int64(tmpTs)
}
}
return newIns, nil
Expand Down
8 changes: 4 additions & 4 deletions pkg/cluster/spec/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,16 +870,16 @@ func setHostArch(field reflect.Value, hostArch map[string]string) error {
return nil
}

// when upgrade form old tiup-cluster, replace spec.CommitTS with spec.Config["initial_commit_ts"]
// when upgrade form old tiup-cluster, replace spec.CommitTS with spec.Config["initial-commit-ts"]
func (s *Specification) removeCommitTS() {
_, ok1 := s.ServerConfigs.Drainer["initial_commit_ts"]
_, ok1 := s.ServerConfigs.Drainer["initial-commit-ts"]
for _, spec := range s.Drainers {
_, ok2 := spec.Config["initial_commit_ts"]
_, ok2 := spec.Config["initial-commit-ts"]
if !ok1 && !ok2 && spec.CommitTS != nil && *spec.CommitTS != -1 {
if spec.Config == nil {
spec.Config = make(map[string]interface{})
}
spec.Config["initial_commit_ts"] = *spec.CommitTS
spec.Config["initial-commit-ts"] = *spec.CommitTS
}
spec.CommitTS = nil
}
Expand Down

0 comments on commit c971f67

Please sign in to comment.