BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
705c15d7
Commit
705c15d7
authored
Oct 19, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow enabling the circuitbreaker using an env variable
That way we can enable the circuitbreaker for just one host at a time.
parent
591ee4e3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
3 deletions
+32
-3
repository_storage_paths.md
doc/administration/repository_storage_paths.md
+9
-0
circuit_breaker.rb
lib/gitlab/git/storage/circuit_breaker.rb
+10
-1
circuit_breaker_spec.rb
spec/lib/gitlab/git/storage/circuit_breaker_spec.rb
+13
-2
No files found.
doc/administration/repository_storage_paths.md
View file @
705c15d7
...
...
@@ -131,6 +131,15 @@ mount is reset.
**Seconds to wait for a storage access attempt:**
The time in seconds GitLab will
try to access storage. After this time a timeout error will be raised.
To enable the circuitbreaker for repository storage you can flip the feature flag from a rails console:
```
Feature.enable('git_storage_circuit_breaker')
```
Alternatively it can be enabled by setting
`true`
in the
`GIT_STORAGE_CIRCUIT_BREAKER`
environment variable.
This approach would be used when enabling the circuit breaker on a single host.
When storage failures occur, this will be visible in the admin interface like this:
![
failing storage
](
img/failing_storage.png
)
...
...
lib/gitlab/git/storage/circuit_breaker.rb
View file @
705c15d7
...
...
@@ -54,7 +54,7 @@ module Gitlab
end
def
perform
return
yield
unless
Feature
.
enabled?
(
'git_storage_circuit_breaker'
)
return
yield
unless
enabled?
check_storage_accessible!
...
...
@@ -78,6 +78,15 @@ module Gitlab
private
# The circuitbreaker can be enabled for the entire fleet using a Feature
# flag.
#
# Enabling it for a single host can be done setting the
# `GIT_STORAGE_CIRCUIT_BREAKER` environment variable.
def
enabled?
ENV
[
'GIT_STORAGE_CIRCUIT_BREAKER'
].
present?
||
Feature
.
enabled?
(
'git_storage_circuit_breaker'
)
end
def
failure_info
@failure_info
||=
get_failure_info
end
...
...
spec/lib/gitlab/git/storage/circuit_breaker_spec.rb
View file @
705c15d7
...
...
@@ -200,10 +200,21 @@ describe Gitlab::Git::Storage::CircuitBreaker, clean_gitlab_redis_shared_state:
end
context
'with the feature disabled'
do
it
'returns the block without checking accessibility'
do
before
do
stub_feature_flags
(
git_storage_circuit_breaker:
false
)
end
it
'returns the block without checking accessibility'
do
expect
(
circuit_breaker
).
not_to
receive
(
:check_storage_accessible!
)
result
=
circuit_breaker
.
perform
{
'hello'
}
expect
(
result
).
to
eq
(
'hello'
)
end
expect
(
circuit_breaker
).
not_to
receive
(
:circuit_broken?
)
it
'allows enabling the feature using an ENV var'
do
stub_env
(
'GIT_STORAGE_CIRCUIT_BREAKER'
,
'true'
)
expect
(
circuit_breaker
).
to
receive
(
:check_storage_accessible!
)
result
=
circuit_breaker
.
perform
{
'hello'
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment