summaryrefslogtreecommitdiff
path: root/app/models/pool_repository.rb
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2019-04-02 13:20:26 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-04-02 13:20:26 +0000
commit35b9274f12f29524855237bfdcd864497d62de95 (patch)
tree13efbc7330efcd8760ff9f6bfbdc0c1dd44ca155 /app/models/pool_repository.rb
parent4b9dbec33ce446362d617f481b35628890763bd7 (diff)
downloadgitlab-ce-35b9274f12f29524855237bfdcd864497d62de95.tar.gz
Stop calling UnlinkRepositoryFromObjectPool RPC
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/59777. In earlier iterations of our implementation of Git object deduplication we thought we would be making extensive use of Git remotes in pool repositories in the future, and that we should manage these remotes carefully from the start. We now expect we only care about one remote, namely the source project. The other remotes are there only for forensic purposes. Before this MR we tried to also remove pool remotes when member projects got deleted, with the UnlinkRepositoryFromObjectPool RPC. This is fragile when there are race conditions (see https://gitlab.com/gitlab-org/gitaly/issues/1568#note_153955926). We have spent some time making this RPC less fragile in https://gitlab.com/gitlab-org/gitaly/merge_requests/1151 but looking at this problem again, I think we should just stop calling it.
Diffstat (limited to 'app/models/pool_repository.rb')
-rw-r--r--app/models/pool_repository.rb5
1 files changed, 1 insertions, 4 deletions
diff --git a/app/models/pool_repository.rb b/app/models/pool_repository.rb
index 35c718365b4..7934118761e 100644
--- a/app/models/pool_repository.rb
+++ b/app/models/pool_repository.rb
@@ -81,10 +81,7 @@ class PoolRepository < ApplicationRecord
object_pool.link(repository.raw)
end
- # This RPC can cause data loss, as not all objects are present the local repository
- def unlink_repository(repository)
- object_pool.unlink_repository(repository.raw)
-
+ def mark_obsolete_if_last(repository)
if member_projects.where.not(id: repository.project.id).exists?
true
else