Skip to content

Backfill Escalation Statuses for Incident issues

Sean Arnold requested to merge 330281-backfill-incident-escalation-statuses into master

What does this MR do and why?

This backfills Escalation Status records for Incident issues.

We enqueue a background migration worker that creates an IncidentManagment::IssuableEscalationStatus record for each Incident issue, if it does not already exist.

These records are created with only the issue_id set, as we cannot infer the other information such as policy_id and escalations_started_at.

Blocked by !75706 (merged) and !75176 (merged) (do not merge until those are both merged).

How to set up and validate locally

  1. Create a bunch of Incident typed Issues
  2. Run the migration
  3. IncidentManagment::IssuableEscalationStatus records should be created for each record.

Data to change in gitlab.com:

  1. num of incidents https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/7626/commands/27112
  2. num of escalation statuses that exist already https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/7626/commands/27113
  3. Total to add: 65,655.
Query Plan
ModifyTable on public.incident_management_issuable_escalation_statuses  (cost=2156.66..2250.31 rows=61 width=58) (actual time=690.049..690.052 rows=0 loops=1)
   Buffers: shared hit=1278 read=1153 dirtied=33 written=2
   I/O Timings: read=638.337 write=0.000
   ->  Bitmap Heap Scan on public.issues  (cost=2156.66..2250.31 rows=61 width=58) (actual time=580.649..681.137 rows=139 loops=1)
         Buffers: shared hit=149 read=1123 dirtied=9
         I/O Timings: read=634.053 write=0.000
         ->  BitmapAnd  (cost=2156.66..2156.66 rows=61 width=0) (actual time=577.884..577.886 rows=0 loops=1)
               Buffers: shared hit=2 read=976
               I/O Timings: read=533.815 write=0.000
               ->  Bitmap Index Scan using issues_pkey  (cost=0.00..701.60 rows=48053 width=0) (actual time=49.678..49.678 rows=47812 loops=1)
                     Index Cond: ((issues.id >= 98900000) AND (issues.id <= 98950000))
                     Buffers: shared hit=2 read=248
                     I/O Timings: read=36.563 write=0.000
               ->  Bitmap Index Scan using index_issues_on_project_id_and_created_at_issue_type_incident  (cost=0.00..1454.79 rows=71274 width=0) (actual time=525.317..525.317 rows=70840 loops=1)
                     Buffers: shared read=728
                     I/O Timings: read=497.252 write=0.000
Copy

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/7626/commands/27117

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #330281 (closed)

Edited by Sean Arnold

Merge request reports