Commit 0f4009ad authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'cat-geo-obj-deduplication-first-sync' into 'master'

Fix object deduplication on Geo first sync

See merge request gitlab-org/gitlab!72605
parents 902a68cc f7fd7b03
......@@ -79,8 +79,11 @@ module Geo
fetch_geo_mirror(repository)
else
ensure_repository
fetch_geo_mirror(repository)
# Because we ensure a repository exists by this point, we need to
# mark it as new, even if fetching the mirror fails, we should run
# housekeeping to enable object deduplication to run
@new_repository = true
fetch_geo_mirror(repository)
end
update_root_ref
......
......@@ -60,8 +60,11 @@ module Geo
fetch_geo_mirror(repository)
else
ensure_repository
fetch_geo_mirror(repository)
# Because we ensure a repository exists by this point, we need to
# mark it as new, even if fetching the mirror fails, we should run
# housekeeping to enable object deduplication to run
@new_repository = true
fetch_geo_mirror(repository)
end
update_root_ref
......
......@@ -428,6 +428,13 @@ RSpec.describe Geo::RepositorySyncService, :geo do
subject.execute
end
it "indicates the repository is not new even with errors" do
allow(subject).to receive(:redownload_repository).and_raise(Gitlab::Shell::Error)
expect(Geo::ProjectHousekeepingService).to receive(:new).with(project, new_repository: false).and_call_original
subject.execute
end
end
context 'when repository did not exist' do
......@@ -441,6 +448,13 @@ RSpec.describe Geo::RepositorySyncService, :geo do
subject.execute
end
it "indicates the repository is new when there were errors" do
allow(subject).to receive(:fetch_geo_mirror).and_raise(Gitlab::Shell::Error)
expect(Geo::ProjectHousekeepingService).to receive(:new).with(project, new_repository: true).and_call_original
subject.execute
end
end
context 'when repository already existed' do
......@@ -449,5 +463,12 @@ RSpec.describe Geo::RepositorySyncService, :geo do
subject.execute
end
it "indicates the repository is not new even with errors" do
allow(subject).to receive(:fetch_geo_mirror).and_raise(Gitlab::Shell::Error)
expect(Geo::ProjectHousekeepingService).to receive(:new).with(project, new_repository: false).and_call_original
subject.execute
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