Skip to content

Allow ref name caching CommitService#find_commit

Stan Hu requested to merge sh-fix-gitaly-find-commit-caching into master

For a given merge request, it's quite common to see duplicate FindCommit Gitaly requests because the Gitaly CommitService caches the request by the commit SHA, not by the ref name:

image

However, most of the duplicate requests use the ref name, so the cache is never actually used in practice. This leads to unnecessary requests that slow performance.

This commit allows certain callers to bypass the ref name to OID conversion in the cache. We don't do this by default because it's possible the tip of the branch changes during the commit, which would cause the caller to get stale data.

This commit also forces the Ci::Pipeline to use the full ref name so that caching can work for merge requests.

Now instead of 4 separate FindCommit requests, we only make 2.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/57083

Edited by Stan Hu

Merge request reports