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
4c3c2051
Commit
4c3c2051
authored
Oct 23, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite the query to retrieve LFS objects using CTE
parent
0e7baa35
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
ee/app/models/geo/fdw/geo_node.rb
ee/app/models/geo/fdw/geo_node.rb
+14
-1
ee/app/models/geo/fdw/lfs_objects_project.rb
ee/app/models/geo/fdw/lfs_objects_project.rb
+2
-0
No files found.
ee/app/models/geo/fdw/geo_node.rb
View file @
4c3c2051
...
...
@@ -35,7 +35,20 @@ module Geo
def
lfs_objects
return
Geo
::
Fdw
::
LfsObject
.
all
unless
selective_sync?
Geo
::
Fdw
::
LfsObject
.
project_id_in
(
projects
)
query
=
Geo
::
Fdw
::
LfsObjectsProject
.
project_id_in
(
projects
).
select
(
:lfs_object_id
)
cte
=
Gitlab
::
SQL
::
CTE
.
new
(
:restricted_lfs_objects
,
query
)
fdw_lfs_object_table
=
Geo
::
Fdw
::
LfsObject
.
arel_table
inner_join_restricted_lfs_objects
=
cte
.
table
.
join
(
fdw_lfs_object_table
,
Arel
::
Nodes
::
InnerJoin
)
.
on
(
cte
.
table
[
:lfs_object_id
].
eq
(
fdw_lfs_object_table
[
:id
]))
.
join_sources
Geo
::
Fdw
::
LfsObject
.
with
(
cte
.
to_arel
)
.
from
(
cte
.
table
)
.
joins
(
inner_join_restricted_lfs_objects
)
end
def
lfs_object_registries
...
...
ee/app/models/geo/fdw/lfs_objects_project.rb
View file @
4c3c2051
...
...
@@ -7,6 +7,8 @@ module Geo
belongs_to
:lfs_object
,
class_name:
'Geo::Fdw::LfsObject'
,
inverse_of: :projects
belongs_to
:project
,
class_name:
'Geo::Fdw::Project'
,
inverse_of: :lfs_objects
scope
:project_id_in
,
->
(
ids
)
{
joins
(
:project
).
merge
(
Geo
::
Fdw
::
Project
.
id_in
(
ids
))
}
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