Skip to content

Commit

Permalink
fix: replay log only if restore until is not unlimited and replayEnab…
Browse files Browse the repository at this point in the history
…led = true
  • Loading branch information
powerfooI committed Oct 23, 2023
1 parent b968a79 commit 09ba7aa
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/v1alpha1/obtenantrestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ type RestoreSourceSpec struct {
BakDataSource *apitypes.BackupDestination `json:"bakDataSource,omitempty"`
BakEncryptionSecret string `json:"bakEncryptionSecret,omitempty"`

SourceUri string `json:"sourceUri,omitempty"` // Deprecated
SourceUri string `json:"sourceUri,omitempty"` // Deprecated, use ArchiveSource and BakDataSource instead
Until RestoreUntilConfig `json:"until"`
Description *string `json:"description,omitempty"`
ReplayEnabled bool `json:"replayEnabled,omitempty"`
ReplayLogUntil *RestoreUntilConfig `json:"replayLogUntil,omitempty"`
Cancel bool `json:"cancel,omitempty"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ spec:
type: boolean
description:
type: string
replayEnabled:
type: boolean
replayLogUntil:
properties:
scn:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ spec:
type: boolean
description:
type: string
replayEnabled:
type: boolean
replayLogUntil:
properties:
scn:
Expand Down Expand Up @@ -777,6 +779,8 @@ spec:
type: boolean
description:
type: string
replayEnabled:
type: boolean
replayLogUntil:
properties:
scn:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ spec:
type: boolean
description:
type: string
replayEnabled:
type: boolean
replayLogUntil:
properties:
scn:
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/oceanbase.oceanbase.com_obtenants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ spec:
type: boolean
description:
type: string
replayEnabled:
type: boolean
replayLogUntil:
properties:
scn:
Expand Down
7 changes: 6 additions & 1 deletion pkg/resource/obtenantrestore_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ func (m *ObTenantRestoreManager) checkRestoreProgress() error {
if restoreHistory != nil && restoreHistory.Status == "SUCCESS" {
m.Recorder.Event(m.Resource, corev1.EventTypeNormal, "Restore job finished", "Restore job finished")
if m.Resource.Spec.RestoreRole == constants.TenantRoleStandby {
m.Resource.Status.Status = constants.RestoreJobStatusReplaying
if m.Resource.Spec.Source.ReplayEnabled && !m.Resource.Spec.Source.Until.Unlimited {
// Only if replay is enabled and restore until is not unlimited, start log replay
m.Resource.Status.Status = constants.RestoreJobStatusReplaying
} else {
m.Resource.Status.Status = constants.RestoreJobSuccessful
}
} else {
m.Resource.Status.Status = constants.RestoreJobStatusActivating
}
Expand Down

0 comments on commit 09ba7aa

Please sign in to comment.