Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kaaaaaaang committed Oct 17, 2023
1 parent cda0829 commit 8626df3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/cluster/manager/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (m *Manager) Patch(name string, packagePath string, opt operator.Options, o
return nil
}
// TBD: should patch be treated as an upgrade?
return operator.Upgrade(ctx, topo, opt, tlsCfg, base.Version, false)
return operator.Upgrade(ctx, topo, opt, tlsCfg, base.Version, base.Version)
}).
Build()

Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/manager/reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (m *Manager) Reload(name string, gOpt operator.Options, skipRestart, skipCo
return err
}
b.Func("Upgrade Cluster", func(ctx context.Context) error {
return operator.Upgrade(ctx, topo, gOpt, tlsCfg, base.Version, false)
return operator.Upgrade(ctx, topo, gOpt, tlsCfg, base.Version, base.Version)
})
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/manager/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ Do you want to continue? [y/N]:`,
if offline {
return nil
}
return operator.Upgrade(ctx, topo, opt, tlsCfg, base.Version, true)
return operator.Upgrade(ctx, topo, opt, tlsCfg, base.Version, clusterVersion)
}).
Build()

Expand Down
6 changes: 3 additions & 3 deletions pkg/cluster/operation/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func Upgrade(
options Options,
tlsCfg *tls.Config,
currentVersion string,
isUpgrade bool,
targetVersion string,
) error {
roleFilter := set.NewStringSet(options.Roles...)
nodeFilter := set.NewStringSet(options.Nodes...)
Expand Down Expand Up @@ -109,7 +109,7 @@ func Upgrade(
endpoints = append(endpoints, utils.JoinHostPort(db.GetManageHost(), db.StatusPort))
}

if isUpgrade && tidbver.TiDBSupportUpgradeAPI(currentVersion) {
if currentVersion != targetVersion && tidbver.TiDBSupportUpgradeAPI(currentVersion) && tidbver.TiDBSupportUpgradeAPI(targetVersion) {
tidbClient = api.NewTiDBClient(ctx, endpoints, 10*time.Second, tlsCfg)
err = tidbClient.StartUpgrade()
if err != nil {
Expand Down Expand Up @@ -198,7 +198,7 @@ func Upgrade(

switch component.Name() {
case spec.ComponentTiDB:
if isUpgrade && tidbver.TiDBSupportUpgradeAPI(currentVersion) {
if currentVersion != targetVersion && tidbver.TiDBSupportUpgradeAPI(currentVersion) && tidbver.TiDBSupportUpgradeAPI(targetVersion) {
err = tidbClient.FinishUpgrade()
if err != nil {
return err
Expand Down

0 comments on commit 8626df3

Please sign in to comment.