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
cc653969
Commit
cc653969
authored
Sep 14, 2020
by
Mike Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor replicable package files scope
to improve performance and readability.
parent
3d9f7a44
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
14 deletions
+7
-14
ee/app/models/ee/packages/package_file.rb
ee/app/models/ee/packages/package_file.rb
+2
-14
ee/changelogs/unreleased/mk-refactor-replicable-package-files-scope.yml
...unreleased/mk-refactor-replicable-package-files-scope.yml
+5
-0
No files found.
ee/app/models/ee/packages/package_file.rb
View file @
cc653969
...
...
@@ -29,20 +29,8 @@ module EE
def
selective_sync_scope
return
self
.
all
unless
::
Gitlab
::
Geo
.
current_node
.
selective_sync?
query
=
::
Packages
::
Package
.
where
(
project_id:
::
Gitlab
::
Geo
.
current_node
.
projects
).
select
(
:id
)
cte
=
::
Gitlab
::
SQL
::
CTE
.
new
(
:restricted_packages
,
query
)
replicable_table
=
self
.
arel_table
inner_join_restricted_packages
=
cte
.
table
.
join
(
replicable_table
,
Arel
::
Nodes
::
InnerJoin
)
.
on
(
cte
.
table
[
:id
].
eq
(
replicable_table
[
:package_id
]))
.
join_sources
self
.
with
(
cte
.
to_arel
)
.
from
(
cte
.
table
)
.
joins
(
inner_join_restricted_packages
)
self
.
joins
(
:package
)
.
where
(
'packages_packages.project_id IN (?)'
,
::
Gitlab
::
Geo
.
current_node
.
projects
.
select
(
:id
))
end
end
...
...
ee/changelogs/unreleased/mk-refactor-replicable-package-files-scope.yml
0 → 100644
View file @
cc653969
---
title
:
'
Geo:
Improve
performance
of
package
files
queries'
merge_request
:
42294
author
:
type
:
performance
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