Remove legacy query to find LFS objects that failed to sync

This removes the legacy queries to find LFS objects that
failed to syncsince we made Foreign Data Wrapper (FDW)
a hard requirement for Geo on GitLab 12.0.
parent 1ef88df7
......@@ -6,14 +6,6 @@ module Geo
current_node.lfs_objects.syncable
end
def lfs_objects_failed
legacy_inner_join_registry_ids(
syncable,
Geo::FileRegistry.lfs_objects.failed.pluck_file_key,
LfsObject
)
end
def lfs_objects_unsynced(except_file_ids:)
registry_file_ids = Geo::FileRegistry.lfs_objects.pluck_file_key | except_file_ids
......
......@@ -114,11 +114,7 @@ module Geo
end
def lfs_objects_failed
if use_legacy_queries_for_selective_sync?
legacy_finder.lfs_objects_failed
else
fdw_geo_node.lfs_objects.failed
end
fdw_geo_node.lfs_objects.failed
end
def lfs_objects_unsynced(except_file_ids:)
......
......@@ -797,88 +797,6 @@ describe Geo::LfsObjectRegistryFinder, :geo do
end
end
describe '#count_failed' do
it 'counts LFS objects that sync has failed' do
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_1.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_3.id)
expect(subject.count_failed).to eq 2
end
it 'ignores remote LFS objects' do
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_remote_1.id)
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_3.id)
expect(subject.count_failed).to eq 2
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 sync has failed' do
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_1.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_3.id)
expect(subject.count_failed).to eq 1
end
it 'ignores remote LFS objects' do
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_1.id)
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_3.id)
lfs_object_1.update_column(:file_store, ObjectStorage::Store::REMOTE)
expect(subject.count_failed).to eq 1
end
end
context 'with selective sync by shard' 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)
create(:lfs_objects_project, project: project_broken_storage, lfs_object: lfs_object_4)
create(:lfs_objects_project, project: project_broken_storage, lfs_object: lfs_object_5)
secondary.update!(selective_sync_type: 'shards', selective_sync_shards: ['broken'])
end
it 'counts LFS objects that sync has failed' do
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_1.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_3.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_4.id)
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_5.id)
expect(subject.count_failed).to eq 1
end
it 'ignores remote LFS objects' do
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_1.id)
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_3.id)
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_4.id)
create(:geo_file_registry, :lfs, :failed, file_id: lfs_object_5.id)
lfs_object_5.update_column(:file_store, ObjectStorage::Store::REMOTE)
expect(subject.count_failed).to eq 1
end
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)
......
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