diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /app/workers/concerns/git_garbage_collect_methods.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'app/workers/concerns/git_garbage_collect_methods.rb')
-rw-r--r-- | app/workers/concerns/git_garbage_collect_methods.rb | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/app/workers/concerns/git_garbage_collect_methods.rb b/app/workers/concerns/git_garbage_collect_methods.rb index 5c0493c9be5..c5f8c9c8464 100644 --- a/app/workers/concerns/git_garbage_collect_methods.rb +++ b/app/workers/concerns/git_garbage_collect_methods.rb @@ -82,28 +82,12 @@ module GitGarbageCollectMethods def gitaly_call(task, resource) repository = resource.repository.raw_repository + client = repository.gitaly_repository_client - if Feature.enabled?(:optimized_housekeeping, container(resource)) - client = repository.gitaly_repository_client - - if task == :prune - client.prune_unreachable_objects - else - client.optimize_repository - end + if task == :prune + client.prune_unreachable_objects else - client = get_gitaly_client(task, repository) - - case task - when :prune, :gc - client.garbage_collect(bitmaps_enabled?, prune: task == :prune) - when :full_repack - client.repack_full(bitmaps_enabled?) - when :incremental_repack - client.repack_incremental - when :pack_refs - client.pack_refs - end + client.optimize_repository end rescue GRPC::NotFound => e Gitlab::GitLogger.error("#{__method__} failed:\nRepository not found") @@ -113,22 +97,6 @@ module GitGarbageCollectMethods raise Gitlab::Git::CommandError, e end - def get_gitaly_client(task, repository) - if task == :pack_refs - Gitlab::GitalyClient::RefService - else - Gitlab::GitalyClient::RepositoryService - end.new(repository) - end - - # The option to enable/disable bitmaps has been removed in https://gitlab.com/gitlab-org/gitlab/-/issues/353777 - # Now the options is always enabled - # This method and all the deprecated RPCs are going to be removed in - # https://gitlab.com/gitlab-org/gitlab/-/issues/353779 - def bitmaps_enabled? - true - end - def flush_ref_caches(resource) resource.repository.expire_branches_cache resource.repository.branch_names @@ -136,8 +104,6 @@ module GitGarbageCollectMethods end def update_repository_statistics(resource, task) - return if task == :pack_refs - resource.repository.expire_statistics_caches return if Gitlab::Database.read_only? # GitGarbageCollectWorker may be run on a Geo secondary |