Skip to content

Load merge request diffs incrementally from Gitaly

Problem to solve

That's a follow-up for #31290 (closed) and solve similar problems. There are scenarios where we don't fetch MR diffs from the database (which are simpler manipulate and paginate), and in these scenarios we'd need to fallback to Gitaly in order to batch the diffs requests.

Proposals

The problem is that paginating in Gitaly would either mean:

  1. Requesting all diffs at once, then batching on gitlab-rails (not ideal since we're not being efficient here). No Gitaly changes would be needed. Although this request seems fast, it concerns me on how much pressure we'd be adding here (as we'll request quite a lot).
  2. Come up with a batch strategy for the CommitDiff RPC. We'd probably need to send a limit and offset there.

From my investigations, these are the scenarios at the MR where we fallback to the repository:

  • Going to Commits > Click in a commit
  • Deselecting the Config cog > Show whitespace changes
  • Selecting different versions at Changes between selects

Solving this also means we could probably easily batch the diffs request for the Comparison / Commit view.

Edited by James Ramsay (ex-GitLab)