BigW Consortium Gitlab

Commit 61b123ae by Sean McGivern Committed by Robert Speicher

Merge branch 'zj-repo-gitaly' into 'master'

RepositoryExists is always called with #gitaly_migration Closes #38333 See merge request gitlab-org/gitlab-ce!14513
parent cf072a90
...@@ -488,13 +488,7 @@ class Repository ...@@ -488,13 +488,7 @@ class Repository
def exists? def exists?
return false unless full_path return false unless full_path
Gitlab::GitalyClient.migrate(:repository_exists) do |enabled| raw_repository.exists?
if enabled
raw_repository.exists?
else
refs_directory_exists?
end
end
end end
cache_method :exists? cache_method :exists?
...@@ -1123,12 +1117,6 @@ class Repository ...@@ -1123,12 +1117,6 @@ class Repository
blob.data blob.data
end end
def refs_directory_exists?
circuit_breaker.perform do
File.exist?(File.join(path_to_repo, 'refs'))
end
end
def cache def cache
# TODO: should we use UUIDs here? We could move repositories without clearing this cache # TODO: should we use UUIDs here? We could move repositories without clearing this cache
@cache ||= RepositoryCache.new(full_path, @project.id) @cache ||= RepositoryCache.new(full_path, @project.id)
...@@ -1186,10 +1174,6 @@ class Repository ...@@ -1186,10 +1174,6 @@ class Repository
Gitlab::Git::Repository.new(project.repository_storage, disk_path + '.git', Gitlab::GlRepository.gl_repository(project, false)) Gitlab::Git::Repository.new(project.repository_storage, disk_path + '.git', Gitlab::GlRepository.gl_repository(project, false))
end end
def circuit_breaker
@circuit_breaker ||= Gitlab::Git::Storage::CircuitBreaker.for_storage(project.repository_storage)
end
def find_commits_by_message_by_shelling_out(query, ref, path, limit, offset) def find_commits_by_message_by_shelling_out(query, ref, path, limit, offset)
ref ||= root_ref ref ||= root_ref
......
---
title: Gitaly RepositoryExists remains opt-in for all method calls
merge_request:
author:
type: fixed
...@@ -72,8 +72,6 @@ module Gitlab ...@@ -72,8 +72,6 @@ module Gitlab
delegate :empty?, delegate :empty?,
to: :rugged to: :rugged
delegate :exists?, to: :gitaly_repository_client
def ==(other) def ==(other)
path == other.path path == other.path
end end
...@@ -101,6 +99,18 @@ module Gitlab ...@@ -101,6 +99,18 @@ module Gitlab
@circuit_breaker ||= Gitlab::Git::Storage::CircuitBreaker.for_storage(storage) @circuit_breaker ||= Gitlab::Git::Storage::CircuitBreaker.for_storage(storage)
end end
def exists?
Gitlab::GitalyClient.migrate(:repository_exists) do |enabled|
if enabled
gitaly_repository_client.exists?
else
circuit_breaker.perform do
File.exist?(File.join(@path, 'refs'))
end
end
end
end
# Returns an Array of branch names # Returns an Array of branch names
# sorted by name ASC # sorted by name ASC
def branch_names def branch_names
......
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