Backfill resource_link_events
What does this MR do and why?
Related to #407289 (closed)
When work items or issues are related as parent/child, system notes are created using Note
(notes
table) and SystemNoteMetadata
(system_note_metdata
table).
To see such notes in action, see this demo (not strictly necessary for this MR.)
- Create an issue (which is a work item) and add a new task.
Near the end of the demo, you can see a system note that reads "Administrator added #11 (closed) as a child task just now."
The information in the note is stored in system_note_metadata
table
It's useful to have the exact information on the relate/linking events in a more parseable and queryable format and WorkItems::ResourceLinkEvent
(resource_link_events
table) was created for the purpose of recording the information.
Using the existing system_note_metadata
records, we are going to retroactively create / backfill resource_link_events
.
DB review
-
Execution plan for the query retrieving the starting batch id: !118605 (comment 1377584873)
-
Execution plan for the query selecting a sub batch range: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/18249/commands/60297
-
Execution plan for the insert statement used to backfill
resource_link_events
: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/18249/commands/60296
The estimate time needed to complete the batched background migration is discussed in !118605 (comment 1377568268). Tldr; we only need to batch through ~242182 records and it should not take long.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.