Skip to content

objectpool: Enable atomic creation of object pools

Patrick Steinhardt requested to merge pks-objectpool-atomic-creation into master

Creating repositories can be a complex task that involves multiple steps. We must ensure though that if any of the steps fails that we don't leave behind any cruft on disk in the form of a partially initialized repository. This is why we have in the past refactorey our repository-creating RPCs to use a helper that knows to do this in multiple steps:

1. The repository gets created in a temporary directory.

2. The temporary gets seeded with the data we want to put into it.

3. We optionally vote on the resulting repository so that we can be
   sure that any replicas have created the same repository.

4. When we see that everything is fine we move the final repository
   into the target location.

This ensures that we only ever see either fully-initialized repositories or no repository at all in the target location after a repo-creating RPC finishes.

Object pools don't yet use that machinery though. But there is no other reason than object pools frequently being an afterthought in Gitaly. So let's use the same helper function to atomically create object pools.

Note that while the helper also supports voting onthe result we don't yet wire up that functionality: transactions for CreateObjectPool() are not enabled in Praefect. We will eventually do this in another iteration.

Closes #4385 (closed).

Edited by Patrick Steinhardt

Merge request reports