Skip to content

gitaly: Reintroduce migration to `[[git.config]]` stanzas

What does this MR do?

With commit 2727686d (gitaly: Migrate to inject Git configuration via config.toml, 2022-06-20), we have migrated the configuration for Git commands spawned by Gitaly from the system-level gitconfig file into Gitaly's config.toml via [[git.config]] stanzas. This change caused an incident because it change inadvertently fixed a configuration error: because we had globally been setting core.alternateRefsCommand=exit 0# in the gitconfig, Gitaly mistakenly ignored all alternate references in object pools. This is wrong though when calculating the repository size, where we need to consider alternate references in order to correctly calculate the size of objects that are only contained in the repository itself.

But while the migration to [[git.config]] stanzas fixed this bug, it surfaced that the current implementation of how this is done in Gitaly is extremely inperformant in large repositories with many references. And this inefficiency ultimately end to starving the node of resources, which led to the revert of this change via a42c5611 (Merge branch 'revert-fe00a13e' into 'master', 2022-06-20).

Gitaly has since fixed this performance edge case so that we shouldn't hit the same bug this time. So let's reintroduce the migration to the new way of configuring Git so that we can also fix the bug about repo size calculations.

Note that this commit is a simple revert. This time around we'll also introduce a new flag to opt-in to this migration so that we can first excessively test it in staging without also impacting production. To keep this as a clean revert though this change will be done in the subsequent commit.

Related issues

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion

Required

  • Merge Request Title, and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • Pipeline is green on dev.gitlab.org if the change is touching anything besides documentation or internal cookbooks
  • trigger-package has a green pipeline running against latest commit

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Tests added
  • Integration tests added to GitLab QA
  • Equivalent MR/issue for the GitLab Chart opened
Edited by Patrick Steinhardt

Merge request reports