Remove legacy query to find LFS objects missing no primary

This commit removes the legacy queries to find LFS objects
missing on primary since we made Foreign Data Wrapper (FDW)
a hard requirement for Geo on GitLab 12.0.
parent 277ce89d
......@@ -24,14 +24,6 @@ module Geo
)
end
def lfs_objects_synced_missing_on_primary
legacy_inner_join_registry_ids(
syncable,
Geo::FileRegistry.lfs_objects.synced.missing_on_primary.pluck_file_key,
LfsObject
)
end
def registries_for_lfs_objects
return Geo::FileRegistry.lfs_objects unless selective_sync?
......
......@@ -134,11 +134,7 @@ module Geo
end
def lfs_objects_synced_missing_on_primary
if use_legacy_queries_for_selective_sync?
legacy_finder.lfs_objects_synced_missing_on_primary
else
fdw_geo_node.lfs_objects.synced.missing_on_primary
end
fdw_geo_node.lfs_objects.synced.missing_on_primary
end
end
end
......@@ -797,61 +797,6 @@ describe Geo::LfsObjectRegistryFinder, :geo do
end
end
describe '#count_synced_missing_on_primary' do
it 'counts LFS objects that have been synced and are missing on the primary' do
create(:geo_file_registry, :lfs, file_id: lfs_object_1.id, missing_on_primary: true)
expect(subject.count_synced_missing_on_primary).to eq 1
end
it 'excludes LFS objects that are not missing on the primary' do
create(:geo_file_registry, :lfs, file_id: lfs_object_1.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id, missing_on_primary: true)
expect(subject.count_synced_missing_on_primary).to eq 1
end
it 'excludes LFS objects that are not synced' do
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_1.id, missing_on_primary: true)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id, missing_on_primary: true)
expect(subject.count_synced_missing_on_primary).to eq 1
end
it 'ignores remote LFS objects' do
create(:geo_file_registry, :lfs, file_id: lfs_object_remote_1.id, missing_on_primary: true)
expect(subject.count_synced_missing_on_primary).to eq 0
end
context 'with selective sync by namespace' do
before do
allow_any_instance_of(LfsObjectsProject).to receive(:update_project_statistics).and_return(nil)
create(:lfs_objects_project, project: synced_project, lfs_object: lfs_object_1)
create(:lfs_objects_project, project: synced_project, lfs_object: lfs_object_2)
create(:lfs_objects_project, project: unsynced_project, lfs_object: lfs_object_3)
secondary.update!(selective_sync_type: 'namespaces', namespaces: [synced_group])
end
it 'counts LFS objects that has been synced' do
create(:geo_file_registry, :lfs, file_id: lfs_object_1.id, missing_on_primary: true)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id, missing_on_primary: true)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id, missing_on_primary: true)
expect(subject.count_synced_missing_on_primary).to eq 2
end
it 'ignores remote LFS objects' do
create(:geo_file_registry, :lfs, file_id: lfs_object_remote_1.id, missing_on_primary: true)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id, missing_on_primary: true)
expect(subject.count_synced_missing_on_primary).to eq 1
end
end
end
include_examples 'finds all the things'
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