pingcap / tidb-operator

TiDB operator creates and manages TiDB clusters running in Kubernetes.
https://docs.pingcap.com/tidb-in-kubernetes/
Apache License 2.0
1.22k stars 489 forks source link

Is it possible to customize the upgrade sequence for different versions of a component? #4966

Open Rustin170506 opened 1 year ago

Rustin170506 commented 1 year ago

Feature Request

Is your feature request related to a problem? Please describe: We want to change the upgrade order for TiCDC, but we meet some compliable issues for different versions of TiCDC. If TiCDC < 5.1.0, we want to upgrade tikv/pd first. If TiCDC >= 5.1.0, we want to upgrade tikv/pd first.

You can see more in this doc. (In Chinese)

Describe the feature you'd like: Support customizing the upgrade sequence for different versions of a component. Now we have a fixed order: https://github.com/pingcap/tidb-operator/blob/80214d04e975f3967649707be693662fa2fa5270/pkg/manager/member/ticdc_upgrader.go#L50

Why the featue is needed: We want to upgrade the ticdc first because the TiKV will make a breaking change. Then TiCDC can not connect to the new TiCDC if we upgrade TiKV first.

Describe alternatives you've considered: None Teachability, Documentation, Adoption, Migration Strategy: None

Rustin170506 commented 1 year ago

@KanShiori Could you please take a look? What do you think about this feature? Thanks!

csuzhangxc commented 1 year ago

Support customizing the upgrade sequence for different versions of a component.

Any suggestion about how to customize the order from the users' side?

Rustin170506 commented 1 year ago

Support customizing the upgrade sequence for different versions of a component.

Any suggestion about how to customize the order from the users' side?

I meant we can hardcode for it. Do you think it is acceptable?

csuzhangxc commented 1 year ago

Support customizing the upgrade sequence for different versions of a component.

Any suggestion about how to customize the order from the users' side?

I meant we can hardcode for it. Do you think it is acceptable?

As TiCDC needs this, I think it's acceptable.

Rustin170506 commented 1 year ago

In terms of compatibility, TiUP and TiDB Operator need to support different upgrade order with 5.1.0 as the boundary.

If the current cluster version is greater than or equal to 5.1.0, TiCDC is upgraded first. If the current cluster version is less than 5.1.0, upgrade PD and TiKV first.

You can find more information at pingcap.feishu.cn/docx/Nq9sdD44aorYeTxYo2gcZd9LnFU.

csuzhangxc commented 1 year ago

@grovecai PTAL

csuzhangxc commented 1 year ago

@hi-rustin the components update order is defined in https://github.com/pingcap/tidb-operator/blob/ae97a5724bc4e70c04d1cbf3f9b749c279035639/pkg/controller/tidbcluster/tidb_cluster_control.go#L147

and for the new version, it can be extracted with https://github.com/pingcap/tidb-operator/blob/ae97a5724bc4e70c04d1cbf3f9b749c279035639/pkg/apis/pingcap/v1alpha1/tidbcluster.go#L126

but for the old version, a similar approach can be used to get from the old StatefulSet.