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
f8f16b18
Commit
f8f16b18
authored
May 07, 2018
by
Brett Walker
Committed by
Stan Hu
May 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo repository verification: ignore repos/wikis needing resync
parent
625caf57
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
33 deletions
+58
-33
ee/app/finders/geo/project_registry_finder.rb
ee/app/finders/geo/project_registry_finder.rb
+20
-14
ee/changelogs/unreleased/bw-verification-resync-fix.yml
ee/changelogs/unreleased/bw-verification-resync-fix.yml
+5
-0
ee/spec/finders/geo/project_registry_finder_spec.rb
ee/spec/finders/geo/project_registry_finder_spec.rb
+21
-7
ee/spec/workers/geo/repository_verification/secondary/shard_worker_spec.rb
...eo/repository_verification/secondary/shard_worker_spec.rb
+12
-12
No files found.
ee/app/finders/geo/project_registry_finder.rb
View file @
f8f16b18
...
...
@@ -181,12 +181,10 @@ module Geo
# @return [ActiveRecord::Relation<Geo::ProjectRegistry>] list of registries that need verification
def
fdw_find_registries_to_verify
(
batch_size
:)
repo_condition
=
local_registry_table
[
:repository_verification_checksum_sha
].
eq
(
nil
)
.
and
(
local_registry_table
[
:last_repository_verification_failure
].
eq
(
nil
))
local_repo_condition
.
and
(
fdw_repository_state_table
[
:repository_verification_checksum
].
not_eq
(
nil
))
wiki_condition
=
local_registry_table
[
:wiki_verification_checksum_sha
].
eq
(
nil
)
.
and
(
local_registry_table
[
:last_wiki_verification_failure
].
eq
(
nil
))
local_wiki_condition
.
and
(
fdw_repository_state_table
[
:wiki_verification_checksum
].
not_eq
(
nil
))
Geo
::
ProjectRegistry
...
...
@@ -316,12 +314,8 @@ module Geo
# @return [ActiveRecord::Relation<Geo::ProjectRegistry>] list of registries that need verification
def
legacy_find_registries_to_verify
(
batch_size
:)
repo_condition
=
local_registry_table
[
:repository_verification_checksum_sha
].
eq
(
nil
)
.
and
(
local_registry_table
[
:last_repository_verification_failure
].
eq
(
nil
))
wiki_condition
=
local_registry_table
[
:wiki_verification_checksum_sha
].
eq
(
nil
)
.
and
(
local_registry_table
[
:last_wiki_verification_failure
].
eq
(
nil
))
repo_condition
=
local_repo_condition
wiki_condition
=
local_wiki_condition
registries
=
Geo
::
ProjectRegistry
.
where
(
repo_condition
.
or
(
wiki_condition
))
...
...
@@ -355,10 +349,6 @@ module Geo
Geo
::
ProjectRegistry
.
where
(
project_id:
project_ids
)
end
def
local_registry_table
Geo
::
ProjectRegistry
.
arel_table
end
def
legacy_repository_state_table
::
ProjectRepositoryState
.
arel_table
end
...
...
@@ -370,5 +360,21 @@ module Geo
def
fdw_repository_state_table
Geo
::
Fdw
::
ProjectRepositoryState
.
arel_table
end
def
local_registry_table
Geo
::
ProjectRegistry
.
arel_table
end
def
local_repo_condition
local_registry_table
[
:repository_verification_checksum_sha
].
eq
(
nil
)
.
and
(
local_registry_table
[
:last_repository_verification_failure
].
eq
(
nil
))
.
and
(
local_registry_table
[
:resync_repository
].
eq
(
false
))
end
def
local_wiki_condition
local_registry_table
[
:wiki_verification_checksum_sha
].
eq
(
nil
)
.
and
(
local_registry_table
[
:last_wiki_verification_failure
].
eq
(
nil
))
.
and
(
local_registry_table
[
:resync_wiki
].
eq
(
false
))
end
end
end
ee/changelogs/unreleased/bw-verification-resync-fix.yml
0 → 100644
View file @
f8f16b18
---
title
:
During repository verification, ignore repositories/wikis that need to be resynced
merge_request
:
5568
author
:
type
:
fixed
ee/spec/finders/geo/project_registry_finder_spec.rb
View file @
f8f16b18
...
...
@@ -509,10 +509,10 @@ describe Geo::ProjectRegistryFinder, :geo do
repository_outdated_secondary
=
create
(
:repository_state
,
:repository_verified
,
:wiki_verified
).
project
wiki_outdated_secondary
=
create
(
:repository_state
,
:repository_verified
,
:wiki_verified
).
project
registry_unverified_secondary
=
create
(
:geo_project_registry
,
project:
project_unverified_secondary
)
registry_outdated_secondary
=
create
(
:geo_project_registry
,
:repository_verification_outdated
,
:wiki_verification_outdated
,
project:
project_outdated_secondary
)
registry_repository_outdated_secondary
=
create
(
:geo_project_registry
,
:repository_verification_outdated
,
:wiki_verified
,
project:
repository_outdated_secondary
)
registry_wiki_outdated_secondary
=
create
(
:geo_project_registry
,
:repository_verified
,
:wiki_verification_outdated
,
project:
wiki_outdated_secondary
)
registry_unverified_secondary
=
create
(
:geo_project_registry
,
:synced
,
project:
project_unverified_secondary
)
registry_outdated_secondary
=
create
(
:geo_project_registry
,
:
synced
,
:
repository_verification_outdated
,
:wiki_verification_outdated
,
project:
project_outdated_secondary
)
registry_repository_outdated_secondary
=
create
(
:geo_project_registry
,
:
synced
,
:
repository_verification_outdated
,
:wiki_verified
,
project:
repository_outdated_secondary
)
registry_wiki_outdated_secondary
=
create
(
:geo_project_registry
,
:
synced
,
:
repository_verified
,
:wiki_verification_outdated
,
project:
wiki_outdated_secondary
)
expect
(
subject
.
find_registries_to_verify
(
batch_size:
100
))
.
to
match_array
([
...
...
@@ -536,9 +536,9 @@ describe Geo::ProjectRegistryFinder, :geo do
repository_failed_primary
=
create
(
:repository_state
,
:repository_failed
,
:wiki_verified
).
project
wiki_failed_primary
=
create
(
:repository_state
,
:repository_verified
,
:wiki_failed
).
project
create
(
:geo_project_registry
,
project:
verification_failed_primary
)
registry_repository_failed_primary
=
create
(
:geo_project_registry
,
project:
repository_failed_primary
)
registry_wiki_failed_primary
=
create
(
:geo_project_registry
,
project:
wiki_failed_primary
)
create
(
:geo_project_registry
,
:synced
,
project:
verification_failed_primary
)
registry_repository_failed_primary
=
create
(
:geo_project_registry
,
:synced
,
project:
repository_failed_primary
)
registry_wiki_failed_primary
=
create
(
:geo_project_registry
,
:synced
,
project:
wiki_failed_primary
)
expect
(
subject
.
find_registries_to_verify
(
batch_size:
100
))
.
to
match_array
([
...
...
@@ -559,6 +559,20 @@ describe Geo::ProjectRegistryFinder, :geo do
expect
(
subject
.
find_registries_to_verify
(
batch_size:
100
)).
to
be_empty
end
it
'does not return registries when the repo needs to be resynced'
do
project_verified
=
create
(
:repository_state
,
:repository_verified
).
project
create
(
:geo_project_registry
,
:repository_sync_failed
,
project:
project_verified
)
expect
(
subject
.
find_registries_to_verify
(
batch_size:
100
)).
to
be_empty
end
it
'does not return registries when the wiki needs to be resynced'
do
project_verified
=
create
(
:repository_state
,
:wiki_verified
).
project
create
(
:geo_project_registry
,
:wiki_sync_failed
,
project:
project_verified
)
expect
(
subject
.
find_registries_to_verify
(
batch_size:
100
)).
to
be_empty
end
end
end
...
...
ee/spec/workers/geo/repository_verification/secondary/shard_worker_spec.rb
View file @
f8f16b18
...
...
@@ -26,8 +26,8 @@ describe Geo::RepositoryVerification::Secondary::ShardWorker, :postgresql, :clea
other_project
=
create
(
:project
)
create
(
:repository_state
,
:repository_verified
,
project:
project
)
create
(
:repository_state
,
:repository_verified
,
project:
other_project
)
create
(
:geo_project_registry
,
:repository_verification_outdated
,
project:
project
)
create
(
:geo_project_registry
,
:repository_verification_outdated
,
project:
other_project
)
create
(
:geo_project_registry
,
:
synced
,
:
repository_verification_outdated
,
project:
project
)
create
(
:geo_project_registry
,
:
synced
,
:
repository_verification_outdated
,
project:
other_project
)
expect
(
secondary_singleworker
).
to
receive
(
:perform_async
).
twice
...
...
@@ -36,7 +36,7 @@ describe Geo::RepositoryVerification::Secondary::ShardWorker, :postgresql, :clea
it
'schedules job for projects missing repository verification'
do
create
(
:repository_state
,
:repository_verified
,
:wiki_verified
,
project:
project
)
missing_repository_verification
=
create
(
:geo_project_registry
,
:wiki_verified
,
project:
project
)
missing_repository_verification
=
create
(
:geo_project_registry
,
:
synced
,
:
wiki_verified
,
project:
project
)
expect
(
secondary_singleworker
).
to
receive
(
:perform_async
).
with
(
missing_repository_verification
.
id
)
...
...
@@ -45,7 +45,7 @@ describe Geo::RepositoryVerification::Secondary::ShardWorker, :postgresql, :clea
it
'schedules job for projects missing wiki verification'
do
create
(
:repository_state
,
:repository_verified
,
:wiki_verified
,
project:
project
)
missing_wiki_verification
=
create
(
:geo_project_registry
,
:repository_verified
,
project:
project
)
missing_wiki_verification
=
create
(
:geo_project_registry
,
:
synced
,
:
repository_verified
,
project:
project
)
expect
(
secondary_singleworker
).
to
receive
(
:perform_async
).
with
(
missing_wiki_verification
.
id
)
...
...
@@ -67,8 +67,8 @@ describe Geo::RepositoryVerification::Secondary::ShardWorker, :postgresql, :clea
let
(
:project6_both_verified
)
{
create
(
:repository_state
,
:repository_verified
,
:wiki_verified
).
project
}
it
'handles multiple batches of projects needing verification'
do
reg1
=
create
(
:geo_project_registry
,
:repository_verification_outdated
,
project:
project1_repo_verified
)
reg2
=
create
(
:geo_project_registry
,
:repository_verification_outdated
,
project:
project2_repo_verified
)
reg1
=
create
(
:geo_project_registry
,
:
synced
,
:
repository_verification_outdated
,
project:
project1_repo_verified
)
reg2
=
create
(
:geo_project_registry
,
:
synced
,
:
repository_verification_outdated
,
project:
project2_repo_verified
)
expect
(
secondary_singleworker
).
to
receive
(
:perform_async
).
with
(
reg1
.
id
).
once
...
...
@@ -82,12 +82,12 @@ describe Geo::RepositoryVerification::Secondary::ShardWorker, :postgresql, :clea
end
it
'handles multiple batches of projects needing verification, skipping failed repos'
do
reg1
=
create
(
:geo_project_registry
,
:repository_verification_outdated
,
project:
project1_repo_verified
)
reg2
=
create
(
:geo_project_registry
,
:repository_verification_outdated
,
project:
project2_repo_verified
)
create
(
:geo_project_registry
,
:repository_verification_outdated
,
project:
project3_repo_failed
)
reg4
=
create
(
:geo_project_registry
,
:wiki_verification_outdated
,
project:
project4_wiki_verified
)
create
(
:geo_project_registry
,
:repository_verification_failed
,
:wiki_verification_failed
,
project:
project5_both_verified
)
reg6
=
create
(
:geo_project_registry
,
project:
project6_both_verified
)
reg1
=
create
(
:geo_project_registry
,
:
synced
,
:
repository_verification_outdated
,
project:
project1_repo_verified
)
reg2
=
create
(
:geo_project_registry
,
:
synced
,
:
repository_verification_outdated
,
project:
project2_repo_verified
)
create
(
:geo_project_registry
,
:
synced
,
:
repository_verification_outdated
,
project:
project3_repo_failed
)
reg4
=
create
(
:geo_project_registry
,
:
synced
,
:
wiki_verification_outdated
,
project:
project4_wiki_verified
)
create
(
:geo_project_registry
,
:
synced
,
:
repository_verification_failed
,
:wiki_verification_failed
,
project:
project5_both_verified
)
reg6
=
create
(
:geo_project_registry
,
:synced
,
project:
project6_both_verified
)
expect
(
secondary_singleworker
).
to
receive
(
:perform_async
).
with
(
reg1
.
id
).
once
...
...
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