Skip to content

Commit 7572303

Browse files
author
Douwe Maan
committed
Merge branch 'zj-circuit-breaker-removal' into 'master'
Remove Git circuit breaker Closes #45405 See merge request gitlab-org/gitlab-ce!22212
2 parents 8921840 + 30b4ce9 commit 7572303

File tree

61 files changed

+65
-2058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+65
-2058
lines changed

app/controllers/admin/health_check_controller.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,5 @@
33
class Admin::HealthCheckController < Admin::ApplicationController
44
def show
55
@errors = HealthCheck::Utils.process_checks(['standard'])
6-
@failing_storage_statuses = Gitlab::Git::Storage::Health.for_failing_storages
7-
end
8-
9-
def reset_storage_health
10-
Gitlab::Git::Storage::FailureInfo.reset_all!
11-
redirect_to admin_health_check_path,
12-
notice: _('Git storage health information has been reset')
136
end
147
end

app/controllers/application_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class ApplicationController < ActionController::Base
6666
head :forbidden, retry_after: Gitlab::Auth::UniqueIpsLimiter.config.unique_ips_limit_time_window
6767
end
6868

69-
rescue_from Gitlab::Git::Storage::Inaccessible, GRPC::Unavailable, Gitlab::Git::CommandError do |exception|
69+
rescue_from GRPC::Unavailable, Gitlab::Git::CommandError do |exception|
7070
log_exception(exception)
7171

7272
headers['Retry-After'] = exception.retry_after if exception.respond_to?(:retry_after)

app/controllers/health_controller.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
class HealthController < ActionController::Base
4-
protect_from_forgery with: :exception, except: :storage_check, prepend: true
4+
protect_from_forgery with: :exception, prepend: true
55
include RequiresWhitelistedMonitoringClient
66

77
CHECKS = [
@@ -25,15 +25,6 @@ def liveness
2525
render_check_results(results)
2626
end
2727

28-
def storage_check
29-
results = Gitlab::Git::Storage::Checker.check_all
30-
31-
render json: {
32-
check_interval: Gitlab::CurrentSettings.current_application_settings.circuitbreaker_check_interval,
33-
results: results
34-
}
35-
end
36-
3728
private
3829

3930
def render_check_results(results)

app/helpers/application_settings_helper.rb

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -108,37 +108,6 @@ def repository_storages_options_for_select(selected)
108108
options_for_select(options, selected)
109109
end
110110

111-
def circuitbreaker_failure_count_help_text
112-
health_link = link_to(s_('AdminHealthPageLink|health page'), admin_health_check_path)
113-
api_link = link_to(s_('CircuitBreakerApiLink|circuitbreaker api'), help_page_path("api/repository_storage_health"))
114-
message = _("The number of failures of after which GitLab will completely "\
115-
"prevent access to the storage. The number of failures can be "\
116-
"reset in the admin interface: %{link_to_health_page} or using "\
117-
"the %{api_documentation_link}.")
118-
message = message % { link_to_health_page: health_link, api_documentation_link: api_link }
119-
120-
message.html_safe
121-
end
122-
123-
def circuitbreaker_access_retries_help_text
124-
_('The number of attempts GitLab will make to access a storage.')
125-
end
126-
127-
def circuitbreaker_failure_reset_time_help_text
128-
_("The time in seconds GitLab will keep failure information. When no "\
129-
"failures occur during this time, information about the mount is reset.")
130-
end
131-
132-
def circuitbreaker_storage_timeout_help_text
133-
_("The time in seconds GitLab will try to access storage. After this time a "\
134-
"timeout error will be raised.")
135-
end
136-
137-
def circuitbreaker_check_interval_help_text
138-
_("The time in seconds between storage checks. When a previous check did "\
139-
"complete yet, GitLab will skip a check.")
140-
end
141-
142111
def visible_attributes
143112
[
144113
:admin_notification_email,
@@ -150,11 +119,6 @@ def visible_attributes
150119
:authorized_keys_enabled,
151120
:auto_devops_enabled,
152121
:auto_devops_domain,
153-
:circuitbreaker_access_retries,
154-
:circuitbreaker_check_interval,
155-
:circuitbreaker_failure_count_threshold,
156-
:circuitbreaker_failure_reset_time,
157-
:circuitbreaker_storage_timeout,
158122
:clientside_sentry_dsn,
159123
:clientside_sentry_enabled,
160124
:container_registry_token_expire_delay,

app/helpers/storage_health_helper.rb

Lines changed: 0 additions & 34 deletions
This file was deleted.

app/models/application_setting.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class ApplicationSetting < ActiveRecord::Base
44
include CacheableAttributes
55
include CacheMarkdownField
66
include TokenAuthenticatable
7+
include IgnorableColumn
78

89
add_authentication_token_field :runners_registration_token
910
add_authentication_token_field :health_check_access_token
@@ -27,6 +28,12 @@ class ApplicationSetting < ActiveRecord::Base
2728
serialize :domain_blacklist, Array # rubocop:disable Cop/ActiveRecordSerialize
2829
serialize :repository_storages # rubocop:disable Cop/ActiveRecordSerialize
2930

31+
ignore_column :circuitbreaker_failure_count_threshold
32+
ignore_column :circuitbreaker_failure_reset_time
33+
ignore_column :circuitbreaker_storage_timeout
34+
ignore_column :circuitbreaker_access_retries
35+
ignore_column :circuitbreaker_check_interval
36+
3037
cache_markdown_field :sign_in_text
3138
cache_markdown_field :help_page_text
3239
cache_markdown_field :shared_runners_text, pipeline: :plain_markdown
@@ -150,17 +157,6 @@ class ApplicationSetting < ActiveRecord::Base
150157
presence: true,
151158
numericality: { greater_than_or_equal_to: 0 }
152159

153-
validates :circuitbreaker_failure_count_threshold,
154-
:circuitbreaker_failure_reset_time,
155-
:circuitbreaker_storage_timeout,
156-
:circuitbreaker_check_interval,
157-
presence: true,
158-
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
159-
160-
validates :circuitbreaker_access_retries,
161-
presence: true,
162-
numericality: { only_integer: true, greater_than_or_equal_to: 1 }
163-
164160
validates :gitaly_timeout_default,
165161
presence: true,
166162
numericality: { only_integer: true, greater_than_or_equal_to: 0 }

app/views/admin/application_settings/_repository_storage.html.haml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,5 @@
2020
Manage repository storage paths. Learn more in the
2121
= succeed "." do
2222
= link_to "repository storages documentation", help_page_path("administration/repository_storage_paths")
23-
.sub-section
24-
%h4 Circuit breaker
25-
.form-group
26-
= f.label :circuitbreaker_check_interval, _('Check interval'), class: 'label-bold'
27-
= f.number_field :circuitbreaker_check_interval, class: 'form-control'
28-
.form-text.text-muted
29-
= circuitbreaker_check_interval_help_text
30-
.form-group
31-
= f.label :circuitbreaker_access_retries, _('Number of access attempts'), class: 'label-bold'
32-
= f.number_field :circuitbreaker_access_retries, class: 'form-control'
33-
.form-text.text-muted
34-
= circuitbreaker_access_retries_help_text
35-
.form-group
36-
= f.label :circuitbreaker_storage_timeout, _('Seconds to wait for a storage access attempt'), class: 'label-bold'
37-
= f.number_field :circuitbreaker_storage_timeout, class: 'form-control'
38-
.form-text.text-muted
39-
= circuitbreaker_storage_timeout_help_text
40-
.form-group
41-
= f.label :circuitbreaker_failure_count_threshold, _('Maximum git storage failures'), class: 'label-bold'
42-
= f.number_field :circuitbreaker_failure_count_threshold, class: 'form-control'
43-
.form-text.text-muted
44-
= circuitbreaker_failure_count_help_text
45-
.form-group
46-
= f.label :circuitbreaker_failure_reset_time, _('Seconds before reseting failure information'), class: 'label-bold'
47-
= f.number_field :circuitbreaker_failure_reset_time, class: 'form-control'
48-
.form-text.text-muted
49-
= circuitbreaker_failure_reset_time_help_text
5023

5124
= f.submit 'Save changes', class: "btn btn-success qa-save-changes-button"

app/views/admin/application_settings/repository.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
2121
= expanded_by_default? ? _('Collapse') : _('Expand')
2222
%p
23-
= _('Configure storage path and circuit breaker settings.')
23+
= _('Configure storage path settings.')
2424
.settings-content
2525
= render 'repository_storage'
2626

app/views/admin/health_check/_failing_storages.html.haml

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/views/admin/health_check/show.html.haml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- @no_container = true
22
- page_title _('Health Check')
3-
- no_errors = @errors.blank? && @failing_storage_statuses.blank?
3+
- no_errors = @errors.blank?
44

55
%div{ class: container_class }
66
%h3.page-title= page_title
@@ -39,4 +39,3 @@
3939
#{ s_('HealthCheck|No Health Problems Detected') }
4040
- else
4141
= @errors
42-
= render partial: 'failing_storages', object: @failing_storage_statuses

0 commit comments

Comments
 (0)