Skip to content

Commit

Permalink
cluster: fix tiproxy will restart even if version is the same (#2358)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhebox authored and nexustar committed Jan 12, 2024
1 parent 5a8b496 commit 98528eb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/cluster/manager/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,17 @@ func (m *Manager) Upgrade(name string, clusterVersion string, componentVersions
compVersionMsg := ""
for _, comp := range topo.ComponentsByUpdateOrder(base.Version) {
// if component version is not specified, use the cluster version or latest("")
oldver := comp.CalculateVersion(base.Version)
version := componentVersions[comp.Name()]
if version != "" {
comp.SetVersion(version)
}
if len(comp.Instances()) > 0 {
compVersionMsg += fmt.Sprintf("\nwill upgrade component %19s to \"%s\",", "\""+comp.Name()+"\"", comp.CalculateVersion(clusterVersion))
calver := comp.CalculateVersion(clusterVersion)
if comp.Role() != spec.ComponentTiProxy || calver != oldver {
opt.Roles = append(opt.Roles, comp.Role())
if len(comp.Instances()) > 0 {
compVersionMsg += fmt.Sprintf("\nwill upgrade and restart component \"%19s\" to \"%s\",", comp.Name(), calver)
}
}
}
monitoredOptions := topo.GetMonitoredOptions()
Expand Down

0 comments on commit 98528eb

Please sign in to comment.