From aac2b9ec65cbd108676499bfa7c8be82bd8c1cf7 Mon Sep 17 00:00:00 2001 From: ti-srebot <66930949+ti-srebot@users.noreply.github.com> Date: Fri, 3 Sep 2021 10:38:14 +0800 Subject: [PATCH] Sync TiCDC after TiDB (#4171) (#4178) --- .../tidbcluster/tidb_cluster_control.go | 14 +-- pkg/manager/member/pd_upgrader.go | 9 +- pkg/manager/member/pd_upgrader_test.go | 15 --- pkg/manager/member/pump_member_manager.go | 9 +- pkg/manager/member/ticdc_member_manager.go | 17 ++-- pkg/manager/member/ticdc_upgrader.go | 19 ++++ pkg/manager/member/ticdc_upgrader_test.go | 95 +++++++++++++++++++ pkg/manager/member/tidb_upgrader.go | 7 +- pkg/manager/member/tidb_upgrader_test.go | 10 -- pkg/manager/member/tiflash_upgrader.go | 9 +- pkg/manager/member/tiflash_upgrader_test.go | 22 +---- pkg/manager/member/tikv_upgrader.go | 10 +- pkg/manager/member/tikv_upgrader_test.go | 22 ----- tests/actions.go | 11 +++ tests/e2e/br/br.go | 2 +- 15 files changed, 162 insertions(+), 109 deletions(-) diff --git a/pkg/controller/tidbcluster/tidb_cluster_control.go b/pkg/controller/tidbcluster/tidb_cluster_control.go index 2a924f2cc6f..5aa5f1cf464 100644 --- a/pkg/controller/tidbcluster/tidb_cluster_control.go +++ b/pkg/controller/tidbcluster/tidb_cluster_control.go @@ -161,13 +161,6 @@ func (c *defaultTidbClusterControl) updateTidbCluster(tc *v1alpha1.TidbCluster) return err } - // - waiting for the pd cluster available(pd cluster is in quorum) - // - create or update ticdc deployment - // - sync ticdc cluster status from pd to TidbCluster object - if err := c.ticdcMemberManager.Sync(tc); err != nil { - return err - } - // works that should be done to make the pd cluster current state match the desired state: // - create or update the pd service // - create or update the pd headless service @@ -226,6 +219,13 @@ func (c *defaultTidbClusterControl) updateTidbCluster(tc *v1alpha1.TidbCluster) return err } + // - waiting for the pd cluster available(pd cluster is in quorum) + // - create or update ticdc deployment + // - sync ticdc cluster status from pd to TidbCluster object + if err := c.ticdcMemberManager.Sync(tc); err != nil { + return err + } + // syncing the labels from Pod to PVC and PV, these labels include: // - label.StoreIDLabelKey // - label.MemberIDLabelKey diff --git a/pkg/manager/member/pd_upgrader.go b/pkg/manager/member/pd_upgrader.go index d2d4a8bc6e2..d6c7b07cb06 100644 --- a/pkg/manager/member/pd_upgrader.go +++ b/pkg/manager/member/pd_upgrader.go @@ -44,12 +44,9 @@ 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.Status.TiCDC.Phase == v1alpha1.UpgradePhase || - 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) + if tc.PDScaling() { + klog.Infof("TidbCluster: [%s/%s]'s pd status is %v, can not upgrade pd", + ns, tcName, tc.Status.PD.Phase) _, podSpec, err := GetLastAppliedConfig(oldSet) if err != nil { return err diff --git a/pkg/manager/member/pd_upgrader_test.go b/pkg/manager/member/pd_upgrader_test.go index 7f959da891f..7a017cd7c10 100644 --- a/pkg/manager/member/pd_upgrader_test.go +++ b/pkg/manager/member/pd_upgrader_test.go @@ -258,21 +258,6 @@ func TestPDUpgraderUpgrade(t *testing.T) { g.Expect(newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(pointer.Int32Ptr(2))) }, }, - { - name: "pd can not upgrade when cdc is upgrading", - changeFn: func(tc *v1alpha1.TidbCluster) { - tc.Status.TiCDC.Phase = v1alpha1.UpgradePhase - tc.Status.PD.Synced = true - }, - changePods: nil, - errExpectFn: func(g *GomegaWithT, err error) { - g.Expect(err).NotTo(HaveOccurred()) - }, - expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet) { - g.Expect(tc.Status.PD.Phase).To(Equal(v1alpha1.NormalPhase)) - g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(3))) - }, - }, } for i := range tests { diff --git a/pkg/manager/member/pump_member_manager.go b/pkg/manager/member/pump_member_manager.go index 8101a1c666b..e8e6319c95f 100644 --- a/pkg/manager/member/pump_member_manager.go +++ b/pkg/manager/member/pump_member_manager.go @@ -114,14 +114,13 @@ func (m *pumpMemberManager) syncPumpStatefulSetForTidbCluster(tc *v1alpha1.TidbC } // Wait for PD & TiKV upgrading done - if tc.Status.TiCDC.Phase == v1alpha1.UpgradePhase || - tc.Status.TiFlash.Phase == v1alpha1.UpgradePhase || + if tc.Status.TiFlash.Phase == v1alpha1.UpgradePhase || tc.Status.PD.Phase == v1alpha1.UpgradePhase || tc.Status.TiKV.Phase == v1alpha1.UpgradePhase { - klog.Infof("TidbCluster: [%s/%s]'s ticdc status is %s, tiflash status is %s, "+ + klog.Infof("TidbCluster: [%s/%s]'s tiflash status is %s, "+ "pd status is %s, tikv status is %s, can not upgrade pump", - tc.Namespace, tc.Name, tc.Status.TiCDC.Phase, tc.Status.TiFlash.Phase, - tc.Status.PD.Phase, tc.Status.TiKV.Phase) + tc.Namespace, tc.Name, + tc.Status.TiFlash.Phase, tc.Status.PD.Phase, tc.Status.TiKV.Phase) return nil } diff --git a/pkg/manager/member/ticdc_member_manager.go b/pkg/manager/member/ticdc_member_manager.go index 55359d79c11..8923e80a9ee 100644 --- a/pkg/manager/member/ticdc_member_manager.go +++ b/pkg/manager/member/ticdc_member_manager.go @@ -121,16 +121,9 @@ func (m *ticdcMemberManager) syncTiCDCConfigMap(tc *v1alpha1.TidbCluster, set *a // Sync fulfills the manager.Manager interface func (m *ticdcMemberManager) Sync(tc *v1alpha1.TidbCluster) error { - ns := tc.GetNamespace() - tcName := tc.GetName() - if tc.Spec.TiCDC == nil { return nil } - if tc.Spec.Paused { - klog.Infof("TidbCluster %s/%s is paused, skip syncing ticdc deployment", ns, tcName) - return nil - } // Sync CDC Headless Service if err := m.syncCDCHeadlessService(tc); err != nil { @@ -158,6 +151,11 @@ func (m *ticdcMemberManager) syncStatefulSet(tc *v1alpha1.TidbCluster) error { ns, tcName, err) } + if tc.Spec.Paused { + klog.Infof("TidbCluster %s/%s is paused, skip syncing ticdc statefulset", tc.GetNamespace(), tc.GetName()) + return nil + } + cm, err := m.syncTiCDCConfigMap(tc, oldSts) if err != nil { return err @@ -246,6 +244,11 @@ func (m *ticdcMemberManager) syncTiCDCStatus(tc *v1alpha1.TidbCluster, sts *apps } func (m *ticdcMemberManager) syncCDCHeadlessService(tc *v1alpha1.TidbCluster) error { + if tc.Spec.Paused { + klog.Infof("TidbCluster %s/%s is paused, skip syncing ticdc service", tc.GetNamespace(), tc.GetName()) + return nil + } + ns := tc.GetNamespace() tcName := tc.GetName() diff --git a/pkg/manager/member/ticdc_upgrader.go b/pkg/manager/member/ticdc_upgrader.go index bfc1d20f9fd..da16d728cbe 100644 --- a/pkg/manager/member/ticdc_upgrader.go +++ b/pkg/manager/member/ticdc_upgrader.go @@ -44,6 +44,25 @@ func (u *ticdcUpgrader) Upgrade(tc *v1alpha1.TidbCluster, oldSet *apps.StatefulS ns := tc.GetNamespace() tcName := tc.GetName() + if tc.Status.PD.Phase == v1alpha1.UpgradePhase || + tc.Status.TiKV.Phase == v1alpha1.UpgradePhase || + tc.Status.TiFlash.Phase == v1alpha1.UpgradePhase || + tc.Status.Pump.Phase == v1alpha1.UpgradePhase || + tc.Status.TiDB.Phase == v1alpha1.UpgradePhase { + 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 ticdc", + ns, tcName, + tc.Status.PD.Phase, tc.Status.TiKV.Phase, tc.Status.TiFlash.Phase, + tc.Status.Pump.Phase, tc.Status.TiDB.Phase) + _, podSpec, err := GetLastAppliedConfig(oldSet) + if err != nil { + return err + } + newSet.Spec.Template.Spec = *podSpec + return nil + } + tc.Status.TiCDC.Phase = v1alpha1.UpgradePhase if !templateEqual(newSet, oldSet) { return nil diff --git a/pkg/manager/member/ticdc_upgrader_test.go b/pkg/manager/member/ticdc_upgrader_test.go index 183622155e3..bc4453aac17 100644 --- a/pkg/manager/member/ticdc_upgrader_test.go +++ b/pkg/manager/member/ticdc_upgrader_test.go @@ -168,6 +168,101 @@ func TestTiCDCUpgrader_Upgrade(t *testing.T) { g.Expect(newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(pointer.Int32Ptr(1))) }, }, + { + name: "ticdc can not upgrade when pd is upgrading", + changeFn: func(tc *v1alpha1.TidbCluster) { + tc.Status.PD.Phase = v1alpha1.UpgradePhase + tc.Status.TiFlash.Phase = v1alpha1.NormalPhase + tc.Status.TiKV.Phase = v1alpha1.NormalPhase + tc.Status.Pump.Phase = v1alpha1.NormalPhase + tc.Status.TiDB.Phase = v1alpha1.NormalPhase + tc.Status.TiCDC.Synced = true + }, + changeOldSet: func(oldSet *apps.StatefulSet) { + SetStatefulSetLastAppliedConfigAnnotation(oldSet) + }, + errorExpect: false, + expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet) { + g.Expect(tc.Status.TiCDC.Phase).To(Equal(v1alpha1.NormalPhase)) + g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(1))) + }, + }, + { + name: "ticdc can not upgrade when tiflash is upgrading", + changeFn: func(tc *v1alpha1.TidbCluster) { + tc.Status.PD.Phase = v1alpha1.NormalPhase + tc.Status.TiFlash.Phase = v1alpha1.UpgradePhase + tc.Status.TiKV.Phase = v1alpha1.NormalPhase + tc.Status.Pump.Phase = v1alpha1.NormalPhase + tc.Status.TiDB.Phase = v1alpha1.NormalPhase + tc.Status.TiCDC.Synced = true + }, + changeOldSet: func(oldSet *apps.StatefulSet) { + SetStatefulSetLastAppliedConfigAnnotation(oldSet) + }, + errorExpect: false, + expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet) { + g.Expect(tc.Status.TiCDC.Phase).To(Equal(v1alpha1.NormalPhase)) + g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(1))) + }, + }, + { + name: "ticdc can not upgrade when tikv is upgrading", + changeFn: func(tc *v1alpha1.TidbCluster) { + tc.Status.PD.Phase = v1alpha1.NormalPhase + tc.Status.TiFlash.Phase = v1alpha1.NormalPhase + tc.Status.TiKV.Phase = v1alpha1.UpgradePhase + tc.Status.Pump.Phase = v1alpha1.NormalPhase + tc.Status.TiDB.Phase = v1alpha1.NormalPhase + tc.Status.TiCDC.Synced = true + }, + changeOldSet: func(oldSet *apps.StatefulSet) { + SetStatefulSetLastAppliedConfigAnnotation(oldSet) + }, + errorExpect: false, + expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet) { + g.Expect(tc.Status.TiCDC.Phase).To(Equal(v1alpha1.NormalPhase)) + g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(1))) + }, + }, + { + name: "ticdc can not upgrade when pump is upgrading", + changeFn: func(tc *v1alpha1.TidbCluster) { + tc.Status.PD.Phase = v1alpha1.NormalPhase + tc.Status.TiFlash.Phase = v1alpha1.NormalPhase + tc.Status.TiKV.Phase = v1alpha1.NormalPhase + tc.Status.Pump.Phase = v1alpha1.UpgradePhase + tc.Status.TiDB.Phase = v1alpha1.NormalPhase + tc.Status.TiCDC.Synced = true + }, + changeOldSet: func(oldSet *apps.StatefulSet) { + SetStatefulSetLastAppliedConfigAnnotation(oldSet) + }, + errorExpect: false, + expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet) { + g.Expect(tc.Status.TiCDC.Phase).To(Equal(v1alpha1.NormalPhase)) + g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(1))) + }, + }, + { + name: "ticdc can not upgrade when tidb is upgrading", + changeFn: func(tc *v1alpha1.TidbCluster) { + tc.Status.PD.Phase = v1alpha1.NormalPhase + tc.Status.TiFlash.Phase = v1alpha1.NormalPhase + tc.Status.TiKV.Phase = v1alpha1.NormalPhase + tc.Status.Pump.Phase = v1alpha1.NormalPhase + tc.Status.TiDB.Phase = v1alpha1.UpgradePhase + tc.Status.TiCDC.Synced = true + }, + changeOldSet: func(oldSet *apps.StatefulSet) { + SetStatefulSetLastAppliedConfigAnnotation(oldSet) + }, + errorExpect: false, + expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet) { + g.Expect(tc.Status.TiCDC.Phase).To(Equal(v1alpha1.NormalPhase)) + g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(1))) + }, + }, } for _, test := range tests { diff --git a/pkg/manager/member/tidb_upgrader.go b/pkg/manager/member/tidb_upgrader.go index fe241598cd9..795a646270d 100644 --- a/pkg/manager/member/tidb_upgrader.go +++ b/pkg/manager/member/tidb_upgrader.go @@ -44,16 +44,15 @@ func (u *tidbUpgrader) Upgrade(tc *v1alpha1.TidbCluster, oldSet *apps.StatefulSe ns := tc.GetNamespace() tcName := tc.GetName() - if tc.Status.TiCDC.Phase == v1alpha1.UpgradePhase || - tc.Status.PD.Phase == v1alpha1.UpgradePhase || + if tc.Status.PD.Phase == v1alpha1.UpgradePhase || tc.Status.TiKV.Phase == v1alpha1.UpgradePhase || tc.Status.TiFlash.Phase == v1alpha1.UpgradePhase || tc.Status.Pump.Phase == v1alpha1.UpgradePhase || tc.TiDBScaling() { - klog.Infof("TidbCluster: [%s/%s]'s ticdc status is %s, pd status is %s, "+ + 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", - ns, tcName, tc.Status.TiCDC.Phase, + ns, tcName, tc.Status.PD.Phase, tc.Status.TiKV.Phase, tc.Status.TiFlash.Phase, tc.Status.Pump.Phase, tc.Status.TiDB.Phase) _, podSpec, err := GetLastAppliedConfig(oldSet) diff --git a/pkg/manager/member/tidb_upgrader_test.go b/pkg/manager/member/tidb_upgrader_test.go index bcb43265285..886968e935a 100644 --- a/pkg/manager/member/tidb_upgrader_test.go +++ b/pkg/manager/member/tidb_upgrader_test.go @@ -151,16 +151,6 @@ func TestTiDBUpgrader_Upgrade(t *testing.T) { g.Expect(newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(pointer.Int32Ptr(1))) }, }, - { - name: "cdc is upgrading", - changeFn: func(tc *v1alpha1.TidbCluster) { - tc.Status.TiCDC.Phase = v1alpha1.UpgradePhase - }, - getLastAppliedConfigErr: false, - expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet) { - g.Expect(newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(pointer.Int32Ptr(1))) - }, - }, { name: "pump is upgrading", changeFn: func(tc *v1alpha1.TidbCluster) { diff --git a/pkg/manager/member/tiflash_upgrader.go b/pkg/manager/member/tiflash_upgrader.go index 2996dbaa990..d692beacb46 100644 --- a/pkg/manager/member/tiflash_upgrader.go +++ b/pkg/manager/member/tiflash_upgrader.go @@ -39,12 +39,11 @@ func (u *tiflashUpgrader) Upgrade(tc *v1alpha1.TidbCluster, oldSet *apps.Statefu ns := tc.GetNamespace() tcName := tc.GetName() - if tc.Status.TiCDC.Phase == v1alpha1.UpgradePhase || - tc.Status.PD.Phase == v1alpha1.UpgradePhase || + if tc.Status.PD.Phase == v1alpha1.UpgradePhase || tc.TiFlashScaling() { - klog.Infof("TidbCluster: [%s/%s]'s ticdc status is %s, "+ - "pd status is %s, tiflash status is %s, can not upgrade tiflash", ns, tcName, - tc.Status.TiCDC.Phase, tc.Status.PD.Phase, tc.Status.TiFlash.Phase) + klog.Infof("TidbCluster: [%s/%s]'s pd status is %s, tiflash status is %s, can not upgrade tiflash", + ns, tcName, + tc.Status.PD.Phase, tc.Status.TiFlash.Phase) _, podSpec, err := GetLastAppliedConfig(oldSet) if err != nil { return err diff --git a/pkg/manager/member/tiflash_upgrader_test.go b/pkg/manager/member/tiflash_upgrader_test.go index d05c7e7b0ac..4b7fa0ab620 100644 --- a/pkg/manager/member/tiflash_upgrader_test.go +++ b/pkg/manager/member/tiflash_upgrader_test.go @@ -214,26 +214,6 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(3))) }, }, - { - name: "tiflash can not upgrade when cdc is upgrading", - changeFn: func(tc *v1alpha1.TidbCluster) { - tc.Status.TiCDC.Phase = v1alpha1.UpgradePhase - tc.Status.TiFlash.Phase = v1alpha1.NormalPhase - tc.Status.TiFlash.Synced = true - }, - changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) - }, - changePods: nil, - updatePodErr: false, - errExpectFn: func(g *GomegaWithT, err error) { - g.Expect(err).NotTo(HaveOccurred()) - }, - expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet, pods map[string]*corev1.Pod) { - g.Expect(tc.Status.TiFlash.Phase).To(Equal(v1alpha1.NormalPhase)) - g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(3))) - }, - }, { name: "tiflash can not upgrade when pd is upgrading", changeFn: func(tc *v1alpha1.TidbCluster) { @@ -257,7 +237,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { { name: "get last apply config error", changeFn: func(tc *v1alpha1.TidbCluster) { - tc.Status.TiCDC.Phase = v1alpha1.UpgradePhase + tc.Status.PD.Phase = v1alpha1.UpgradePhase tc.Status.TiFlash.Phase = v1alpha1.NormalPhase tc.Status.TiFlash.Synced = true }, diff --git a/pkg/manager/member/tikv_upgrader.go b/pkg/manager/member/tikv_upgrader.go index 4e5d964196b..f163bbcc150 100644 --- a/pkg/manager/member/tikv_upgrader.go +++ b/pkg/manager/member/tikv_upgrader.go @@ -56,15 +56,13 @@ func (u *tikvUpgrader) Upgrade(meta metav1.Object, oldSet *apps.StatefulSet, new var status *v1alpha1.TiKVStatus switch meta := meta.(type) { case *v1alpha1.TidbCluster: - if meta.Status.TiCDC.Phase == v1alpha1.UpgradePhase || - meta.Status.TiFlash.Phase == v1alpha1.UpgradePhase || + if meta.Status.TiFlash.Phase == v1alpha1.UpgradePhase || meta.Status.PD.Phase == v1alpha1.UpgradePhase || meta.TiKVScaling() { - klog.Infof("TidbCluster: [%s/%s]'s ticdc status is %v, "+ - "tiflash status is %v, pd status is %v, "+ + klog.Infof("TidbCluster: [%s/%s]'s tiflash status is %v, pd status is %v, "+ "tikv status is %v, can not upgrade tikv", - ns, tcName, meta.Status.TiCDC.Phase, meta.Status.TiFlash.Phase, - meta.Status.PD.Phase, meta.Status.TiKV.Phase) + ns, tcName, + meta.Status.TiFlash.Phase, meta.Status.PD.Phase, meta.Status.TiKV.Phase) _, podSpec, err := GetLastAppliedConfig(oldSet) if err != nil { return err diff --git a/pkg/manager/member/tikv_upgrader_test.go b/pkg/manager/member/tikv_upgrader_test.go index 48b5bd2ac20..8b50e5f4453 100644 --- a/pkg/manager/member/tikv_upgrader_test.go +++ b/pkg/manager/member/tikv_upgrader_test.go @@ -307,28 +307,6 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(3))) }, }, - { - name: "tikv can not upgrade when cdc is upgrading", - changeFn: func(tc *v1alpha1.TidbCluster) { - tc.Status.TiCDC.Phase = v1alpha1.UpgradePhase - tc.Status.TiKV.Phase = v1alpha1.NormalPhase - tc.Status.TiKV.Synced = true - }, - changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) - }, - changePods: nil, - beginEvictLeaderErr: false, - endEvictLeaderErr: false, - updatePodErr: false, - errExpectFn: func(g *GomegaWithT, err error) { - g.Expect(err).NotTo(HaveOccurred()) - }, - expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet, pods map[string]*corev1.Pod) { - g.Expect(tc.Status.TiKV.Phase).To(Equal(v1alpha1.NormalPhase)) - g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(3))) - }, - }, { name: "tikv can not upgrade when tiflash is upgrading", changeFn: func(tc *v1alpha1.TidbCluster) { diff --git a/tests/actions.go b/tests/actions.go index 16f96d776d1..04875bcb39d 100644 --- a/tests/actions.go +++ b/tests/actions.go @@ -3534,6 +3534,17 @@ func (oa *OperatorActions) cdcMembersReadyFn(tc *v1alpha1.TidbCluster) (bool, er return false, nil } + c, found := getMemberContainer(oa.kubeCli, oa.tcStsGetter, ns, tc.Name, label.TiCDCLabelVal) + if !found { + log.Logf("StatefulSet: %q not found containers[name=ticdc] or pod %s-0", cdcStsID, cdcSetName) + return false, nil + } + + if tc.TiCDCImage() != c.Image { + log.Logf("StatefulSet: %q .spec.template.spec.containers[name=ticdc].image(%s) != %s", cdcStsID, c.Image, tc.TiCDCImage()) + return false, nil + } + if !utilstatefulset.IsAllDesiredPodsRunningAndReady(helper.NewHijackClient(oa.kubeCli, oa.asCli), cdcSet) { return false, nil } diff --git a/tests/e2e/br/br.go b/tests/e2e/br/br.go index 43b40feeea6..54594338241 100644 --- a/tests/e2e/br/br.go +++ b/tests/e2e/br/br.go @@ -37,7 +37,7 @@ import ( var ( tidbReadyTimeout = time.Minute * 5 - backupCompleteTimeout = time.Minute * 3 + backupCompleteTimeout = time.Minute * 5 restoreCompleteTimeout = time.Minute * 5 )