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
1c4cd06b
Commit
1c4cd06b
authored
Mar 27, 2018
by
Brett Walker
Committed by
Nick Thomas
Mar 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Count of verified wikis is incorrect on Geo secondary
parent
53dc5264
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
20 deletions
+106
-20
ee/app/finders/geo/project_registry_finder.rb
ee/app/finders/geo/project_registry_finder.rb
+27
-20
ee/changelogs/unreleased/5178-geo-verification-fix-wiki-count.yml
...elogs/unreleased/5178-geo-verification-fix-wiki-count.yml
+5
-0
ee/spec/finders/geo/project_registry_finder_spec.rb
ee/spec/finders/geo/project_registry_finder_spec.rb
+74
-0
No files found.
ee/app/finders/geo/project_registry_finder.rb
View file @
1c4cd06b
...
...
@@ -62,7 +62,7 @@ module Geo
if
use_legacy_queries?
legacy_find_verified_wikis
else
find_verified_wikis
f
dw_f
ind_verified_wikis
end
relation
.
count
...
...
@@ -125,10 +125,6 @@ module Geo
Geo
::
ProjectRegistry
.
verified_repos
end
def
find_verified_wikis
Geo
::
ProjectRegistry
.
verified_wikis
end
def
find_filtered_failed_project_registries
(
type
=
nil
)
case
type
when
'repository'
...
...
@@ -163,19 +159,7 @@ module Geo
# @return [ActiveRecord::Relation<Geo::ProjectRegistry>]
def
fdw_find_enabled_wikis
project_id_matcher
=
Geo
::
Fdw
::
ProjectFeature
.
arel_table
[
:project_id
]
.
eq
(
Geo
::
ProjectRegistry
.
arel_table
[
:project_id
])
# Only read the IDs of projects with disabled wikis from the remote database
not_exist
=
Geo
::
Fdw
::
ProjectFeature
.
where
(
wiki_access_level:
[
::
ProjectFeature
::
DISABLED
,
nil
])
.
where
(
project_id_matcher
)
.
select
(
'1'
)
.
exists
.
not
Geo
::
ProjectRegistry
.
synced_wikis
.
where
(
not_exist
)
Geo
::
ProjectRegistry
.
synced_wikis
.
where
(
fdw_not_disabled_wikis
)
end
# @return [ActiveRecord::Relation<Geo::Fdw::Project>]
...
...
@@ -202,6 +186,11 @@ module Geo
).
limit
(
batch_size
)
end
# @return [ActiveRecord::Relation<Geo::ProjectRegistry>]
def
fdw_find_verified_wikis
Geo
::
ProjectRegistry
.
verified_wikis
.
where
(
fdw_not_disabled_wikis
)
end
def
fdw_inner_join_repository_state
local_registry_table
.
join
(
fdw_repository_state_table
,
Arel
::
Nodes
::
InnerJoin
)
...
...
@@ -209,6 +198,20 @@ module Geo
.
join_sources
end
def
fdw_not_disabled_wikis
project_id_matcher
=
Geo
::
Fdw
::
ProjectFeature
.
arel_table
[
:project_id
]
.
eq
(
Geo
::
ProjectRegistry
.
arel_table
[
:project_id
])
# Only read the IDs of projects with disabled wikis from the remote database
Geo
::
Fdw
::
ProjectFeature
.
where
(
wiki_access_level:
[
::
ProjectFeature
::
DISABLED
,
nil
])
.
where
(
project_id_matcher
)
.
select
(
'1'
)
.
exists
.
not
end
#
# Legacy accessors (non FDW)
#
...
...
@@ -264,9 +267,13 @@ module Geo
legacy_find_project_registries
(
Geo
::
ProjectRegistry
.
verified_repos
)
end
# @return [ActiveRecord::Relation<Geo::ProjectRegistry>] list of verified
project
s
# @return [ActiveRecord::Relation<Geo::ProjectRegistry>] list of verified
wiki
s
def
legacy_find_verified_wikis
legacy_find_project_registries
(
Geo
::
ProjectRegistry
.
verified_wikis
)
legacy_inner_join_registry_ids
(
current_node
.
projects
.
with_wiki_enabled
,
Geo
::
ProjectRegistry
.
verified_wikis
.
pluck
(
:project_id
),
Project
)
end
# @return [ActiveRecord::Relation<Project>] list of synced projects
...
...
ee/changelogs/unreleased/5178-geo-verification-fix-wiki-count.yml
0 → 100644
View file @
1c4cd06b
---
title
:
Fixed incorrect count of verified wikis on a Geo secondary node
merge_request
:
5084
author
:
type
:
fixed
ee/spec/finders/geo/project_registry_finder_spec.rb
View file @
1c4cd06b
...
...
@@ -191,6 +191,69 @@ describe Geo::ProjectRegistryFinder, :geo do
end
end
describe
'#count_verified_repositories'
do
it
'delegates to #find_verified_repositories'
do
expect
(
subject
).
to
receive
(
:find_verified_repositories
).
and_call_original
subject
.
count_verified_repositories
end
it
'counts projects that verified'
do
create
(
:geo_project_registry
,
:repository_verified
,
project:
project_repository_verified
)
create
(
:geo_project_registry
,
:repository_verified
,
project:
build
(
:project
))
create
(
:geo_project_registry
,
:repository_verification_failed
,
project:
project_repository_verification_failed
)
expect
(
subject
.
count_verified_repositories
).
to
eq
2
end
context
'with legacy queries'
do
before
do
allow
(
subject
).
to
receive
(
:use_legacy_queries?
).
and_return
(
true
)
end
it
'delegates to #legacy_find_verified_repositories'
do
expect
(
subject
).
to
receive
(
:legacy_find_verified_repositories
).
and_call_original
subject
.
count_verified_repositories
end
it
'counts projects that verified'
do
create
(
:geo_project_registry
,
:repository_verified
,
project:
project_repository_verified
)
create
(
:geo_project_registry
,
:repository_verified
,
project:
build
(
:project
))
create
(
:geo_project_registry
,
:repository_verification_failed
,
project:
project_repository_verification_failed
)
expect
(
subject
.
count_verified_repositories
).
to
eq
2
end
end
end
describe
'#count_verified_wikis'
do
before
do
allow
(
subject
).
to
receive
(
:use_legacy_queries?
).
and_return
(
true
)
end
it
'delegates to #legacy_find_synced_wikis'
do
expect
(
subject
).
to
receive
(
:legacy_find_verified_wikis
).
and_call_original
subject
.
count_verified_wikis
end
it
'counts wikis that verified'
do
create
(
:geo_project_registry
,
:wiki_verified
,
project:
project_wiki_verified
)
create
(
:geo_project_registry
,
:wiki_verified
,
project:
build
(
:project
))
create
(
:geo_project_registry
,
:wiki_verification_failed
,
project:
project_wiki_verification_failed
)
expect
(
subject
.
count_verified_wikis
).
to
eq
2
end
it
'does not count disabled wikis'
do
create
(
:geo_project_registry
,
:wiki_verified
,
project:
project_wiki_verified
)
create
(
:geo_project_registry
,
:wiki_verified
,
project:
create
(
:project
,
:wiki_disabled
))
expect
(
subject
.
count_verified_wikis
).
to
eq
1
end
end
describe
'#count_verification_failed_repositories'
do
it
'delegates to #find_verification_failed_project_registries'
do
expect
(
subject
).
to
receive
(
:find_verification_failed_project_registries
).
with
(
'repository'
).
and_call_original
...
...
@@ -424,6 +487,17 @@ describe Geo::ProjectRegistryFinder, :geo do
end
end
describe
'#fdw_find_verified_wikis'
do
it
'does not count disabled wikis'
do
expect
(
subject
).
to
receive
(
:fdw_find_verified_wikis
).
and_call_original
create
(
:geo_project_registry
,
:wiki_verified
,
project:
project_wiki_verified
)
create
(
:geo_project_registry
,
:wiki_verified
,
project:
create
(
:project
,
:wiki_disabled
))
expect
(
subject
.
count_verified_wikis
).
to
eq
1
end
end
describe
'#find_unsynced_projects'
do
it
'delegates to #fdw_find_unsynced_projects'
do
expect
(
subject
).
to
receive
(
:fdw_find_unsynced_projects
).
and_call_original
...
...
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