Skip to content

repository: Fix undeterministic votes when creating repos

The new implementation for creating repositories atomically asserts that the created repository is the same across all replicas in Gitaly Cluster by walking the on-disk contents of the repository and verifying that we have an exact match. Not all contents of a repository are deterministic though, which is why we already skip over the objects database given that packfiles are not deterministic.

As it turns, out there is more indeterminant behaviour though in the CreateRepositoryFromBundle RPC: to fetch from the bundle, we first write the bundle's contents into a temporary file and then feed that file to git-fetch(1). git-fetch(1) will then by default write fetched refs into FETCH_HEAD, including where it fetched the refs from. Given that this location is referring to a temporary file, this path is indeterministic and thus causes nodes to never reach quorum.

Fix this bug by filtering out FETCH_HEAD when computing the vote. We don't expose this file to any callers anyway, so it's safe to ignore it.

Changelog: fixed

Merge request reports