Skip to content

Cache list of conflicts when serializing diffs

Patrick Bajao requested to merge 439695-conflicts-with-types into master

What does this MR do and why?

When we serialize diffs and the MR has conflicts, we make a ListConflictFiles RPC call to Gitaly. We use this to determine what type of conflict file/s in the diffs is encountered.

This RPC can take a while if we're requesting this every request and there are no actual changes.

To improve performance for succeeding requests, we introduce a new #conflicts_with_types helper which will cache the result and will use the cached result until source/target branch changes.

Caching functionality is behind cached_conflicts_with_types feature flag.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Enable cached_conflicts_with_types feature flag.
  2. Create a MR with conflicts.
  3. View the "Changes" and you should see the conflict type (as documented in https://docs.gitlab.com/ee/user/project/merge_requests/changes.html#show-merge-request-conflicts-in-diff).
  4. Reload the MR page.
  5. Check pb and the diffs_batch.json and diffs_metadata.json requests shouldn't have any requests to ListConflictFiles RPC.

Related to #439695 (closed)

Edited by Patrick Bajao

Merge request reports