Commit 8c9e0e13 authored by Stan Hu's avatar Stan Hu

Merge branch '346836-fix-multistore-ff-check-alt' into 'master'

Fix Multistore FF for empty DB - another way

See merge request gitlab-org/gitlab!75638
parents 5c95fb3d f7bdab1b
# frozen_string_literal: true # frozen_string_literal: true
return unless Gitlab.com? || Gitlab.dev_or_test_env?
def feature_flags_available? def feature_flags_available?
# When the DBMS is not available, an exception (e.g. PG::ConnectionBad) is raised # When the DBMS is not available, an exception (e.g. PG::ConnectionBad) is raised
active_db_connection = ActiveRecord::Base.connection.active? rescue false active_db_connection = ActiveRecord::Base.connection.active? rescue false
...@@ -11,6 +9,8 @@ rescue ActiveRecord::NoDatabaseError ...@@ -11,6 +9,8 @@ rescue ActiveRecord::NoDatabaseError
false false
end end
return unless Gitlab.com? || Gitlab.dev_or_test_env?
Gitlab::Application.configure do Gitlab::Application.configure do
if feature_flags_available? && ::Feature.enabled?(:active_record_transactions_tracking, type: :ops, default_enabled: :yaml) if feature_flags_available? && ::Feature.enabled?(:active_record_transactions_tracking, type: :ops, default_enabled: :yaml)
Gitlab::Database::Transaction::Observer.register! Gitlab::Database::Transaction::Observer.register!
......
...@@ -97,11 +97,15 @@ module Gitlab ...@@ -97,11 +97,15 @@ module Gitlab
end end
def use_primary_and_secondary_stores? def use_primary_and_secondary_stores?
Feature.enabled?("use_primary_and_secondary_stores_for_#{instance_name.underscore}", default_enabled: :yaml) && !same_redis_store? feature_flags_available? &&
Feature.enabled?("use_primary_and_secondary_stores_for_#{instance_name.underscore}", default_enabled: :yaml) &&
!same_redis_store?
end end
def use_primary_store_as_default? def use_primary_store_as_default?
Feature.enabled?("use_primary_store_as_default_for_#{instance_name.underscore}", default_enabled: :yaml) && !same_redis_store? feature_flags_available? &&
Feature.enabled?("use_primary_store_as_default_for_#{instance_name.underscore}", default_enabled: :yaml) &&
!same_redis_store?
end end
private private
......
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