Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4d0012d1
Commit
4d0012d1
authored
May 03, 2019
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable cop for now
Follow up issue:
https://gitlab.com/gitlab-org/gitlab-ee/issues/11454
parent
81997f84
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
5 deletions
+73
-5
ee/app/models/geo_node_status.rb
ee/app/models/geo_node_status.rb
+10
-5
ee/changelogs/unreleased/mk-fix-registry-finders-on-primary-geo.yml
...ogs/unreleased/mk-fix-registry-finders-on-primary-geo.yml
+5
-0
ee/spec/models/geo_node_status_spec.rb
ee/spec/models/geo_node_status_spec.rb
+58
-0
No files found.
ee/app/models/geo_node_status.rb
View file @
4d0012d1
...
...
@@ -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
...
...
ee/changelogs/unreleased/mk-fix-registry-finders-on-primary-geo.yml
0 → 100644
View file @
4d0012d1
---
title
:
'
Geo:
Prevent
RegistryFinder
calls
on
the
primary'
merge_request
:
12183
author
:
type
:
fixed
ee/spec/models/geo_node_status_spec.rb
View file @
4d0012d1
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment