Commit 4d0012d1 authored by Michael Kozono's avatar Michael Kozono

Disable cop for now

Follow up issue: https://gitlab.com/gitlab-org/gitlab-ee/issues/11454
parent 81997f84
......@@ -159,10 +159,6 @@ class GeoNodeStatus < ApplicationRecord
latest_event = Geo::EventLog.latest_event
self.last_event_id = latest_event&.id
self.last_event_date = latest_event&.created_at
self.projects_count = projects_finder.count_projects
self.lfs_objects_count = lfs_objects_finder.count_syncable
self.job_artifacts_count = job_artifacts_finder.count_syncable
self.attachments_count = attachments_finder.count_syncable
self.last_successful_status_check_at = Time.now
self.storage_shards = StorageShard.all
self.storage_configuration_digest = StorageShard.build_digest
......@@ -191,6 +187,11 @@ class GeoNodeStatus < ApplicationRecord
def load_primary_data
if Gitlab::Geo.primary?
self.projects_count = geo_node.projects.count
self.lfs_objects_count = LfsObject.syncable.count
self.job_artifacts_count = Ci::JobArtifact.syncable.count
self.attachments_count = Upload.syncable.count
self.replication_slots_count = geo_node.replication_slots_count
self.replication_slots_used_count = geo_node.replication_slots_used_count
self.replication_slots_max_retained_wal_bytes = geo_node.replication_slots_max_retained_wal_bytes
......@@ -207,23 +208,27 @@ class GeoNodeStatus < ApplicationRecord
end
end
def load_secondary_data
def load_secondary_data # rubocop:disable Metrics/AbcSize
if Gitlab::Geo.secondary?
self.db_replication_lag_seconds = Gitlab::Geo::HealthCheck.new.db_replication_lag_seconds
self.cursor_last_event_id = current_cursor_last_event_id
self.cursor_last_event_date = Geo::EventLog.find_by(id: self.cursor_last_event_id)&.created_at
self.projects_count = projects_finder.count_projects
self.repositories_synced_count = projects_finder.count_synced_repositories
self.repositories_failed_count = projects_finder.count_failed_repositories
self.wikis_synced_count = projects_finder.count_synced_wikis
self.wikis_failed_count = projects_finder.count_failed_wikis
self.lfs_objects_count = lfs_objects_finder.count_syncable
self.lfs_objects_synced_count = lfs_objects_finder.count_synced
self.lfs_objects_failed_count = lfs_objects_finder.count_failed
self.lfs_objects_registry_count = lfs_objects_finder.count_registry
self.lfs_objects_synced_missing_on_primary_count = lfs_objects_finder.count_synced_missing_on_primary
self.job_artifacts_count = job_artifacts_finder.count_syncable
self.job_artifacts_synced_count = job_artifacts_finder.count_synced
self.job_artifacts_failed_count = job_artifacts_finder.count_failed
self.job_artifacts_registry_count = job_artifacts_finder.count_registry
self.job_artifacts_synced_missing_on_primary_count = job_artifacts_finder.count_synced_missing_on_primary
self.attachments_count = attachments_finder.count_syncable
self.attachments_synced_count = attachments_finder.count_synced
self.attachments_failed_count = attachments_finder.count_failed
self.attachments_registry_count = attachments_finder.count_registry
......
---
title: 'Geo: Prevent RegistryFinder calls on the primary'
merge_request: 12183
author:
type: fixed
......@@ -988,4 +988,62 @@ describe GeoNodeStatus, :geo, :geo_fdw do
end
end
end
describe '#load_data_from_current_node' do
context 'on the primary' do
before do
stub_current_geo_node(primary)
end
it 'does not call ProjectRegistryFinder#count_projects' do
expect_any_instance_of(Geo::ProjectRegistryFinder).not_to receive(:count_projects)
subject
end
it 'does not call LfsObjectRegistryFinder#count_syncable' do
expect_any_instance_of(Geo::LfsObjectRegistryFinder).not_to receive(:count_syncable)
subject
end
it 'does not call AttachmentRegistryFinder#count_syncable' do
expect_any_instance_of(Geo::AttachmentRegistryFinder).not_to receive(:count_syncable)
subject
end
it 'does not call JobArtifactRegistryFinder#count_syncable' do
expect_any_instance_of(Geo::JobArtifactRegistryFinder).not_to receive(:count_syncable)
subject
end
end
context 'on the secondary' do
it 'calls ProjectRegistryFinder#count_projects' do
expect_any_instance_of(Geo::ProjectRegistryFinder).to receive(:count_projects)
subject
end
it 'calls LfsObjectRegistryFinder#count_syncable' do
expect_any_instance_of(Geo::AttachmentRegistryFinder).to receive(:count_syncable)
subject
end
it 'calls AttachmentRegistryFinder#count_syncable' do
expect_any_instance_of(Geo::AttachmentRegistryFinder).to receive(:count_syncable)
subject
end
it 'calls JobArtifactRegistryFinder#count_syncable' do
expect_any_instance_of(Geo::JobArtifactRegistryFinder).to receive(:count_syncable)
subject
end
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