Should we be using a SQL transaction in UpdateRepositoryStorageService?
Raised during review of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/10457
In UpdateRepositoryStorageService we do multiple SQL updates of related attributes. Because there is no transaction, and because we are inconsistent in our use of update
vs update!
, it is hard to say if all these attributes get updated together or not.
- the update of
repository_storage
andrepository_read_only
has no bang and is not checked -
project.leave_pool_repository
has no bang and is not checked -
project.track_project_repository
, which overlaps withrepository_storage
, does have a bang in its implementation
Note that project.leave_pool_repository
currently makes a Gitaly call, which does not belong inside a SQL transaction, but we are changing that in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/26821.