Skip to content

Commit

Permalink
Fix upgrade order
Browse files Browse the repository at this point in the history
Signed-off-by: hi-rustin <[email protected]>
  • Loading branch information
Rustin170506 committed Jul 28, 2023
1 parent d43c0ae commit 06ef8a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions pkg/manager/member/pd_upgrader.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ func (u *pdUpgrader) gracefulUpgrade(tc *v1alpha1.TidbCluster, oldSet *apps.Stat
if !tc.Status.PD.Synced {
return fmt.Errorf("tidbcluster: [%s/%s]'s pd status sync failed, can not to be upgraded", ns, tcName)
}
if tc.PDScaling() {
klog.Infof("TidbCluster: [%s/%s]'s pd status is %v, can not upgrade pd",
ns, tcName, tc.Status.PD.Phase)
if tc.Status.TiCDC.Phase == v1alpha1.UpgradePhase || tc.Status.TiCDC.Phase == v1alpha1.ScalePhase ||
tc.PDScaling() {
klog.Infof("TidbCluster: [%s/%s]'s ticdc status is %v, pd status is %v, can not upgrade pd",
ns, tcName, tc.Status.TiCDC.Phase, tc.Status.PD.Phase)
_, podSpec, err := GetLastAppliedConfig(oldSet)
if err != nil {
return err
Expand Down
5 changes: 3 additions & 2 deletions pkg/manager/member/tidb_upgrader.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ func (u *tidbUpgrader) Upgrade(tc *v1alpha1.TidbCluster, oldSet *apps.StatefulSe
tc.Status.TiKV.Phase == v1alpha1.UpgradePhase || tc.Status.TiKV.Phase == v1alpha1.ScalePhase ||
tc.Status.TiFlash.Phase == v1alpha1.UpgradePhase || tc.Status.TiFlash.Phase == v1alpha1.ScalePhase ||
tc.Status.Pump.Phase == v1alpha1.UpgradePhase || tc.Status.Pump.Phase == v1alpha1.ScalePhase ||
tc.Status.TiCDC.Phase == v1alpha1.UpgradePhase || tc.Status.TiCDC.Phase == v1alpha1.ScalePhase ||
tc.TiDBScaling() {
klog.Infof("TidbCluster: [%s/%s]'s pd status is %s, "+
"tikv status is %s, tiflash status is %s, pump status is %s, "+
"tidb status is %s, can not upgrade tidb",
"tidb status is %s, ticdc status is %s, can not upgrade tidb",
ns, tcName,
tc.Status.PD.Phase, tc.Status.TiKV.Phase, tc.Status.TiFlash.Phase,
tc.Status.Pump.Phase, tc.Status.TiDB.Phase)
tc.Status.Pump.Phase, tc.Status.TiDB.Phase, tc.Status.TiCDC.Phase)
_, podSpec, err := GetLastAppliedConfig(oldSet)
if err != nil {
return err
Expand Down
3 changes: 3 additions & 0 deletions pkg/manager/member/tikv_upgrader.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ func getStoreByOrdinal(name string, status v1alpha1.TiKVStatus, ordinal int32) *
}

func (u *tikvUpgrader) isTiKVReadyToUpgrade(tc *v1alpha1.TidbCluster) string {
if tc.Status.TiCDC.Phase == v1alpha1.UpgradePhase || tc.Status.TiCDC.Phase == v1alpha1.ScalePhase {
return fmt.Sprintf("ticdc status is %s", tc.Status.TiCDC.Phase)
}
if tc.Status.TiFlash.Phase == v1alpha1.UpgradePhase || tc.Status.TiFlash.Phase == v1alpha1.ScalePhase {
return fmt.Sprintf("tiflash status is %s", tc.Status.TiFlash.Phase)
}
Expand Down

0 comments on commit 06ef8a0

Please sign in to comment.