[go: up one dir, main page]

Skip to content

Draft: Add Gitlab::Database::BackgroundOperation::Runner

Ref: #578057

What does this MR do and why?

This MR introduces Gitlab::Database::BackgroundOperation::Runner which is responsible for orchestrating the execution of a single operation.

I adds better tracking and management capabilities for background database operations. It introduces new ways to filter jobs by their status (failed or running), adds state transition events that allow jobs to properly move between different stages (pending → running → succeeded/failed), and includes a method to handle job failures by recording error details and timestamps. Additionally, it establishes a relationship to easily find the most recent job for each worker, which helps with monitoring progress and debugging issues.

SingleDatabaseWorker (Cron)
    ↓ (finds migrations, queues jobs)
ExecutionWorker (Sidekiq)
    ↓ (sets up connection, finds migration)
BatchedMigrationRunner
    ↓ (creates batch, orchestrates execution) # This MR
BatchedMigrationWrapper
    ↓ (executes with error handling)
Actual Migration Job Class (e.g., BackfillUserDetails)
Edited by Max Orefice

Merge request reports

Loading