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
a5450bfe
Commit
a5450bfe
authored
Jul 07, 2020
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Add package files to status rake tasks
Adds SSF entities into rake geo status command
parent
874e714c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
3 deletions
+53
-3
ee/app/models/geo_node_status.rb
ee/app/models/geo_node_status.rb
+8
-0
ee/changelogs/unreleased/225519-geo-add-package-files-to-status-rake-tasks.yml
...sed/225519-geo-add-package-files-to-status-rake-tasks.yml
+5
-0
ee/lib/gitlab/geo/geo_node_status_check.rb
ee/lib/gitlab/geo/geo_node_status_check.rb
+32
-0
ee/spec/lib/gitlab/geo/geo_node_status_check_spec.rb
ee/spec/lib/gitlab/geo/geo_node_status_check_spec.rb
+8
-3
No files found.
ee/app/models/geo_node_status.rb
View file @
a5450bfe
...
@@ -378,6 +378,14 @@ class GeoNodeStatus < ApplicationRecord
...
@@ -378,6 +378,14 @@ class GeoNodeStatus < ApplicationRecord
attr_in_percentage
:package_files_checksummed
,
:package_files_checksummed_count
,
:package_files_count
attr_in_percentage
:package_files_checksummed
,
:package_files_checksummed_count
,
:package_files_count
attr_in_percentage
:package_files_synced
,
:package_files_synced_count
,
:package_files_registry_count
attr_in_percentage
:package_files_synced
,
:package_files_synced_count
,
:package_files_registry_count
def
synced_in_percentage_for
(
replicator_class
)
public_send
(
"
#{
replicator_class
.
replicable_name_plural
}
_synced_in_percentage"
)
# rubocop:disable GitlabSecurity/PublicSend
end
def
checksummed_in_percentage_for
(
replicator_class
)
public_send
(
"
#{
replicator_class
.
replicable_name_plural
}
_checksummed_in_percentage"
)
# rubocop:disable GitlabSecurity/PublicSend
end
def
storage_shards_match?
def
storage_shards_match?
return
true
if
geo_node
.
primary?
return
true
if
geo_node
.
primary?
return
false
unless
storage_configuration_digest
&&
primary_storage_digest
return
false
unless
storage_configuration_digest
&&
primary_storage_digest
...
...
ee/changelogs/unreleased/225519-geo-add-package-files-to-status-rake-tasks.yml
0 → 100644
View file @
a5450bfe
---
title
:
'
Geo:
Add
package
files
to
status
rake
tasks'
merge_request
:
36192
author
:
type
:
changed
ee/lib/gitlab/geo/geo_node_status_check.rb
View file @
a5450bfe
...
@@ -33,7 +33,9 @@ module Gitlab
...
@@ -33,7 +33,9 @@ module Gitlab
print_ci_job_artifacts_status
print_ci_job_artifacts_status
print_container_repositories_status
print_container_repositories_status
print_design_repositories_status
print_design_repositories_status
print_replicators_status
print_repositories_checked_status
print_repositories_checked_status
print_replicators_checked_status
print_sync_settings
print_sync_settings
print_db_replication_lag
print_db_replication_lag
...
@@ -53,7 +55,9 @@ module Gitlab
...
@@ -53,7 +55,9 @@ module Gitlab
print_ci_job_artifacts_status
print_ci_job_artifacts_status
print_container_repositories_status
print_container_repositories_status
print_design_repositories_status
print_design_repositories_status
print_replicators_status
print_repositories_checked_status
print_repositories_checked_status
print_replicators_checked_status
end
end
def
replication_verification_complete?
def
replication_verification_complete?
...
@@ -159,6 +163,17 @@ module Gitlab
...
@@ -159,6 +163,17 @@ module Gitlab
puts
using_percentage
(
current_node_status
.
repositories_synced_in_percentage
)
puts
using_percentage
(
current_node_status
.
repositories_synced_in_percentage
)
end
end
def
print_replicators_status
Gitlab
::
Geo
.
replicator_classes
.
each
do
|
replicator_class
|
print
"
#{
replicator_class
.
replicable_title_plural
}
: "
.
rjust
(
GEO_STATUS_COLUMN_WIDTH
)
show_failed_value
(
replicator_class
.
failed_count
)
print
"
#{
replicator_class
.
synced_count
}
/
#{
replicator_class
.
registry_count
}
"
puts
using_percentage
(
current_node_status
.
synced_in_percentage_for
(
replicator_class
))
end
end
def
print_verified_repositories
def
print_verified_repositories
if
Gitlab
::
Geo
.
repository_verification_enabled?
if
Gitlab
::
Geo
.
repository_verification_enabled?
print
'Verified Repositories: '
.
rjust
(
GEO_STATUS_COLUMN_WIDTH
)
print
'Verified Repositories: '
.
rjust
(
GEO_STATUS_COLUMN_WIDTH
)
...
@@ -230,6 +245,15 @@ module Gitlab
...
@@ -230,6 +245,15 @@ module Gitlab
end
end
end
end
def
print_replicators_checked_status
Gitlab
::
Geo
.
replicator_classes
.
each
do
|
replicator_class
|
print
"
#{
replicator_class
.
replicable_title_plural
}
Checked: "
.
rjust
(
GEO_STATUS_COLUMN_WIDTH
)
show_failed_value
(
replicator_class
.
checksum_failed_count
)
print
"
#{
replicator_class
.
checksummed_count
}
/
#{
replicator_class
.
registry_count
}
"
puts
using_percentage
(
current_node_status
.
checksummed_in_percentage_for
(
replicator_class
))
end
end
def
replication_complete?
def
replication_complete?
replicables
.
all?
{
|
failed_count
|
failed_count
==
0
}
replicables
.
all?
{
|
failed_count
|
failed_count
==
0
}
end
end
...
@@ -250,6 +274,10 @@ module Gitlab
...
@@ -250,6 +274,10 @@ module Gitlab
if
Gitlab
.
config
.
geo
.
registry_replication
.
enabled
if
Gitlab
.
config
.
geo
.
registry_replication
.
enabled
r
.
push
current_node_status
.
container_repositories_failed_count
r
.
push
current_node_status
.
container_repositories_failed_count
end
end
Gitlab
::
Geo
.
replicator_classes
.
each
do
|
replicator_class
|
r
.
push
replicator_class
.
failed_count
end
end
end
end
end
...
@@ -265,6 +293,10 @@ module Gitlab
...
@@ -265,6 +293,10 @@ module Gitlab
if
Gitlab
::
CurrentSettings
.
repository_checks_enabled
if
Gitlab
::
CurrentSettings
.
repository_checks_enabled
v
.
push
current_node_status
.
repositories_checked_failed_count
v
.
push
current_node_status
.
repositories_checked_failed_count
end
end
Gitlab
::
Geo
.
replicator_classes
.
each
do
|
replicator_class
|
v
.
push
replicator_class
.
checksum_failed_count
end
end
end
end
end
...
...
ee/spec/lib/gitlab/geo/geo_node_status_check_spec.rb
View file @
a5450bfe
...
@@ -26,7 +26,8 @@ RSpec.describe Gitlab::Geo::GeoNodeStatusCheck do
...
@@ -26,7 +26,8 @@ RSpec.describe Gitlab::Geo::GeoNodeStatusCheck do
/CI job artifacts/
,
/CI job artifacts/
,
/Container repositories/
,
/Container repositories/
,
/Design repositories/
,
/Design repositories/
,
/Repositories Checked/
/Repositories Checked/
,
/Package Files Checked/
].
each
do
|
text
|
].
each
do
|
text
|
expect
{
subject
.
print_replication_verification_status
}.
to
output
(
text
).
to_stdout
expect
{
subject
.
print_replication_verification_status
}.
to
output
(
text
).
to_stdout
end
end
...
@@ -39,11 +40,15 @@ RSpec.describe Gitlab::Geo::GeoNodeStatusCheck do
...
@@ -39,11 +40,15 @@ RSpec.describe Gitlab::Geo::GeoNodeStatusCheck do
end
end
context
'when replication is not up-to-date'
do
context
'when replication is not up-to-date'
do
before
do
it
'returns false when repositories_checked_failed_count is positive'
do
allow
(
geo_node_status
).
to
receive
(
:repositories_checked_failed_count
).
and_return
(
1
)
allow
(
geo_node_status
).
to
receive
(
:repositories_checked_failed_count
).
and_return
(
1
)
expect
(
subject
.
replication_verification_complete?
).
to
be_falsy
end
end
it
'returns false'
do
it
'returns false when there are package files failed to sync'
do
allow
(
::
Geo
::
PackageFileReplicator
).
to
receive
(
:failed_count
).
and_return
(
1
)
expect
(
subject
.
replication_verification_complete?
).
to
be_falsy
expect
(
subject
.
replication_verification_complete?
).
to
be_falsy
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