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
6ac86e57
Commit
6ac86e57
authored
Jul 22, 2021
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `Ci::Artifactable#selective_sync_scope` cross-join DBs
Changelog: fixed EE: true
parent
a014c2b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
ee/app/models/concerns/ee/ci/artifactable.rb
ee/app/models/concerns/ee/ci/artifactable.rb
+17
-6
No files found.
ee/app/models/concerns/ee/ci/artifactable.rb
View file @
6ac86e57
...
...
@@ -11,21 +11,32 @@ module EE
def
replicables_for_current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
replicables
=
primary_key_in
(
primary_key_in
)
.
merge
(
selective_sync_scope
(
node
))
.
merge
(
object_storage_scope
(
node
))
selective_sync_scope
(
node
,
replicables
)
end
# @return [ActiveRecord::Relation<Ci::{Pipeline|Job}PipelineArtifact>] observing object storage settings of the given node
def
object_storage_scope
(
node
)
return
all
if
node
.
sync_object_storage?
with_files_stored_locally
end
def
selective_sync_scope
(
node
)
return
all
unless
node
.
selective_sync?
# The primary_key_in in replicables_for_current_secondary method is at most a range of IDs with a maximum of 10_000 records
# between them. We can additionally reduce the batch size to 1_000 just for pipeline artifacts and job artifacts if needed.
#
# @return [ActiveRecord::Relation<Ci::{Pipeline|Job}PipelineArtifact>] observing selective sync settings of the given node
def
selective_sync_scope
(
node
,
replicables
)
return
replicables
unless
node
.
selective_sync?
# Note that we can't do node.projects.ids since it can have millions of records.
replicables_project_ids
=
replicables
.
distinct
.
pluck
(
:project_id
)
selective_projects_ids
=
node
.
projects
.
id_in
(
replicables_project_ids
).
pluck_primary_key
project_id_in
(
node
.
project
s
)
replicables
.
project_id_in
(
selective_projects_id
s
)
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