Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt: keep ports config for TiFlash 7.1.0+ to avoid restarting #5223

Merged
merged 2 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/apis/label/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ const (
// when TiDB cluster is restored from volume snapshot based backup.
AnnTiKVVolumesReadyKey = "tidb.pingcap.com/tikv-volumes-ready"

// AnnoTiFlash710KeepPortsKey is the annotation key to indicate whether the TiFlash v7.1.0+ keeps ports to avoid restart.
// ports: tcp_port, http_port, tcp_port_secure and https_port.
// NOTE: this annotation should only be used for existing TiFlash v7.1.0+ clusters with ports config items.
AnnoTiFlash710KeepPortsKey = "tidb.pingcap.com/tiflash-710-keep-ports"

// PDLabelVal is PD label value
PDLabelVal string = "pd"
// TiDBLabelVal is TiDB label value
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/pingcap/v1alpha1/tidbcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,11 @@ func (tc *TidbCluster) SkipTLSWhenConnectTiDB() bool {
return ok
}

func (tc *TidbCluster) KeepTiFlash710Ports() bool {
_, ok := tc.Annotations[label.AnnoTiFlash710KeepPortsKey]
return ok
}

// TODO: We Should better do not specified the default value ourself if user not specified the item.
func (tc *TidbCluster) TiCDCTimezone() string {
if tc.Spec.TiCDC != nil && tc.Spec.TiCDC.Config != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/manager/member/tiflash_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func getTiFlashConfigV2(tc *v1alpha1.TidbCluster) *v1alpha1.TiFlashConfigWraper
common.SetIfNil("tmp_path", "/data0/tmp")

// port
if ok, err := tiflashEqualOrGreaterThanV710.Check(version); err == nil && !ok {
if ok, err := tiflashEqualOrGreaterThanV710.Check(version); err == nil && !ok || tc.KeepTiFlash710Ports() {
common.SetIfNil("tcp_port", int64(v1alpha1.DefaultTiFlashTcpPort))
common.SetIfNil("http_port", int64(v1alpha1.DefaultTiFlashHttpPort))
}
Expand Down Expand Up @@ -229,7 +229,7 @@ func getTiFlashConfigV2(tc *v1alpha1.TidbCluster) *v1alpha1.TiFlashConfigWraper
common.Set("security.ca_path", path.Join(tiflashCertPath, corev1.ServiceAccountRootCAKey))
common.Set("security.cert_path", path.Join(tiflashCertPath, corev1.TLSCertKey))
common.Set("security.key_path", path.Join(tiflashCertPath, corev1.TLSPrivateKeyKey))
if ok, err := tiflashEqualOrGreaterThanV710.Check(version); err == nil && !ok {
if ok, err := tiflashEqualOrGreaterThanV710.Check(version); err == nil && !ok || tc.KeepTiFlash710Ports() {
common.SetIfNil("tcp_port_secure", int64(v1alpha1.DefaultTiFlashTcpPort))
common.SetIfNil("https_port", int64(v1alpha1.DefaultTiFlashHttpPort))
}
Expand Down
Loading