Handle gitaly calls during transactions in code review workers

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Overview

We identified some long idle-in-transaction that are stressing our Postgres connection pools, leaving less space for actual traffic.

We identified the following workers as belonging to the groupcode review group:

  • app/workers/create_note_diff_file_worker.rb
  • app/workers/delete_diff_files_worker.rb
  • app/workers/merge_request_cleanup_refs_worker.rb
  • app/workers/merge_request_mergeability_check_worker.rb
  • app/workers/merge_requests/mergeability_check_batch_worker.rb
  • app/workers/merge_requests/update_head_pipeline_worker.rb
  • app/workers/merge_worker.rb
  • app/workers/migrate_external_diffs_worker.rb
  • app/workers/new_merge_request_worker.rb
  • app/workers/stuck_merge_jobs_worker.rb

These workers are executing gitaly calls while keeping DB transactions open.

source: !186758 (comment 2518140632)

Deliverables

The goal is to not call gitaly from within an open DB transaction, when possible.

  • For each worker in the list, move gitaly calls outside database transactions to reduce database pressure.
Edited Aug 29, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading