Commit 4cc13e63 authored by Toon Claes's avatar Toon Claes

Prunes whole Geo event when there's only a primary

When there is only a primary node configured, but no secondary nodes,
prune the complete Geo event log.

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/9712
parent 328f36f3
......@@ -13,7 +13,7 @@ module Geo
return if Gitlab::Database.read_only?
return unless Gitlab::Database.healthy?
unless ::GeoNode.any?
unless ::GeoNode.secondary_nodes.any?
Geo::PruneEventLogService.new(:all).execute
return
end
......
---
title: Prunes whole Geo event when there's only a primary
merge_request: 9630
author:
type: fixed
......@@ -59,10 +59,9 @@ describe Geo::PruneEventLogWorker, :geo do
worker.perform
end
context 'no Geo nodes' do
context 'no Geo secondary nodes' do
before do
secondary.destroy
primary.destroy
end
it 'deletes everything from the Geo event log' do
......@@ -72,6 +71,20 @@ describe Geo::PruneEventLogWorker, :geo do
worker.perform
end
context 'no Geo primary node' do
before do
primary.destroy
end
it 'deletes everything from the Geo event log' do
create_list(:geo_event_log, 2)
expect(Geo::PruneEventLogService).to receive(:new).with(:all).and_call_original
worker.perform
end
end
end
context 'multiple secondary nodes' do
......
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