diff --git a/api/v1alpha1/obtenantrestore_types.go b/api/v1alpha1/obtenantrestore_types.go index 245d06dc9..24f7b2cd0 100644 --- a/api/v1alpha1/obtenantrestore_types.go +++ b/api/v1alpha1/obtenantrestore_types.go @@ -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"` } diff --git a/config/crd/bases/oceanbase.oceanbase.com_obtenantbackuppolicies.yaml b/config/crd/bases/oceanbase.oceanbase.com_obtenantbackuppolicies.yaml index c07d2319e..5b0f1d8ad 100644 --- a/config/crd/bases/oceanbase.oceanbase.com_obtenantbackuppolicies.yaml +++ b/config/crd/bases/oceanbase.oceanbase.com_obtenantbackuppolicies.yaml @@ -562,6 +562,8 @@ spec: type: boolean description: type: string + replayEnabled: + type: boolean replayLogUntil: properties: scn: diff --git a/config/crd/bases/oceanbase.oceanbase.com_obtenantoperations.yaml b/config/crd/bases/oceanbase.oceanbase.com_obtenantoperations.yaml index 8930584e6..1ed7b83c9 100644 --- a/config/crd/bases/oceanbase.oceanbase.com_obtenantoperations.yaml +++ b/config/crd/bases/oceanbase.oceanbase.com_obtenantoperations.yaml @@ -267,6 +267,8 @@ spec: type: boolean description: type: string + replayEnabled: + type: boolean replayLogUntil: properties: scn: @@ -777,6 +779,8 @@ spec: type: boolean description: type: string + replayEnabled: + type: boolean replayLogUntil: properties: scn: diff --git a/config/crd/bases/oceanbase.oceanbase.com_obtenantrestores.yaml b/config/crd/bases/oceanbase.oceanbase.com_obtenantrestores.yaml index d3ca330cb..d7ce1554b 100644 --- a/config/crd/bases/oceanbase.oceanbase.com_obtenantrestores.yaml +++ b/config/crd/bases/oceanbase.oceanbase.com_obtenantrestores.yaml @@ -90,6 +90,8 @@ spec: type: boolean description: type: string + replayEnabled: + type: boolean replayLogUntil: properties: scn: diff --git a/config/crd/bases/oceanbase.oceanbase.com_obtenants.yaml b/config/crd/bases/oceanbase.oceanbase.com_obtenants.yaml index 67e83bab3..9999190a8 100644 --- a/config/crd/bases/oceanbase.oceanbase.com_obtenants.yaml +++ b/config/crd/bases/oceanbase.oceanbase.com_obtenants.yaml @@ -187,6 +187,8 @@ spec: type: boolean description: type: string + replayEnabled: + type: boolean replayLogUntil: properties: scn: diff --git a/pkg/resource/obtenantrestore_manager.go b/pkg/resource/obtenantrestore_manager.go index b06018c28..d294042a4 100644 --- a/pkg/resource/obtenantrestore_manager.go +++ b/pkg/resource/obtenantrestore_manager.go @@ -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 }