Skip to content

Commit 79e9254

Browse files
authored
Merge branch 'feature/v2' into liubo02/support-activate
2 parents ed77a79 + 51428d5 commit 79e9254

File tree

10 files changed

+19
-11
lines changed

10 files changed

+19
-11
lines changed

api/br/v1alpha1/restore_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ type RestoreSpec struct {
130130
StorageProvider `json:",inline"`
131131
// BR is the configs for BR.
132132
BR *BRConfig `json:"br,omitempty"`
133-
134133
// PitrRestoredTs is the pitr restored ts.
134+
// +optional
135135
PitrRestoredTs string `json:"pitrRestoredTs,omitempty"`
136136
// LogRestoreStartTs is the start timestamp which log restore from.
137137
// +optional
@@ -184,6 +184,8 @@ type RestoreSpec struct {
184184
// TolerateSingleTiKVOutage indicates whether to tolerate a single failure of a store without data loss
185185
// +kubebuilder:default=false
186186
TolerateSingleTiKVOutage bool `json:"tolerateSingleTiKVOutage,omitempty"`
187+
// +kubebuilder:default=0
188+
BackoffLimit int32 `json:"backoffLimit,omitempty"`
187189
}
188190

189191
// RestoreStatus represents the current status of a tidb cluster restore.

manifests/crd/br.pingcap.com_restores.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,6 +2886,10 @@ spec:
28862886
Otherwise retrieve the storage account from secret
28872887
type: string
28882888
type: object
2889+
backoffLimit:
2890+
default: 0
2891+
format: int32
2892+
type: integer
28892893
backupType:
28902894
description: Type is the backup type for tidb cluster and only used
28912895
when Mode = snapshot, such as full, db, table.

pkg/controllers/br/manager/restore/restore_manager.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"k8s.io/apimachinery/pkg/api/errors"
2525
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2626
"k8s.io/client-go/tools/record"
27-
"k8s.io/utils/ptr"
2827
"sigs.k8s.io/controller-runtime/pkg/client"
2928
"sigs.k8s.io/controller-runtime/pkg/log"
3029

@@ -228,7 +227,10 @@ func (rm *restoreManager) makeRestoreJob(ctx context.Context, restore *v1alpha1.
228227

229228
switch restore.Spec.Mode {
230229
case v1alpha1.RestoreModePiTR:
231-
args = append(args, fmt.Sprintf("--mode=%s", v1alpha1.RestoreModePiTR), fmt.Sprintf("--pitrRestoredTs=%s", restore.Spec.PitrRestoredTs))
230+
args = append(args, fmt.Sprintf("--mode=%s", v1alpha1.RestoreModePiTR))
231+
if restore.Spec.PitrRestoredTs != "" {
232+
args = append(args, fmt.Sprintf("--pitrRestoredTs=%s", restore.Spec.PitrRestoredTs))
233+
}
232234
default:
233235
args = append(args, fmt.Sprintf("--mode=%s", v1alpha1.RestoreModeSnapshot))
234236
}
@@ -355,7 +357,7 @@ func (rm *restoreManager) makeRestoreJob(ctx context.Context, restore *v1alpha1.
355357
},
356358
},
357359
Spec: batchv1.JobSpec{
358-
BackoffLimit: ptr.To(int32(0)),
360+
BackoffLimit: &restore.Spec.BackoffLimit,
359361
Template: *podSpec,
360362
},
361363
}

pkg/reloadable/pd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func convertPDTemplate(tmpl *v1alpha1.PDTemplate) *v1alpha1.PDTemplate {
105105
return newTmpl
106106
}
107107

108-
func equalPDTemplate(p, c *v1alpha1.PDTemplate) bool {
108+
func equalPDTemplate(c, p *v1alpha1.PDTemplate) bool {
109109
p = convertPDTemplate(p)
110110
c = convertPDTemplate(c)
111111
// not equal only when current strategy is Restart and config is changed

pkg/reloadable/scheduler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func convertSchedulerTemplate(tmpl *v1alpha1.SchedulerTemplate) *v1alpha1.Schedu
105105
return newTmpl
106106
}
107107

108-
func equalSchedulerTemplate(p, c *v1alpha1.SchedulerTemplate) bool {
108+
func equalSchedulerTemplate(c, p *v1alpha1.SchedulerTemplate) bool {
109109
p = convertSchedulerTemplate(p)
110110
c = convertSchedulerTemplate(c)
111111
// not equal only when current strategy is Restart and config is changed

pkg/reloadable/ticdc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func convertTiCDCTemplate(tmpl *v1alpha1.TiCDCTemplate) *v1alpha1.TiCDCTemplate
110110
return newTmpl
111111
}
112112

113-
func equalTiCDCTemplate(p, c *v1alpha1.TiCDCTemplate) bool {
113+
func equalTiCDCTemplate(c, p *v1alpha1.TiCDCTemplate) bool {
114114
p = convertTiCDCTemplate(p)
115115
c = convertTiCDCTemplate(c)
116116
// not equal only when current strategy is Restart and config is changed

pkg/reloadable/tiflash.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func convertTiFlashTemplate(tmpl *v1alpha1.TiFlashTemplate) *v1alpha1.TiFlashTem
109109
return newTmpl
110110
}
111111

112-
func equalTiFlashTemplate(p, c *v1alpha1.TiFlashTemplate) bool {
112+
func equalTiFlashTemplate(c, p *v1alpha1.TiFlashTemplate) bool {
113113
p = convertTiFlashTemplate(p)
114114
c = convertTiFlashTemplate(c)
115115
// not equal only when current strategy is Restart and config is changed

pkg/reloadable/tikv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func convertTiKVTemplate(tmpl *v1alpha1.TiKVTemplate) *v1alpha1.TiKVTemplate {
109109
return newTmpl
110110
}
111111

112-
func equalTiKVTemplate(p, c *v1alpha1.TiKVTemplate) bool {
112+
func equalTiKVTemplate(c, p *v1alpha1.TiKVTemplate) bool {
113113
p = convertTiKVTemplate(p)
114114
c = convertTiKVTemplate(c)
115115
// not equal only when current strategy is Restart and config is changed

pkg/reloadable/tiproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func convertTiProxyTemplate(tmpl *v1alpha1.TiProxyTemplate) *v1alpha1.TiProxyTem
108108
return newTmpl
109109
}
110110

111-
func equalTiProxyTemplate(p, c *v1alpha1.TiProxyTemplate) bool {
111+
func equalTiProxyTemplate(c, p *v1alpha1.TiProxyTemplate) bool {
112112
p = convertTiProxyTemplate(p)
113113
c = convertTiProxyTemplate(c)
114114
// not equal only when current strategy is Restart and config is changed

pkg/reloadable/tso.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func convertTSOTemplate(tmpl *v1alpha1.TSOTemplate) *v1alpha1.TSOTemplate {
105105
return newTmpl
106106
}
107107

108-
func equalTSOTemplate(p, c *v1alpha1.TSOTemplate) bool {
108+
func equalTSOTemplate(c, p *v1alpha1.TSOTemplate) bool {
109109
p = convertTSOTemplate(p)
110110
c = convertTSOTemplate(c)
111111
// not equal only when current strategy is Restart and config is changed

0 commit comments

Comments
 (0)