Stop preloading diff commits

What does this MR do and why?

This MR attempts to fix performance concerns raised in Degraded Time to First Byte performance for lis... (#585900). It does this by removing a preload for an association on mr_diff_commits, which, if included, could cause a lot of objects to be loaded from the database and instantiated. This preload appears to have been added because of a spec that failed on the pipeline but passed locally when Elastic Search is enabled, which exposed silent N + 1 queries that existed in the MR domain.

This MR also rewrites some existing specs on the Merge request search API, which passed due to incorrect N + 1 test setup.

Thresholds were added to allow specs to pass on the current code, but comments and issue links have been added for future improvements, and to explain.

References

Degraded Time to First Byte performance for lis... (#585900)

Screenshots or screen recordings

Before After

How to set up and validate locally

Local run of GPT tests #585900 (comment 3022939954)+ with and without this change shows improvements, but whether this resolves Degraded Time to First Byte performance for lis... (#585900) would depend on the reference architecture tests.

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.

Edited by Safwan Ahmed

Merge request reports

Loading