Commit 5f8c67bd authored by Nick Thomas's avatar Nick Thomas

Merge branch...

Merge branch '6011-geo-deleted-project-events-may-be-skipped-on-the-secondary-when-selective-sync-is-used' into 'master'

Resolve "Geo: Deleted project events may be skipped on the secondary when selective sync is used"

Closes #6011

See merge request gitlab-org/gitlab-ee!5903
parents 40c7124e 99ee16b3
---
title: "[Geo] Fix: Deleted project events may be skipped on the secondary when selective
sync is used"
merge_request:
author:
type: fixed
......@@ -82,6 +82,9 @@ module Gitlab
def can_replay?(event_log)
return true if event_log.project_id.nil?
# Always replay events for deleted projects
return true unless Project.exists?(event_log.project_id)
Gitlab::Geo.current_node&.projects_include?(event_log.project_id)
end
......
......@@ -35,6 +35,19 @@ describe Gitlab::Geo::LogCursor::Events::RepositoryDeletedEvent, :postgresql, :c
it 'removes the tracking entry' do
expect { subject.process }.to change(Geo::ProjectRegistry, :count).by(-1)
end
context 'when selective sync is enabled' do
let(:secondary) { create(:geo_node, selective_sync_type: 'namespaces', namespaces: [project.namespace]) }
it 'replays delete events when project does not exist on primary' do
project.delete
expect(::GeoRepositoryDestroyWorker).to receive(:perform_async)
.with(project.id, deleted_project_name, deleted_path, project.repository_storage)
subject.process
end
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