Skip to content

Add async recursive delete for apps and service instances - #5299

Merged
johha merged 1 commit into
mainfrom
recursive-app-service-delete
Aug 11, 2026
Merged

Add async recursive delete for apps and service instances#5299
johha merged 1 commit into
mainfrom
recursive-app-service-delete

Conversation

@johha

@johha johha commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Behind temporary_enable_async_recursive_delete flag (default off). Recursive delete jobs re-enqueue instead of failing when sub-resources (service bindings) are deleted asynchronously, waiting for them to settle and surfacing the original broker error on failure. Adds root/sub job tracking via root_job_guid on the jobs table. Foundation for future recursive deletes (org, space).

Thanks for contributing to cloud_controller_ng. To speed up the process of reviewing your pull request please provide us with:

@johha
johha force-pushed the recursive-app-service-delete branch 9 times, most recently from a87ea6c to 05ca1aa Compare July 22, 2026 15:45
Comment thread app/actions/v3/service_instance_delete.rb Outdated
Comment thread app/controllers/v3/apps_controller.rb Outdated
Comment thread app/jobs/mixins/root_job_mixin.rb Outdated
Comment thread app/jobs/mixins/root_job_mixin.rb Outdated
Comment thread app/jobs/v3/recursive_delete_app_job.rb
Comment thread app/errors/sub_resource_error.rb Outdated
Comment thread app/jobs/logging_context_job.rb
Comment thread db/migrations/20260723120000_add_root_job_guid_to_jobs.rb Outdated
Comment thread app/actions/v3/service_instance_delete.rb Outdated
Comment thread app/jobs/v3/recursive_delete_app_job.rb Outdated
Comment thread spec/unit/controllers/v3/apps_controller_spec.rb
Comment thread spec/unit/jobs/enqueuer_spec.rb
Comment thread app/jobs/enqueuer.rb Outdated
@johha
johha force-pushed the recursive-app-service-delete branch 3 times, most recently from 2ab4ea5 to 3b0b8fa Compare August 10, 2026 07:30
Behind `temporary_enable_async_recursive_delete` flag (default off). Recursive
delete jobs re-enqueue instead of failing when sub-resources (service bindings)
are deleted asynchronously, waiting for them to settle and surfacing the
original broker error on failure. Adds root/sub job tracking via `root_job_guid`
on the jobs table. Foundation for future recursive deletes (org, space).

- Introduce RecursiveDeleteRootJobMixin encapsulating the root-job lifecycle:
  defer-while-sub-jobs-in-flight, raise-if-failed, and root-context activation;
  keep sub_jobs_in_flight? side-effect-free.
- Override the max-duration budget for root jobs: never expire while sub-jobs
  are still deleting (each sub-job is self-bounded), and re-anchor the budget
  to when the sub-jobs completed so the root's own broker delete gets its full
  duration. Implemented by overriding start_time in the mixin.
- Pace the root's re-enqueue off the slowest active sub-job's next run so it
  never wakes early.
- Surface sub-resource failures via rescue (log_immediate / compound_error)
  rather than looping over sub_resource_errors.
- Add ServiceInstance#route_bindings association.
- Enqueuer exposes current_root_job_guid, overridden by GenericEnqueuer.
@johha
johha force-pushed the recursive-app-service-delete branch from 566d580 to d2f62a2 Compare August 11, 2026 14:02
@johha
johha marked this pull request as ready for review August 11, 2026 14:03
@johha
johha merged commit 23ea0b8 into main Aug 11, 2026
16 checks passed
@johha
johha deleted the recursive-app-service-delete branch August 11, 2026 14:47
ari-wg-gitbot added a commit to cloudfoundry/capi-release that referenced this pull request Aug 11, 2026
Changes in cloud_controller_ng:

- Add async recursive delete for apps and service instances
    PR: cloudfoundry/cloud_controller_ng#5299
    Author: Johannes Haass <johannes.haass@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants