Add preload option to MergeRequestDiff#commit_shas
What does this MR do and why?
Part of a process to begin preloading merge request commit metadata to avoid possible N+1 queries. This will consist of 5 MRs total, described in the table below.
This MR will improve the performance of retrieving commit information in merge requests by preloading when the dedup feature flag is enabled.
This adds a new preload_metadata parameter to the commit_shas method that will load additional commit details (like author and committer information) in a single database query instead of making separate queries for each commit.
| Order | MR/status | Description |
|---|---|---|
| Part 1 | !203465 (merged) | Adding scope to preload the latest diff commit |
| Part 2a | !204107 (merged) | Add preloading to MergeRequest#recent_commits
|
| Part 2b | !204128 (merged) | Add preloading to MergeRequest#committers (relies on !204107 (merged)) |
| Part 3 |
!204132 (merged) | Add preloading to MergeRequestDiff#commit_shas
|
| Part 4 | !204123 (merged) | Add Banzai find_commit_by_sha preloading |
References
https://gitlab.com/gitlab-org/gitlab/-/issues/527235
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.