Rename find_retryable_dirty_registries method

Refactor code to make the finder class
closer to a Geo replicator.
parent 2442d007
...@@ -2,18 +2,6 @@ ...@@ -2,18 +2,6 @@
module Geo module Geo
class ContainerRepositoryRegistryFinder < RegistryFinder class ContainerRepositoryRegistryFinder < RegistryFinder
# rubocop:disable CodeReuse/ActiveRecord
def find_retryable_dirty_registries(batch_size:, except_ids: [])
registry_class
.retryable
.model_id_not_in(except_ids)
.order(Gitlab::Database.nulls_first_order(:last_synced_at))
.limit(batch_size)
end
# rubocop:enable CodeReuse/ActiveRecord
private
def replicables def replicables
current_node.container_repositories current_node.container_repositories
end end
......
...@@ -2,18 +2,6 @@ ...@@ -2,18 +2,6 @@
module Geo module Geo
class DesignRegistryFinder < RegistryFinder class DesignRegistryFinder < RegistryFinder
# rubocop:disable CodeReuse/ActiveRecord
def find_retryable_dirty_registries(batch_size:, except_ids: [])
registry_class
.retryable
.model_id_not_in(except_ids)
.order(Gitlab::Database.nulls_first_order(:last_synced_at))
.limit(batch_size)
end
# rubocop:enable CodeReuse/ActiveRecord
private
def replicables def replicables
current_node.designs current_node.designs
end end
......
...@@ -9,23 +9,6 @@ module Geo ...@@ -9,23 +9,6 @@ module Geo
registry_class.synced.missing_on_primary.count registry_class.synced.missing_on_primary.count
end end
# @!method find_retryable_failed_registries
# Return an ActiveRecord::Relation of registry records marked as failed,
# which are ready to be retried, excluding specified IDs, limited to
# batch_size
#
# @param [Integer] batch_size used to limit the results returned
# @param [Array<Integer>] except_ids ids that will be ignored from the query
#
# rubocop:disable CodeReuse/ActiveRecord
def find_retryable_failed_registries(batch_size:, except_ids: [])
registry_class
.retryable
.model_id_not_in(except_ids)
.limit(batch_size)
end
# rubocop:enable CodeReuse/ActiveRecord
# @!method find_retryable_synced_missing_on_primary_registries # @!method find_retryable_synced_missing_on_primary_registries
# Return an ActiveRecord::Relation of registry records marked as synced # Return an ActiveRecord::Relation of registry records marked as synced
# and missing on the primary, which are ready to be retried, excluding # and missing on the primary, which are ready to be retried, excluding
......
...@@ -11,7 +11,7 @@ module Geo ...@@ -11,7 +11,7 @@ module Geo
# #
# Any registries that have ever been synced that currently need to be # Any registries that have ever been synced that currently need to be
# resynced will be handled by other find methods (like # resynced will be handled by other find methods (like
# #find_retryable_dirty_registries) # #find_failed_registries)
# #
# You can pass a list with `except_ids:` so you can exclude items you # You can pass a list with `except_ids:` so you can exclude items you
# already scheduled but haven't finished and aren't persisted to the database yet # already scheduled but haven't finished and aren't persisted to the database yet
...@@ -20,7 +20,7 @@ module Geo ...@@ -20,7 +20,7 @@ module Geo
# @param [Array<Integer>] except_ids ids that will be ignored from the query # @param [Array<Integer>] except_ids ids that will be ignored from the query
# rubocop:disable CodeReuse/ActiveRecord # rubocop:disable CodeReuse/ActiveRecord
def find_never_synced_registries(batch_size:, except_ids: []) def find_never_synced_registries(batch_size:, except_ids: [])
Geo::ProjectRegistry registry_class
.never_synced .never_synced
.model_id_not_in(except_ids) .model_id_not_in(except_ids)
.limit(batch_size) .limit(batch_size)
...@@ -28,18 +28,15 @@ module Geo ...@@ -28,18 +28,15 @@ module Geo
# rubocop:enable CodeReuse/ActiveRecord # rubocop:enable CodeReuse/ActiveRecord
# rubocop:disable CodeReuse/ActiveRecord # rubocop:disable CodeReuse/ActiveRecord
def find_retryable_dirty_registries(batch_size:, except_ids: []) def find_failed_registries(batch_size:, except_ids: [])
Geo::ProjectRegistry registry_class
.retryable .find_failed_registries(batch_size: batch_size, except_ids: except_ids)
.model_id_not_in(except_ids)
.order(Gitlab::Database.nulls_first_order(:last_repository_synced_at))
.limit(batch_size)
end end
# rubocop:enable CodeReuse/ActiveRecord # rubocop:enable CodeReuse/ActiveRecord
# rubocop:disable CodeReuse/ActiveRecord # rubocop:disable CodeReuse/ActiveRecord
def find_project_ids_pending_verification(batch_size:, except_ids: []) def find_project_ids_pending_verification(batch_size:, except_ids: [])
Geo::ProjectRegistry registry_class
.from_union([ .from_union([
repositories_checksummed_pending_verification, repositories_checksummed_pending_verification,
wikis_checksummed_pending_verification wikis_checksummed_pending_verification
...@@ -52,19 +49,23 @@ module Geo ...@@ -52,19 +49,23 @@ module Geo
private private
def registry_class
Geo::ProjectRegistry
end
# rubocop:disable CodeReuse/ActiveRecord # rubocop:disable CodeReuse/ActiveRecord
def repositories_checksummed_pending_verification def repositories_checksummed_pending_verification
Geo::ProjectRegistry registry_class
.repositories_checksummed_pending_verification .repositories_checksummed_pending_verification
.select(Geo::ProjectRegistry.arel_table[:project_id]) .select(registry_class.arel_table[:project_id])
end end
# rubocop:enable CodeReuse/ActiveRecord # rubocop:enable CodeReuse/ActiveRecord
# rubocop:disable CodeReuse/ActiveRecord # rubocop:disable CodeReuse/ActiveRecord
def wikis_checksummed_pending_verification def wikis_checksummed_pending_verification
Geo::ProjectRegistry registry_class
.wikis_checksummed_pending_verification .wikis_checksummed_pending_verification
.select(Geo::ProjectRegistry.arel_table[:project_id]) .select(registry_class.arel_table[:project_id])
end end
# rubocop:enable CodeReuse/ActiveRecord # rubocop:enable CodeReuse/ActiveRecord
end end
......
...@@ -49,7 +49,7 @@ module Geo ...@@ -49,7 +49,7 @@ module Geo
# #
# Any registries that have ever been synced that currently need to be # Any registries that have ever been synced that currently need to be
# resynced will be handled by other find methods (like # resynced will be handled by other find methods (like
# #find_retryable_failed_registries) # #find_failed_registries)
# #
# You can pass a list with `except_ids:` so you can exclude items you # You can pass a list with `except_ids:` so you can exclude items you
# already scheduled but haven't finished and aren't persisted to the database yet # already scheduled but haven't finished and aren't persisted to the database yet
...@@ -66,6 +66,21 @@ module Geo ...@@ -66,6 +66,21 @@ module Geo
end end
# rubocop:enable CodeReuse/ActiveRecord # rubocop:enable CodeReuse/ActiveRecord
# @!method find_failed_registries
# Return an ActiveRecord::Relation of registry records marked as failed,
# which are ready to be retried, excluding specified IDs, limited to
# batch_size
#
# @param [Integer] batch_size used to limit the results returned
# @param [Array<Integer>] except_ids ids that will be ignored from the query
#
# rubocop:disable CodeReuse/ActiveRecord
def find_failed_registries(batch_size:, except_ids: [])
registry_class
.find_failed_registries(batch_size: batch_size, except_ids: except_ids)
end
# rubocop:enable CodeReuse/ActiveRecord
# @!method registry_class # @!method registry_class
# Return an ActiveRecord::Base class for the tracked type # Return an ActiveRecord::Base class for the tracked type
def registry_class def registry_class
......
...@@ -46,6 +46,11 @@ class Geo::ContainerRepositoryRegistry < Geo::BaseRegistry ...@@ -46,6 +46,11 @@ class Geo::ContainerRepositoryRegistry < Geo::BaseRegistry
finder_class.new(current_node_id: Gitlab::Geo.current_node.id).find_registry_differences(range) finder_class.new(current_node_id: Gitlab::Geo.current_node.id).find_registry_differences(range)
end end
def self.find_failed_registries(batch_size:, except_ids: [])
super
.order(Gitlab::Database.nulls_first_order(:last_synced_at))
end
def self.delete_for_model_ids(container_repository_ids) def self.delete_for_model_ids(container_repository_ids)
where(container_repository_id: container_repository_ids).delete_all where(container_repository_id: container_repository_ids).delete_all
......
...@@ -59,6 +59,11 @@ class Geo::DesignRegistry < Geo::BaseRegistry ...@@ -59,6 +59,11 @@ class Geo::DesignRegistry < Geo::BaseRegistry
finder_class.new(current_node_id: Gitlab::Geo.current_node.id).find_registry_differences(range) finder_class.new(current_node_id: Gitlab::Geo.current_node.id).find_registry_differences(range)
end end
def self.find_failed_registries(batch_size:, except_ids: [])
super
.order(Gitlab::Database.nulls_first_order(:last_synced_at))
end
# Search for a list of projects associated with registries, # Search for a list of projects associated with registries,
# based on the query given in `query`. # based on the query given in `query`.
# #
......
...@@ -54,6 +54,11 @@ class Geo::ProjectRegistry < Geo::BaseRegistry ...@@ -54,6 +54,11 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
[untracked_ids, unused_tracked_ids] [untracked_ids, unused_tracked_ids]
end end
def self.find_failed_registries(batch_size:, except_ids: [])
super
.order(Gitlab::Database.nulls_first_order(:last_repository_synced_at))
end
def self.delete_worker_class def self.delete_worker_class
::GeoRepositoryDestroyWorker ::GeoRepositoryDestroyWorker
end end
......
...@@ -54,7 +54,7 @@ module Geo ...@@ -54,7 +54,7 @@ module Geo
def find_retryable_container_registry_ids(batch_size:) def find_retryable_container_registry_ids(batch_size:)
registry_finder registry_finder
.find_retryable_dirty_registries(batch_size: batch_size, except_ids: scheduled_repository_ids) .find_failed_registries(batch_size: batch_size, except_ids: scheduled_repository_ids)
.pluck_model_foreign_key .pluck_model_foreign_key
end end
......
...@@ -25,7 +25,7 @@ module Geo ...@@ -25,7 +25,7 @@ module Geo
def find_project_ids_updated_recently(except_ids:, batch_size:) def find_project_ids_updated_recently(except_ids:, batch_size:)
project_ids = project_ids =
registry_finder registry_finder
.find_retryable_dirty_registries(batch_size: batch_size, except_ids: except_ids) .find_failed_registries(batch_size: batch_size, except_ids: except_ids)
.pluck_model_foreign_key .pluck_model_foreign_key
find_project_ids_within_shard(project_ids, direction: :asc) find_project_ids_within_shard(project_ids, direction: :asc)
......
...@@ -29,7 +29,7 @@ module Geo ...@@ -29,7 +29,7 @@ module Geo
def find_failed_jobs(batch_size:) def find_failed_jobs(batch_size:)
convert_registry_relation_to_job_args( convert_registry_relation_to_job_args(
registry_finder.find_retryable_failed_registries(find_batch_params(batch_size)) registry_finder.find_failed_registries(find_batch_params(batch_size))
) )
end end
......
...@@ -89,7 +89,7 @@ module Geo ...@@ -89,7 +89,7 @@ module Geo
def find_project_ids_updated_recently(except_ids:, batch_size:) def find_project_ids_updated_recently(except_ids:, batch_size:)
project_ids = project_ids =
registry_finder registry_finder
.find_retryable_dirty_registries(batch_size: batch_size, except_ids: except_ids) .find_failed_registries(batch_size: batch_size, except_ids: except_ids)
.pluck_model_foreign_key .pluck_model_foreign_key
find_project_ids_within_shard(project_ids, direction: :asc) find_project_ids_within_shard(project_ids, direction: :asc)
......
...@@ -153,7 +153,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do ...@@ -153,7 +153,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do
end end
end end
describe '#find_retryable_failed_registries' do describe '#find_failed_registries' do
it 'returns registries for job artifacts that have failed to sync' do it 'returns registries for job artifacts that have failed to sync' do
registry_upload_1 = create(:geo_upload_registry, :attachment, :failed, file_id: upload_1.id) registry_upload_1 = create(:geo_upload_registry, :attachment, :failed, file_id: upload_1.id)
create(:geo_upload_registry, :attachment, file_id: upload_2.id, missing_on_primary: true) create(:geo_upload_registry, :attachment, file_id: upload_2.id, missing_on_primary: true)
...@@ -164,7 +164,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do ...@@ -164,7 +164,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do
create(:geo_upload_registry, :attachment, file_id: upload_7.id, missing_on_primary: true) create(:geo_upload_registry, :attachment, file_id: upload_7.id, missing_on_primary: true)
create(:geo_upload_registry, :attachment, :never_synced, file_id: upload_8.id) create(:geo_upload_registry, :attachment, :never_synced, file_id: upload_8.id)
registries = subject.find_retryable_failed_registries(batch_size: 10) registries = subject.find_failed_registries(batch_size: 10)
expect(registries).to match_ids(registry_upload_1, registry_upload_4, registry_upload_6) expect(registries).to match_ids(registry_upload_1, registry_upload_4, registry_upload_6)
end end
...@@ -179,7 +179,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do ...@@ -179,7 +179,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do
create(:geo_upload_registry, :attachment, file_id: upload_7.id, missing_on_primary: true) create(:geo_upload_registry, :attachment, file_id: upload_7.id, missing_on_primary: true)
create(:geo_upload_registry, :attachment, :never_synced, file_id: upload_8.id) create(:geo_upload_registry, :attachment, :never_synced, file_id: upload_8.id)
registries = subject.find_retryable_failed_registries(batch_size: 10, except_ids: [upload_4.id]) registries = subject.find_failed_registries(batch_size: 10, except_ids: [upload_4.id])
expect(registries).to match_ids(registry_upload_1, registry_upload_6) expect(registries).to match_ids(registry_upload_1, registry_upload_6)
end end
......
...@@ -206,7 +206,7 @@ RSpec.describe Geo::ContainerRepositoryRegistryFinder, :geo do ...@@ -206,7 +206,7 @@ RSpec.describe Geo::ContainerRepositoryRegistryFinder, :geo do
end end
end end
describe '#find_retryable_dirty_registries' do describe '#find_failed_registries' do
let_it_be(:registry_container_registry_1) { create(:container_repository_registry, :synced, container_repository_id: container_repository_1.id) } let_it_be(:registry_container_registry_1) { create(:container_repository_registry, :synced, container_repository_id: container_repository_1.id) }
let_it_be(:registry_container_registry_2) { create(:container_repository_registry, :sync_started, container_repository_id: container_repository_2.id) } let_it_be(:registry_container_registry_2) { create(:container_repository_registry, :sync_started, container_repository_id: container_repository_2.id) }
let_it_be(:registry_container_registry_3) { create(:container_repository_registry, state: :failed, container_repository_id: container_repository_3.id, last_synced_at: nil) } let_it_be(:registry_container_registry_3) { create(:container_repository_registry, state: :failed, container_repository_id: container_repository_3.id, last_synced_at: nil) }
...@@ -215,13 +215,13 @@ RSpec.describe Geo::ContainerRepositoryRegistryFinder, :geo do ...@@ -215,13 +215,13 @@ RSpec.describe Geo::ContainerRepositoryRegistryFinder, :geo do
let_it_be(:registry_container_registry_6) { create(:container_repository_registry, state: :failed, container_repository_id: container_repository_6.id, last_synced_at: nil) } let_it_be(:registry_container_registry_6) { create(:container_repository_registry, state: :failed, container_repository_id: container_repository_6.id, last_synced_at: nil) }
it 'returns registries for projects that have been recently updated' do it 'returns registries for projects that have been recently updated' do
registries = subject.find_retryable_dirty_registries(batch_size: 10) registries = subject.find_failed_registries(batch_size: 10)
expect(registries).to match_ids(registry_container_registry_3, registry_container_registry_4, registry_container_registry_5, registry_container_registry_6) expect(registries).to match_ids(registry_container_registry_3, registry_container_registry_4, registry_container_registry_5, registry_container_registry_6)
end end
it 'excludes except_ids' do it 'excludes except_ids' do
registries = subject.find_retryable_dirty_registries(batch_size: 10, except_ids: [container_repository_4.id, container_repository_5.id, container_repository_6.id]) registries = subject.find_failed_registries(batch_size: 10, except_ids: [container_repository_4.id, container_repository_5.id, container_repository_6.id])
expect(registries).to match_ids(registry_container_registry_3) expect(registries).to match_ids(registry_container_registry_3)
end end
......
...@@ -220,7 +220,7 @@ RSpec.describe Geo::DesignRegistryFinder, :geo do ...@@ -220,7 +220,7 @@ RSpec.describe Geo::DesignRegistryFinder, :geo do
end end
end end
describe '#find_retryable_dirty_registries' do describe '#find_failed_registries' do
let!(:registry_project_1) { create(:geo_design_registry, :synced, project_id: project_1.id) } let!(:registry_project_1) { create(:geo_design_registry, :synced, project_id: project_1.id) }
let!(:registry_project_2) { create(:geo_design_registry, :sync_failed, project_id: project_2.id) } let!(:registry_project_2) { create(:geo_design_registry, :sync_failed, project_id: project_2.id) }
let!(:registry_project_3) { create(:geo_design_registry, project_id: project_3.id, last_synced_at: nil) } let!(:registry_project_3) { create(:geo_design_registry, project_id: project_3.id, last_synced_at: nil) }
...@@ -229,13 +229,13 @@ RSpec.describe Geo::DesignRegistryFinder, :geo do ...@@ -229,13 +229,13 @@ RSpec.describe Geo::DesignRegistryFinder, :geo do
let!(:registry_project_6) { create(:geo_design_registry, project_id: project_6.id, last_synced_at: nil) } let!(:registry_project_6) { create(:geo_design_registry, project_id: project_6.id, last_synced_at: nil) }
it 'returns registries for projects that have been recently updated' do it 'returns registries for projects that have been recently updated' do
registries = subject.find_retryable_dirty_registries(batch_size: 10) registries = subject.find_failed_registries(batch_size: 10)
expect(registries).to match_ids(registry_project_2, registry_project_3, registry_project_4, registry_project_5, registry_project_6) expect(registries).to match_ids(registry_project_2, registry_project_3, registry_project_4, registry_project_5, registry_project_6)
end end
it 'excludes except_ids' do it 'excludes except_ids' do
registries = subject.find_retryable_dirty_registries(batch_size: 10, except_ids: [project_4.id, project_5.id, project_6.id]) registries = subject.find_failed_registries(batch_size: 10, except_ids: [project_4.id, project_5.id, project_6.id])
expect(registries).to match_ids(registry_project_2, registry_project_3) expect(registries).to match_ids(registry_project_2, registry_project_3)
end end
......
...@@ -338,7 +338,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do ...@@ -338,7 +338,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do
end end
end end
describe '#find_retryable_failed_registries' do describe '#find_failed_registries' do
it 'returns registries for job artifacts that have failed to sync' do it 'returns registries for job artifacts that have failed to sync' do
registry_ci_job_artifact_1 = create(:geo_job_artifact_registry, :failed, artifact_id: ci_job_artifact_1.id) registry_ci_job_artifact_1 = create(:geo_job_artifact_registry, :failed, artifact_id: ci_job_artifact_1.id)
create(:geo_job_artifact_registry, artifact_id: ci_job_artifact_2.id, missing_on_primary: true) create(:geo_job_artifact_registry, artifact_id: ci_job_artifact_2.id, missing_on_primary: true)
...@@ -349,7 +349,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do ...@@ -349,7 +349,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do
create(:geo_job_artifact_registry, artifact_id: ci_job_artifact_remote_2.id, missing_on_primary: true) create(:geo_job_artifact_registry, artifact_id: ci_job_artifact_remote_2.id, missing_on_primary: true)
create(:geo_job_artifact_registry, :never_synced, artifact_id: ci_job_artifact_remote_3.id) create(:geo_job_artifact_registry, :never_synced, artifact_id: ci_job_artifact_remote_3.id)
registries = subject.find_retryable_failed_registries(batch_size: 10) registries = subject.find_failed_registries(batch_size: 10)
expect(registries).to match_ids(registry_ci_job_artifact_1, registry_ci_job_artifact_4, registry_ci_job_artifact_remote_1) expect(registries).to match_ids(registry_ci_job_artifact_1, registry_ci_job_artifact_4, registry_ci_job_artifact_remote_1)
end end
...@@ -364,7 +364,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do ...@@ -364,7 +364,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do
create(:geo_job_artifact_registry, artifact_id: ci_job_artifact_remote_2.id, missing_on_primary: true) create(:geo_job_artifact_registry, artifact_id: ci_job_artifact_remote_2.id, missing_on_primary: true)
create(:geo_job_artifact_registry, :never_synced, artifact_id: ci_job_artifact_remote_3.id) create(:geo_job_artifact_registry, :never_synced, artifact_id: ci_job_artifact_remote_3.id)
registries = subject.find_retryable_failed_registries(batch_size: 10, except_ids: [ci_job_artifact_4.id]) registries = subject.find_failed_registries(batch_size: 10, except_ids: [ci_job_artifact_4.id])
expect(registries).to match_ids(registry_ci_job_artifact_1, registry_ci_job_artifact_remote_1) expect(registries).to match_ids(registry_ci_job_artifact_1, registry_ci_job_artifact_remote_1)
end end
......
...@@ -285,7 +285,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -285,7 +285,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do
end end
end end
describe '#find_retryable_failed_registries' do describe '#find_failed_registries' do
it 'returns registries for LFS objects that have failed to sync' do it 'returns registries for LFS objects that have failed to sync' do
registry_lfs_object_1 = create(:geo_lfs_object_registry, :failed, lfs_object_id: lfs_object_1.id) registry_lfs_object_1 = create(:geo_lfs_object_registry, :failed, lfs_object_id: lfs_object_1.id)
create(:geo_lfs_object_registry, lfs_object_id: lfs_object_2.id, missing_on_primary: true) create(:geo_lfs_object_registry, lfs_object_id: lfs_object_2.id, missing_on_primary: true)
...@@ -296,7 +296,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -296,7 +296,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do
create(:geo_lfs_object_registry, lfs_object_id: lfs_object_remote_2.id, missing_on_primary: true) create(:geo_lfs_object_registry, lfs_object_id: lfs_object_remote_2.id, missing_on_primary: true)
create(:geo_lfs_object_registry, :never_synced, lfs_object_id: lfs_object_remote_3.id) create(:geo_lfs_object_registry, :never_synced, lfs_object_id: lfs_object_remote_3.id)
registries = subject.find_retryable_failed_registries(batch_size: 10) registries = subject.find_failed_registries(batch_size: 10)
expect(registries).to match_ids(registry_lfs_object_1, registry_lfs_object_4, registry_lfs_object_remote_1) expect(registries).to match_ids(registry_lfs_object_1, registry_lfs_object_4, registry_lfs_object_remote_1)
end end
...@@ -311,7 +311,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -311,7 +311,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do
create(:geo_lfs_object_registry, lfs_object_id: lfs_object_remote_2.id, missing_on_primary: true) create(:geo_lfs_object_registry, lfs_object_id: lfs_object_remote_2.id, missing_on_primary: true)
create(:geo_lfs_object_registry, :never_synced, lfs_object_id: lfs_object_remote_3.id) create(:geo_lfs_object_registry, :never_synced, lfs_object_id: lfs_object_remote_3.id)
registries = subject.find_retryable_failed_registries(batch_size: 10, except_ids: [lfs_object_4.id]) registries = subject.find_failed_registries(batch_size: 10, except_ids: [lfs_object_4.id])
expect(registries).to match_ids(registry_lfs_object_1, registry_lfs_object_remote_1) expect(registries).to match_ids(registry_lfs_object_1, registry_lfs_object_remote_1)
end end
......
...@@ -31,15 +31,15 @@ RSpec.describe Geo::ProjectRegistryFinder, :geo do ...@@ -31,15 +31,15 @@ RSpec.describe Geo::ProjectRegistryFinder, :geo do
end end
end end
describe '#find_retryable_dirty_registries' do describe '#find_failed_registries' do
it 'returns registries for projects that have been recently updated or that have never been synced' do it 'returns registries for projects that have been recently updated or that have never been synced' do
registries = subject.find_retryable_dirty_registries(batch_size: 10) registries = subject.find_failed_registries(batch_size: 10)
expect(registries).to match_ids(registry_project_2, registry_project_3, registry_project_4, registry_project_5, registry_project_6) expect(registries).to match_ids(registry_project_2, registry_project_3, registry_project_4, registry_project_5, registry_project_6)
end end
it 'excludes except_ids' do it 'excludes except_ids' do
registries = subject.find_retryable_dirty_registries(batch_size: 10, except_ids: [project_4.id, project_5.id, project_6.id]) registries = subject.find_failed_registries(batch_size: 10, except_ids: [project_4.id, project_5.id, project_6.id])
expect(registries).to match_ids(registry_project_2, registry_project_3) expect(registries).to match_ids(registry_project_2, registry_project_3)
end end
......
...@@ -8,7 +8,7 @@ RSpec.shared_examples 'a file registry finder' do ...@@ -8,7 +8,7 @@ RSpec.shared_examples 'a file registry finder' do
synced_count synced_count
failed_count failed_count
synced_missing_on_primary_count synced_missing_on_primary_count
find_retryable_failed_registries find_failed_registries
find_retryable_synced_missing_on_primary_registries find_retryable_synced_missing_on_primary_registries
} }
......
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