Merge branch '53972-fix-fill-shards' into 'master'
Fix a race condition in the shard population logic Closes #53972 See merge request gitlab-org/gitlab-ce!23028
This commit is contained in:
commit
078fab665b
|
@ -9,13 +9,12 @@ class Shard < ActiveRecord::Base
|
|||
|
||||
# The GitLab config does not change for the lifecycle of the process
|
||||
in_config = Gitlab.config.repositories.storages.keys.map(&:to_s)
|
||||
in_db = all.pluck(:name)
|
||||
|
||||
transaction do
|
||||
in_db = all.pluck(:name)
|
||||
missing = in_config - in_db
|
||||
|
||||
missing.map { |name| by_name(name) }
|
||||
end
|
||||
# This may race with other processes creating shards at the same time, but
|
||||
# `by_name` will handle that correctly
|
||||
missing = in_config - in_db
|
||||
missing.map { |name| by_name(name) }
|
||||
end
|
||||
|
||||
def self.by_name(name)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fix a race condition intermittently breaking GitLab startup
|
||||
merge_request: 23028
|
||||
author:
|
||||
type: fixed
|
Loading…
Reference in New Issue