summaryrefslogtreecommitdiff
path: root/lib/gitlab/gitaly_client.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/gitaly_client.rb')
-rw-r--r--lib/gitlab/gitaly_client.rb28
1 files changed, 22 insertions, 6 deletions
diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb
index 550294916a4..620362b52a9 100644
--- a/lib/gitlab/gitaly_client.rb
+++ b/lib/gitlab/gitaly_client.rb
@@ -33,11 +33,6 @@ module Gitlab
MAXIMUM_GITALY_CALLS = 35
CLIENT_NAME = (Sidekiq.server? ? 'gitlab-sidekiq' : 'gitlab-web').freeze
- # We have a mechanism to let GitLab automatically opt in to all Gitaly
- # features. We want to be able to exclude some features from automatic
- # opt-in. That is what EXPLICIT_OPT_IN_REQUIRED is for.
- EXPLICIT_OPT_IN_REQUIRED = [Gitlab::GitalyClient::StorageSettings::DISK_ACCESS_DENIED_FLAG].freeze
-
MUTEX = Mutex.new
class << self
@@ -191,6 +186,8 @@ module Gitlab
metadata['call_site'] = feature.to_s if feature
metadata['gitaly-servers'] = address_metadata(remote_storage) if remote_storage
+ metadata.merge!(server_feature_flags)
+
result = { metadata: metadata }
# nil timeout indicates that we should use the default
@@ -209,6 +206,14 @@ module Gitlab
result
end
+ SERVER_FEATURE_FLAGS = %w[gogit_findcommit].freeze
+
+ def self.server_feature_flags
+ SERVER_FEATURE_FLAGS.map do |f|
+ ["gitaly-feature-#{f.tr('_', '-')}", feature_enabled?(f).to_s]
+ end.to_h
+ end
+
def self.token(storage)
params = Gitlab.config.repositories.storages[storage]
raise "storage not found: #{storage.inspect}" if params.nil?
@@ -239,10 +244,21 @@ module Gitlab
when MigrationStatus::OPT_OUT
true
when MigrationStatus::OPT_IN
- opt_into_all_features? && !EXPLICIT_OPT_IN_REQUIRED.include?(feature_name)
+ opt_into_all_features? && !explicit_opt_in_required.include?(feature_name)
else
false
end
+ rescue => ex
+ # During application startup feature lookups in SQL can fail
+ Rails.logger.warn "exception while checking Gitaly feature status for #{feature_name}: #{ex}"
+ false
+ end
+
+ # We have a mechanism to let GitLab automatically opt in to all Gitaly
+ # features. We want to be able to exclude some features from automatic
+ # opt-in. This function has an override in EE.
+ def self.explicit_opt_in_required
+ []
end
# opt_into_all_features? returns true when the current environment