Wire up pre-drain in Projects::DestroyService
Summary
Add the batched pre-drain call to Projects::DestroyService so child tables are deleted in committed batches before project.destroy!. No custom strategy hooks yet. All tables use raw SQL DELETE.
This proves the pattern works end-to-end. Strategy hooks for tables with side effects come in #619136.
Requirements
- Call pre-drain before
project.destroy!. InvokeBatchedPreDrainfor the project'sCASCADEFK children. - Re-enqueue on budget exhaustion. If the pre-drain returns
:over_budget, re-enqueue the worker and return. The project stayspending_delete. The next run picks up where it left off. - Destroy the project. Once the pre-drain finishes, call
project.destroy!. It now cascades only a small remainder, or nothing. - Disable
QueryLimitingfor the worker if not already disabled.
Out of scope
Per-table strategy hooks for side effects (uploads, search index, container registry). Those are handled in #619136.
Specs
- Pre-drain runs before
destroy! - Worker re-enqueues on
:over_budget destroy!succeeds with minimal cascade- Partial drain + crash + re-run works correctly (idempotent)
Dependencies
Depends on the generic batched pre-drain helper (#619116).
References
- Parent epic: gitlab-org#23353
- Design document MR: gitlab-com/content-sites/handbook!20016
Edited by 🤖 GitLab Bot 🤖