Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-01-08 10:31:30 +0300
committerToon Claes <toon@gitlab.com>2019-01-11 17:36:51 +0300
commit618875c58c50b0c9dcfa90033ebe975004f401a2 (patch)
tree0243d7b21f0f6331b7c4610ba510468209622e87 /lib/gitlab/background_migration
parent6b2f81f6078e96f081154c50dc25e54fe7c09d6f (diff)
Fix duplicate disk path in Backfill ProjectRepos
On GitLab.com, we saw numerous duplicate disk entry inserts because the migration was not taking the routes table into account. We now implement this in the migration to be consistent. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56061
Diffstat (limited to 'lib/gitlab/background_migration')
-rw-r--r--lib/gitlab/background_migration/backfill_project_repositories.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/background_migration/backfill_project_repositories.rb b/lib/gitlab/background_migration/backfill_project_repositories.rb
index aaf520d70f6..2a7f10c21e1 100644
--- a/lib/gitlab/background_migration/backfill_project_repositories.rb
+++ b/lib/gitlab/background_migration/backfill_project_repositories.rb
@@ -83,7 +83,7 @@ module Gitlab
extend ActiveSupport::Concern
def full_path
- @full_path ||= build_full_path
+ route&.path || build_full_path
end
def build_full_path
@@ -99,6 +99,9 @@ module Gitlab
end
end
+ class Route < ActiveRecord::Base
+ end
+
# Namespace model.
class Namespace < ActiveRecord::Base
self.table_name = 'namespaces'
@@ -110,6 +113,10 @@ module Gitlab
has_many :projects, inverse_of: :parent
has_many :namespaces, inverse_of: :parent
+
+ def route
+ Route.find_by(source_type: 'Namespace', source_id: self.id)
+ end
end
# ProjectRegistry model
@@ -165,6 +172,10 @@ module Gitlab
end
end
+ def route
+ Route.find_by(source_type: 'Project', source_id: self.id)
+ end
+
def storage
@storage ||=
if hashed_storage?