Commit Graph

20 Commits

Author SHA1 Message Date
Jacob Vosmaer (GitLab) edb9db37ed Add "deny disk access" Gitaly feature (tripswitch) 2018-06-01 11:56:29 +00:00
Jacob Vosmaer 008a6a6ce6 Route path lookups through legacy_disk_path 2018-03-21 18:18:32 +01:00
🙈 jacopo beschi 🙉 729f05f0e3 Adds Rubocop rule for line break around conditionals 2018-01-11 16:34:01 +00:00
Bob Van Landuyt d4d06bded1 Keep track of storage check timings 2017-12-11 13:18:39 +01:00
Bob Van Landuyt f1ae1e39ce Move the circuitbreaker check out in a separate process
Moving the check out of the general requests, makes sure we don't have
any slowdown in the regular requests.

To keep the process performing this checks small, the check is still
performed inside a unicorn. But that is called from a process running
on the same server.

Because the checks are now done outside normal request, we can have a
simpler failure strategy:

The check is now performed in the background every
`circuitbreaker_check_interval`. Failures are logged in redis. The
failures are reset when the check succeeds. Per check we will try
`circuitbreaker_access_retries` times within
`circuitbreaker_storage_timeout` seconds.

When the number of failures exceeds
`circuitbreaker_failure_count_threshold`, we will block access to the
storage.

After `failure_reset_time` of no checks, we will clear the stored
failures. This could happen when the process that performs the checks
is not running.
2017-12-08 09:11:39 +01:00
Bob Van Landuyt b72d243872 Keep track of all storage keys in a set
That way we don't need the to scan the entire keyspace to get all
known keys
2017-12-01 17:50:43 +01:00
Bob Van Landuyt 705c15d7af Allow enabling the circuitbreaker using an env variable
That way we can enable the circuitbreaker for just one host at a time.
2017-10-23 13:53:49 +03:00
Bob Van Landuyt 591ee4e361 Perform the stat check multiple times when checking a storage
Instead of only checking once within a timeout, check multiple times
within a timeout.

That means with a timeout of 30 seconds and 3 retries. Each try would
be allowed 20 seconds.
2017-10-23 13:53:49 +03:00
Bob Van Landuyt 430e767139 Implement backoff for the circuitbreaker
The circuitbreaker now has 2 failure modes:

- Backing off: This will raise the `Gitlab::Git::Storage::Failing`
  exception. Access to the shard is blocked temporarily.
- Circuit broken: This will raise the
  `Gitlab::Git::Storage::CircuitBroken` exception. Access to the shard
  will be blocked until the failures are reset.
2017-10-23 12:02:23 +03:00
Rémy Coutable 89f5ede2a3 Merge branch 'bvl-do-not-use-redis-keys' into 'master'
Avoid using `Redis#keys`

See merge request gitlab-org/gitlab-ce!14889
2017-10-17 16:15:44 +00:00
Bob Van Landuyt c365dea887 Don't use `Redis#keys` in the circuitbreaker 2017-10-17 12:47:20 +02:00
Bob Van Landuyt 619021fd7a Read circuitbreaker settings from `Gitlab::CurrentSettings`
Instead of from the configuration file
2017-10-17 11:50:32 +02:00
Nick Thomas ba0ebbb510 Allow the git circuit breaker to correctly handle missing repository storages 2017-09-22 10:05:28 +01:00
Bob Van Landuyt 4b34720c0c Use ruby's `File.stat` to check storage availability 2017-08-04 15:38:50 +02:00
Bob Van Landuyt 3a2aaed881 Use a Struct to keep track of failure info 2017-08-04 15:38:50 +02:00
Bob Van Landuyt 0dd4c306ca Only track accessibility once 2017-08-04 15:38:50 +02:00
Bob Van Landuyt 022c38e63e Use `keys` instead of `scan_each` 2017-08-04 15:38:49 +02:00
Bob Van Landuyt 3899d07f9e Move hostname to Gitlab::Environment 2017-08-04 15:38:49 +02:00
Bob Van Landuyt 0fa94a0ddd Make sure the check works for paths with spaces. 2017-08-04 15:38:49 +02:00
Bob Van Landuyt 3598e60bf2 Add a Circuitbreaker for storage paths 2017-08-04 15:38:48 +02:00