Commit 2e7248c0 authored by Michael Kozono's avatar Michael Kozono Committed by James Fargher

Fix inaccurate "synchronization disabled"

When object storage is configured on a secondary,
and "Allow syncing of object storage" is disabled,
it is inaccurate to say "Synchronization disabled" on
the Admin Area > Geo > Nodes progress bars.

This is because locally stored records can still exist
and be created.
parent d6f7cbd1
......@@ -41,8 +41,4 @@ class Geo::JobArtifactRegistry < Geo::BaseRegistry
delete_worker_class.perform_async(:job_artifact, artifact_id)
end
end
def self.replication_enabled?
JobArtifactUploader.object_store_enabled? ? Gitlab::Geo.current_node.sync_object_storage? : true
end
end
......@@ -60,10 +60,6 @@ class Geo::UploadRegistry < Geo::BaseRegistry
end
end
def self.replication_enabled?
FileUploader.object_store_enabled? ? Gitlab::Geo.current_node.sync_object_storage? : true
end
def file
upload&.path || s_('Removed %{type} with id %{id}') % { type: file_type, id: file_id }
end
......
---
title: 'Geo: Fix Attachments and Job artifacts showing "Synchronization disabled"'
merge_request: 36492
author:
type: fixed
......@@ -23,30 +23,4 @@ RSpec.describe Geo::JobArtifactRegistry, :geo do
expect(described_class.where(id: ids).pluck(:success)).to eq([false])
end
end
describe '.replication_enabled?' do
context 'when Object Storage is enabled' do
before do
allow(JobArtifactUploader).to receive(:object_store_enabled?).and_return(true)
end
it 'returns true when Geo Object Storage replication is enabled' do
stub_current_geo_node(double(sync_object_storage?: true))
expect(Geo::JobArtifactRegistry.replication_enabled?).to be_truthy
end
it 'returns false when Geo Object Storage replication is disabled' do
stub_current_geo_node(double(sync_object_storage?: false))
expect(Geo::JobArtifactRegistry.replication_enabled?).to be_falsey
end
end
it 'returns true when Object Storage is disabled' do
allow(JobArtifactUploader).to receive(:object_store_enabled?).and_return(false)
expect(Geo::JobArtifactRegistry.replication_enabled?).to be_truthy
end
end
end
......@@ -107,28 +107,4 @@ RSpec.describe Geo::UploadRegistry, :geo, :geo_fdw do
expect(failed.synchronization_state).to eq(:failed)
end
end
describe '.replication_enabled?' do
context 'when Object Storage is enabled' do
before do
allow(FileUploader).to receive(:object_store_enabled?).and_return(true)
end
it 'returns true when Geo Object Storage replication is enabled' do
stub_current_geo_node(double(sync_object_storage?: true))
expect(Geo::UploadRegistry.replication_enabled?).to be_truthy
end
it 'returns false when Geo Object Storage replication is disabled' do
stub_current_geo_node(double(sync_object_storage?: false))
expect(Geo::UploadRegistry.replication_enabled?).to be_falsey
end
end
it 'returns true when Object Storage is disabled' do
expect(Geo::UploadRegistry.replication_enabled?).to be_truthy
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