summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-26 18:08:03 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-26 18:08:03 +0000
commitdc003cd08b4cb72fecbb03aa978ea0c53c03aeb4 (patch)
tree5e77ce228c33619201ac6706b9789d4a2eed2a3b /config
parente80e0dd64fbb04f60394cb1bb08e17dbcb22b8ce (diff)
downloadgitlab-ce-dc003cd08b4cb72fecbb03aa978ea0c53c03aeb4.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config')
-rw-r--r--config/initializers/fill_shards.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/config/initializers/fill_shards.rb b/config/initializers/fill_shards.rb
index cad662e12f3..40a9a271953 100644
--- a/config/initializers/fill_shards.rb
+++ b/config/initializers/fill_shards.rb
@@ -1,5 +1,8 @@
# The `table_exists?` check is needed because during our migration rollback testing,
# `Shard.connected?` could be cached and return true even though the table doesn't exist
-if Shard.connected? && Shard.table_exists? && !Gitlab::Database.read_only?
- Shard.populate!
-end
+return unless Shard.connected?
+return unless Shard.table_exists?
+return unless Shard.connection.index_exists?(:shards, :name, unique: true)
+return if Gitlab::Database.read_only?
+
+Shard.populate!