Commit 1c1fdc02 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

Repos leave object pool when moving to a new shard

When a project's repositories are moved to a new shard, the pool
repository is still located at the old shard. This doesn't work anymore,
as git doesn't have access to that.

The unlink RPC is called as it cleans up the remote. The alternate file
is removed too, which doesn't exist, but this doesn't fail the move.

Fixes: https://gitlab.com/gitlab-org/gitlab-ee/issues/9094
parent b45af1c3
......@@ -19,6 +19,7 @@ module Projects
mark_old_paths_for_archive
project.update(repository_storage: new_repository_storage_key, repository_read_only: false)
project.leave_pool_repository
project.track_project_repository
else
project.update(repository_read_only: false)
......
---
title: Moving repository across shards leaves the pool
merge_request:
author:
type: added
......@@ -46,7 +46,7 @@ describe Projects::UpdateRepositoryStorageService do
end
end
context 'with wiki', :disable_gitaly do
context 'with wiki' do
let(:project) { create(:project, :repository, repository_read_only: true, wiki_enabled: true) }
let(:repository_double) { double(:repository) }
let(:wiki_repository_double) { double(:repository) }
......@@ -105,5 +105,18 @@ describe Projects::UpdateRepositoryStorageService do
end
end
end
context 'when a object pool was joined' do
let(:project) { create(:project, :repository, wiki_enabled: false, repository_read_only: true) }
let(:pool) { create(:pool_repository, :ready, source_project: project) }
it 'leaves the pool' do
allow_any_instance_of(Gitlab::Git::Repository).to receive(:fetch_repository_as_mirror).and_return(true)
subject.execute('test_second_storage')
expect(project.reload_pool_repository).to be_nil
end
end
end
end
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