Commit 0b2ba540 authored by Nick Thomas's avatar Nick Thomas

Merge branch '212436-fix-race-condition-with-shards-populating' into 'master'

Make sure the shards table has its index created before populating it

Closes #212436

See merge request gitlab-org/gitlab!28084
parents c1fac2c8 f607b1f9
# 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!
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment