Skip to content

Commit

Permalink
fix(backup): add handler to force delete backup policy
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI committed Mar 12, 2024
1 parent b85ceb7 commit 74688b7
Show file tree
Hide file tree
Showing 9 changed files with 1,356 additions and 15 deletions.
5 changes: 4 additions & 1 deletion internal/dashboard/business/oceanbase/obtenantbackup.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,14 @@ func UpdateTenantBackupPolicy(ctx context.Context, nn types.NamespacedName, p *p
return buildBackupPolicyModelType(np), nil
}

func DeleteTenantBackupPolicy(ctx context.Context, nn types.NamespacedName) error {
func DeleteTenantBackupPolicy(ctx context.Context, nn types.NamespacedName, force bool) error {
policy, err := oceanbase.GetTenantBackupPolicy(ctx, nn)
if err != nil {
return oberr.NewBadRequest(err.Error())
}
if force {
return oceanbase.ForceDeleteTenantBackupPolicy(ctx, types.NamespacedName{Name: policy.Name, Namespace: policy.Namespace})
}
return oceanbase.DeleteTenantBackupPolicy(ctx, types.NamespacedName{Name: policy.Name, Namespace: policy.Namespace})
}

Expand Down
12 changes: 8 additions & 4 deletions internal/dashboard/business/oceanbase/obtenantbackup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ var _ = Describe("OBTenantBackup", func() {
ScheduleDates: scheduleDates,
ScheduleTime: "04:00",
},
JobKeepDays: 3,
RecoveryDays: 7,
DaysFieldBase: param.DaysFieldBase{
JobKeepDays: 3,
RecoveryDays: 7,
},
},
}
policy := buildBackupPolicyApiType(types.NamespacedName{Name: "t1", Namespace: "default"}, "fake-cluster", &p)
Expand Down Expand Up @@ -108,8 +110,10 @@ var _ = Describe("OBTenantBackup", func() {
ScheduleDates: scheduleDates,
ScheduleTime: "04:00",
},
JobKeepDays: 3,
RecoveryDays: 7,
DaysFieldBase: param.DaysFieldBase{
JobKeepDays: 3,
RecoveryDays: 7,
},
},
}
policy := buildBackupPolicyApiType(types.NamespacedName{Name: "t1", Namespace: "default"}, "fake-cluster", &p)
Expand Down
Loading

0 comments on commit 74688b7

Please sign in to comment.