Skip to content

Fix slow fetches for repositories using object deduplication

Stan Hu requested to merge sh-disable-fetch-alternate-refs into master

This mirrors the change in Omnibus: gitlab-org/omnibus-gitlab!3559 (merged)

In gitlab-org/gitaly!1297 (merged), we introduced a mechanism to prevent accidental deletion of objects from object pools. The idea is that if an object becomes "dangling", meaning there is no ref pointing to it, we just add a new ref to un-dangle it. It turns out this can create too many refs.

If a pooled repository may contain many dangling references, a fetch from the parent repository to one of its forks may take an extraordinarily long time because git will attempt to run git for-each-ref on every single ref in the pooled repository. This can cause a simple fetch to take minutes.

To avoid this problem, we use a similar strategy that we employed in the git push case (gitlab-org/omnibus-gitlab!3364 (merged)). We disable the fetching of refs from the alternates via the core.alternateRefsCommand config option.

Edited by Stan Hu

Merge request reports