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
7d1f8ba4
Commit
7d1f8ba4
authored
Aug 22, 2019
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved with codestyle changes
parent
94b5f213
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
38 deletions
+51
-38
ee/app/finders/geo/attachment_registry_finder.rb
ee/app/finders/geo/attachment_registry_finder.rb
+4
-5
ee/app/finders/geo/file_registry_finder.rb
ee/app/finders/geo/file_registry_finder.rb
+1
-1
ee/app/finders/geo/job_artifact_registry_finder.rb
ee/app/finders/geo/job_artifact_registry_finder.rb
+4
-5
ee/app/finders/geo/lfs_object_registry_finder.rb
ee/app/finders/geo/lfs_object_registry_finder.rb
+4
-5
ee/app/models/concerns/geo/selective_sync.rb
ee/app/models/concerns/geo/selective_sync.rb
+5
-1
ee/app/models/geo/fdw/lfs_object.rb
ee/app/models/geo/fdw/lfs_object.rb
+1
-1
ee/spec/finders/geo/attachment_registry_finder_spec.rb
ee/spec/finders/geo/attachment_registry_finder_spec.rb
+32
-20
No files found.
ee/app/finders/geo/attachment_registry_finder.rb
View file @
7d1f8ba4
...
...
@@ -28,11 +28,10 @@ module Geo
end
def
syncable
if
selective_sync?
attachments
else
local_storage_only?
?
Upload
.
with_files_stored_locally
:
Upload
end
return
attachments
if
selective_sync?
return
Upload
.
with_files_stored_locally
if
local_storage_only?
Upload
end
# Find limited amount of non replicated attachments.
...
...
ee/app/finders/geo/file_registry_finder.rb
View file @
7d1f8ba4
...
...
@@ -79,7 +79,7 @@ module Geo
end
def
local_storage_only?
!
current_node
.
sync_object_storage
!
current_node
&
.
sync_object_storage
end
end
end
ee/app/finders/geo/job_artifact_registry_finder.rb
View file @
7d1f8ba4
...
...
@@ -25,11 +25,10 @@ module Geo
end
def
syncable
if
selective_sync?
job_artifacts
.
not_expired
else
local_storage_only?
?
Ci
::
JobArtifact
.
not_expired
.
with_files_stored_locally
:
Ci
::
JobArtifact
.
not_expired
end
return
job_artifacts
.
not_expired
if
selective_sync?
return
Ci
::
JobArtifact
.
not_expired
.
with_files_stored_locally
if
local_storage_only?
Ci
::
JobArtifact
.
not_expired
end
# Find limited amount of non replicated job artifacts.
...
...
ee/app/finders/geo/lfs_object_registry_finder.rb
View file @
7d1f8ba4
...
...
@@ -25,11 +25,10 @@ module Geo
end
def
syncable
if
selective_sync?
lfs_objects
else
local_storage_only?
?
LfsObject
.
with_files_stored_locally
:
LfsObject
end
return
lfs_objects
if
selective_sync?
return
LfsObject
.
with_files_stored_locally
if
local_storage_only?
LfsObject
end
# Find limited amount of non replicated lfs objects.
...
...
ee/app/models/concerns/geo/selective_sync.rb
View file @
7d1f8ba4
...
...
@@ -128,7 +128,11 @@ module Geo::SelectiveSync
end
def
attachments_for_model_type_with_id_in
(
model_type
,
model_ids
)
uploads_table
[
:model_type
].
eq
(
model_type
).
and
(
uploads_table
[
:model_id
].
in
(
model_ids
.
arel
))
uploads_table
[
:model_type
]
.
eq
(
model_type
)
.
and
(
uploads_table
[
:model_id
].
in
(
model_ids
.
arel
)
)
end
# This concern doesn't define a geo_node_namespace_links relation. That's
...
...
ee/app/models/geo/fdw/lfs_object.rb
View file @
7d1f8ba4
...
...
@@ -28,7 +28,7 @@ module Geo
.
on
(
arel_table
[
:id
].
eq
(
file_registry_table
[
:file_id
]))
joins
(
join_statement
.
join_sources
)
.
merge
(
Geo
::
FileRegistry
.
lfs_objects
)
.
merge
(
Geo
::
FileRegistry
.
lfs_objects
)
end
def
missing_file_registry
...
...
ee/spec/finders/geo/attachment_registry_finder_spec.rb
View file @
7d1f8ba4
...
...
@@ -41,19 +41,21 @@ describe Geo::AttachmentRegistryFinder, :geo, :geo_fdw do
create
(
:geo_file_registry
,
:avatar
,
file_id:
upload_remote_synced_project
.
id
)
end
it
'returns attachments without an entry on the tracking database'
do
attachments
=
subject
.
find_unsynced
(
batch_size:
10
)
context
'with object storage sync enabled'
do
it
'returns attachments without an entry on the tracking database'
do
attachments
=
subject
.
find_unsynced
(
batch_size:
10
)
expect
(
attachments
).
to
match_ids
(
upload_issuable_synced_nested_project
,
upload_unsynced_project
,
upload_synced_project
,
upload_personal_snippet
,
upload_remote_unsynced_project
,
upload_remote_synced_group
)
end
expect
(
attachments
).
to
match_ids
(
upload_issuable_synced_nested_project
,
upload_unsynced_project
,
upload_synced_project
,
upload_personal_snippet
,
upload_remote_unsynced_project
,
upload_remote_synced_group
)
end
it
'returns attachments without an entry on the tracking database, excluding from exception list'
do
attachments
=
subject
.
find_unsynced
(
batch_size:
10
,
except_file_ids:
[
upload_issuable_synced_nested_project
.
id
])
it
'returns attachments without an entry on the tracking database, excluding from exception list'
do
attachments
=
subject
.
find_unsynced
(
batch_size:
10
,
except_file_ids:
[
upload_issuable_synced_nested_project
.
id
])
expect
(
attachments
).
to
match_ids
(
upload_unsynced_project
,
upload_synced_project
,
upload_personal_snippet
,
upload_remote_unsynced_project
,
upload_remote_synced_group
)
expect
(
attachments
).
to
match_ids
(
upload_unsynced_project
,
upload_synced_project
,
upload_personal_snippet
,
upload_remote_unsynced_project
,
upload_remote_synced_group
)
end
end
context
'with object storage sync disabled'
do
...
...
@@ -143,8 +145,10 @@ describe Geo::AttachmentRegistryFinder, :geo, :geo_fdw do
create
(
:geo_file_registry
,
:attachment
,
file_id:
upload_remote_unsynced_project
.
id
)
end
it
'counts attachments that have been synced'
do
expect
(
subject
.
count_synced
).
to
eq
7
context
'with object storage sync enabled'
do
it
'counts attachments that have been synced'
do
expect
(
subject
.
count_synced
).
to
eq
7
end
end
context
'with object storage sync disabled'
do
...
...
@@ -184,8 +188,10 @@ describe Geo::AttachmentRegistryFinder, :geo, :geo_fdw do
create
(
:geo_file_registry
,
:attachment
,
:failed
,
file_id:
upload_remote_unsynced_project
.
id
)
end
it
'counts attachments that sync has failed'
do
expect
(
subject
.
count_failed
).
to
eq
7
context
'with object storage sync enabled'
do
it
'counts attachments that sync has failed'
do
expect
(
subject
.
count_failed
).
to
eq
7
end
end
context
'with object storage sync disabled'
do
...
...
@@ -225,8 +231,10 @@ describe Geo::AttachmentRegistryFinder, :geo, :geo_fdw do
create
(
:geo_file_registry
,
:attachment
,
file_id:
upload_remote_unsynced_project
.
id
,
missing_on_primary:
true
)
end
it
'counts attachments that have been synced and are missing on the primary'
do
expect
(
subject
.
count_synced_missing_on_primary
).
to
eq
6
context
'with object storage sync enabled'
do
it
'counts attachments that have been synced and are missing on the primary'
do
expect
(
subject
.
count_synced_missing_on_primary
).
to
eq
6
end
end
context
'with object storage sync disabled'
do
...
...
@@ -255,8 +263,10 @@ describe Geo::AttachmentRegistryFinder, :geo, :geo_fdw do
end
describe
'#count_syncable'
do
it
'counts attachments'
do
expect
(
subject
.
count_syncable
).
to
eq
9
context
'with object storage sync enabled'
do
it
'counts attachments'
do
expect
(
subject
.
count_syncable
).
to
eq
9
end
end
context
'with object storage sync disabled'
do
...
...
@@ -297,8 +307,10 @@ describe Geo::AttachmentRegistryFinder, :geo, :geo_fdw do
create
(
:geo_file_registry
,
:attachment
,
file_id:
upload_remote_synced_group
.
id
,
missing_on_primary:
true
)
end
it
'counts file registries for attachments'
do
expect
(
subject
.
count_registry
).
to
eq
9
context
'with object storage sync enabled'
do
it
'counts file registries for attachments'
do
expect
(
subject
.
count_registry
).
to
eq
9
end
end
context
'with object storage sync disabled'
do
...
...
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