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-04-22 10:24:57 +0300
committerStan Hu <stanhu@gmail.com>2019-04-22 20:48:16 +0300
commit9b752791624ce618810b9d65251582e56c37dee7 (patch)
treed495612c25e2c7b4a9a8db4ea3cb00ee5e5be1aa /app/models/internal_id.rb
parent84a1e37f4a889c6b7558f101dc0ecf2932d0a0c6 (diff)
Always use internal ID tables in development and production
To avoid quiet failures that cause consistency errors in the database, we should now assume that the internal_ids table is available since we've had this table for close to a year. For tests that have migrations, we make this check thread-safe via SafeRequestStore. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/60718
Diffstat (limited to 'app/models/internal_id.rb')
-rw-r--r--app/models/internal_id.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/internal_id.rb b/app/models/internal_id.rb
index 401b94d36e5..237401899db 100644
--- a/app/models/internal_id.rb
+++ b/app/models/internal_id.rb
@@ -87,12 +87,16 @@ class InternalId < ApplicationRecord
end
def available?
- @available_flag ||= ActiveRecord::Migrator.current_version >= REQUIRED_SCHEMA_VERSION # rubocop:disable Gitlab/PredicateMemoization
+ return true unless Rails.env.test?
+
+ Gitlab::SafeRequestStore.fetch(:internal_ids_available_flag) do
+ ActiveRecord::Migrator.current_version >= REQUIRED_SCHEMA_VERSION
+ end
end
# Flushes cached information about schema
def reset_column_information
- @available_flag = nil
+ Gitlab::SafeRequestStore[:internal_ids_available_flag] = nil
super
end
end