Skip to content

Commit

Permalink
Small bug fix for volume replace (#5303)
Browse files Browse the repository at this point in the history
Co-authored-by: Anish Shankar <anish.shankar@databricks.com>
Co-authored-by: Xuecheng Zhang <csuzhangxc@gmail.com>
  • Loading branch information
3 people authored Sep 28, 2023
1 parent 52e1c7c commit 4e1ca0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions pkg/controller/tidbcluster/pod_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ func (c *PodController) getPDClient(tc *v1alpha1.TidbCluster) pdapi.PDClient {
}

func (c *PodController) syncPDPod(ctx context.Context, pod *corev1.Pod, tc *v1alpha1.TidbCluster) (reconcile.Result, error) {
result, err := c.syncPDPodForLeaderTransfer(ctx, pod, tc)
result, err := c.syncPDPodForReplaceVolume(ctx, pod, tc)
if err != nil || result.Requeue || result.RequeueAfter > 0 {
return result, err
}
return c.syncPDPodForReplaceVolume(ctx, pod, tc)
return c.syncPDPodForLeaderTransfer(ctx, pod, tc)
}

func (c *PodController) syncPDPodForLeaderTransfer(ctx context.Context, pod *corev1.Pod, tc *v1alpha1.TidbCluster) (reconcile.Result, error) {
Expand Down Expand Up @@ -363,11 +363,11 @@ func (c *PodController) syncPDPodForReplaceVolume(ctx context.Context, pod *core
}

func (c *PodController) syncTiKVPod(ctx context.Context, pod *corev1.Pod, tc *v1alpha1.TidbCluster) (reconcile.Result, error) {
result, err := c.syncTiKVPodForEviction(ctx, pod, tc)
result, err := c.syncTiKVPodForReplaceVolume(ctx, pod, tc)
if err != nil || result.Requeue || result.RequeueAfter > 0 {
return result, err
}
return c.syncTiKVPodForReplaceVolume(ctx, pod, tc)
return c.syncTiKVPodForEviction(ctx, pod, tc)
}

func (c *PodController) syncTiKVPodForEviction(ctx context.Context, pod *corev1.Pod, tc *v1alpha1.TidbCluster) (reconcile.Result, error) {
Expand Down Expand Up @@ -568,11 +568,11 @@ func (c *PodController) syncTiKVPodForReplaceVolume(ctx context.Context, pod *co
}

func (c *PodController) syncTiDBPod(ctx context.Context, pod *corev1.Pod, tc *v1alpha1.TidbCluster) (reconcile.Result, error) {
result, err := c.syncTiDBPodForGracefulShutdown(ctx, pod, tc)
result, err := c.syncTiDBPodForReplaceVolume(ctx, pod, tc)
if err != nil || result.Requeue || result.RequeueAfter > 0 {
return result, err
}
return c.syncTiDBPodForReplaceVolume(ctx, pod, tc)
return c.syncTiDBPodForGracefulShutdown(ctx, pod, tc)
}

func (c *PodController) syncTiDBPodForGracefulShutdown(ctx context.Context, pod *corev1.Pod, tc *v1alpha1.TidbCluster) (reconcile.Result, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/volumes/pvc_modifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (p *pvcModifier) tryToRecreateSTS(ctx *componentVolumeContext) error {
// Modifier does not support new volumes, trigger error if so and return.
isSynced, err := p.utils.IsStatefulSetSynced(ctx, ctx.sts)
if err != nil {
return fmt.Errorf("change in number of volumes is not supported without VolumeReplacing feature. Reconciliation is blocked due to : %s", err.Error())
return fmt.Errorf("change in number of volumes is not supported. For pd, tikv, tidb supported with VolumeReplacing feature. Reconciliation is blocked due to : %s", err.Error())
}
if isSynced {
return nil
Expand Down

0 comments on commit 4e1ca0c

Please sign in to comment.