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
82f5bb0e
Commit
82f5bb0e
authored
Oct 12, 2020
by
Mike Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename replicables_for_geo_node method
...to replicables_for_current_secondary
parent
ed23254b
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
42 additions
and
42 deletions
+42
-42
doc/development/geo/framework.md
doc/development/geo/framework.md
+1
-1
ee/app/models/concerns/geo/blob_replicator_strategy.rb
ee/app/models/concerns/geo/blob_replicator_strategy.rb
+1
-1
ee/app/models/concerns/geo/repository_replicator_strategy.rb
ee/app/models/concerns/geo/repository_replicator_strategy.rb
+1
-1
ee/app/models/ee/ci/job_artifact.rb
ee/app/models/ee/ci/job_artifact.rb
+1
-1
ee/app/models/ee/container_repository.rb
ee/app/models/ee/container_repository.rb
+1
-1
ee/app/models/ee/lfs_object.rb
ee/app/models/ee/lfs_object.rb
+1
-1
ee/app/models/ee/merge_request_diff.rb
ee/app/models/ee/merge_request_diff.rb
+1
-1
ee/app/models/ee/packages/package_file.rb
ee/app/models/ee/packages/package_file.rb
+1
-1
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+1
-1
ee/app/models/ee/snippet_repository.rb
ee/app/models/ee/snippet_repository.rb
+1
-1
ee/app/models/ee/terraform/state_version.rb
ee/app/models/ee/terraform/state_version.rb
+1
-1
ee/app/models/ee/upload.rb
ee/app/models/ee/upload.rb
+1
-1
ee/app/models/geo/base_registry.rb
ee/app/models/geo/base_registry.rb
+1
-1
ee/app/models/geo/upload_registry.rb
ee/app/models/geo/upload_registry.rb
+1
-1
ee/lib/gitlab/geo/replicable_model.rb
ee/lib/gitlab/geo/replicable_model.rb
+2
-2
ee/lib/gitlab/geo/replicator.rb
ee/lib/gitlab/geo/replicator.rb
+1
-1
ee/spec/lib/gitlab/geo/replicable_model_spec.rb
ee/spec/lib/gitlab/geo/replicable_model_spec.rb
+4
-4
ee/spec/lib/gitlab/geo/replicator_spec.rb
ee/spec/lib/gitlab/geo/replicator_spec.rb
+2
-2
ee/spec/models/ee/ci/job_artifact_spec.rb
ee/spec/models/ee/ci/job_artifact_spec.rb
+2
-2
ee/spec/models/ee/merge_request_diff_spec.rb
ee/spec/models/ee/merge_request_diff_spec.rb
+4
-4
ee/spec/models/ee/terraform/state_version_spec.rb
ee/spec/models/ee/terraform/state_version_spec.rb
+2
-2
ee/spec/models/packages/package_file_spec.rb
ee/spec/models/packages/package_file_spec.rb
+2
-2
ee/spec/models/upload_spec.rb
ee/spec/models/upload_spec.rb
+2
-2
ee/spec/support/helpers/ee/geo_helpers.rb
ee/spec/support/helpers/ee/geo_helpers.rb
+1
-1
ee/spec/support/shared_examples/models/concerns/blob_replicator_strategy_shared_examples.rb
...dels/concerns/blob_replicator_strategy_shared_examples.rb
+2
-2
ee/spec/support/shared_examples/models/concerns/replicable_model_shared_examples.rb
...mples/models/concerns/replicable_model_shared_examples.rb
+2
-2
ee/spec/support/shared_examples/models/concerns/repository_replicator_strategy_shared_examples.rb
...oncerns/repository_replicator_strategy_shared_examples.rb
+2
-2
No files found.
doc/development/geo/framework.md
View file @
82f5bb0e
...
...
@@ -199,7 +199,7 @@ For example, to add support for files referenced by a `Widget` model with a
# @param primary_key_in [Range, Widget] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<Widget>] everything that should be synced to this node, restricted by primary key
def
self
.
replicables_for_
geo_node
(
primary_key_in
)
def
self
.
replicables_for_
current_secondary
(
primary_key_in
)
# Should be implemented. The idea of the method is to restrict
# the set of synced items depending on synchronization settings
end
...
...
ee/app/models/concerns/geo/blob_replicator_strategy.rb
View file @
82f5bb0e
...
...
@@ -22,7 +22,7 @@ module Geo
# Called by Gitlab::Geo::Replicator#consume
def
consume_event_created
(
**
params
)
return
unless
in_replicables_for_
geo_node
?
return
unless
in_replicables_for_
current_secondary
?
download
end
...
...
ee/app/models/concerns/geo/repository_replicator_strategy.rb
View file @
82f5bb0e
...
...
@@ -15,7 +15,7 @@ module Geo
# Called by Gitlab::Geo::Replicator#consume
def
consume_event_updated
(
**
params
)
return
unless
in_replicables_for_
geo_node
?
return
unless
in_replicables_for_
current_secondary
?
sync_repository
end
...
...
ee/app/models/ee/ci/job_artifact.rb
View file @
82f5bb0e
...
...
@@ -84,7 +84,7 @@ module EE
# @param primary_key_in [Range, Ci::JobArtifact] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<Ci::JobArtifact>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
not_expired
...
...
ee/app/models/ee/container_repository.rb
View file @
82f5bb0e
...
...
@@ -11,7 +11,7 @@ module EE
class_methods
do
# @param primary_key_in [Range, ContainerRepository] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<ContainerRepository>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
node
.
container_repositories
.
primary_key_in
(
primary_key_in
)
...
...
ee/app/models/ee/lfs_object.rb
View file @
82f5bb0e
...
...
@@ -19,7 +19,7 @@ module EE
class_methods
do
# @param primary_key_in [Range, LfsObject] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<LfsObject>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
local_storage_only
=
!
node
.
sync_object_storage
...
...
ee/app/models/ee/merge_request_diff.rb
View file @
82f5bb0e
...
...
@@ -31,7 +31,7 @@ module EE
class_methods
do
# @param primary_key_in [Range, MergeRequestDiff] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<MergeRequestDiff>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
has_external_diffs
.
primary_key_in
(
primary_key_in
)
...
...
ee/app/models/ee/packages/package_file.rb
View file @
82f5bb0e
...
...
@@ -13,7 +13,7 @@ module EE
class_methods
do
# @param primary_key_in [Range, Packages::PackageFile] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<LfsObject>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
primary_key_in
(
primary_key_in
)
.
merge
(
selective_sync_scope
)
.
merge
(
object_storage_scope
)
...
...
ee/app/models/ee/project.rb
View file @
82f5bb0e
...
...
@@ -206,7 +206,7 @@ module EE
# @param primary_key_in [Range, Project] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<Project>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
node
.
projects
.
primary_key_in
(
primary_key_in
)
...
...
ee/app/models/ee/snippet_repository.rb
View file @
82f5bb0e
...
...
@@ -13,7 +13,7 @@ module EE
class_methods
do
# @param primary_key_in [Range, SnippetRepository] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<SnippetRepository>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
# Not implemented yet. Should be responsible for selective sync
all
end
...
...
ee/app/models/ee/terraform/state_version.rb
View file @
82f5bb0e
...
...
@@ -16,7 +16,7 @@ module EE
class_methods
do
# @param primary_key_in [Range, Terraform::StateVersion] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<Terraform::StateVersion>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
primary_key_in
(
primary_key_in
)
...
...
ee/app/models/ee/upload.rb
View file @
82f5bb0e
...
...
@@ -20,7 +20,7 @@ module EE
class_methods
do
# @param primary_key_in [Range, Upload] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<Upload>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
primary_key_in
(
primary_key_in
)
...
...
ee/app/models/geo/base_registry.rb
View file @
82f5bb0e
...
...
@@ -53,7 +53,7 @@ class Geo::BaseRegistry < Geo::TrackingBase
model_primary_key
=
self
::
MODEL_CLASS
.
primary_key
.
to_sym
source_ids
=
self
::
MODEL_CLASS
.
replicables_for_
geo_node
(
range
)
.
replicables_for_
current_secondary
(
range
)
.
pluck
(
self
::
MODEL_CLASS
.
arel_table
[
model_primary_key
])
tracked_ids
=
self
.
pluck_model_ids_in_range
(
range
)
...
...
ee/app/models/geo/upload_registry.rb
View file @
82f5bb0e
...
...
@@ -34,7 +34,7 @@ class Geo::UploadRegistry < Geo::BaseRegistry
# For example: [[[1, 'avatar'], [5, 'file']], [[3, 'attachment']]]
def
self
.
find_registry_differences
(
range
)
source
=
self
::
MODEL_CLASS
.
replicables_for_
geo_node
(
range
)
self
::
MODEL_CLASS
.
replicables_for_
current_secondary
(
range
)
.
pluck
(
self
::
MODEL_CLASS
.
arel_table
[
:id
],
self
::
MODEL_CLASS
.
arel_table
[
:uploader
])
.
map!
{
|
id
,
uploader
|
[
id
,
uploader
.
sub
(
/Uploader\z/
,
''
).
underscore
]
}
...
...
ee/lib/gitlab/geo/replicable_model.rb
View file @
82f5bb0e
...
...
@@ -83,8 +83,8 @@ module Gitlab
end
end
def
in_replicables_for_
geo_node
?
self
.
class
.
replicables_for_
geo_node
(
self
).
exists?
def
in_replicables_for_
current_secondary
?
self
.
class
.
replicables_for_
current_secondary
(
self
).
exists?
end
end
end
...
...
ee/lib/gitlab/geo/replicator.rb
View file @
82f5bb0e
...
...
@@ -20,7 +20,7 @@ module Gitlab
delegate
:model
,
to: :class
delegate
:replication_enabled_feature_key
,
to: :class
delegate
:in_replicables_for_
geo_node
?
,
to: :model_record
delegate
:in_replicables_for_
current_secondary
?
,
to: :model_record
class
<<
self
delegate
:find_registries_never_attempted_sync
,
:find_registries_needs_sync_again
,
to: :registry_class
...
...
ee/spec/lib/gitlab/geo/replicable_model_spec.rb
View file @
82f5bb0e
...
...
@@ -43,11 +43,11 @@ RSpec.describe Gitlab::Geo::ReplicableModel do
end
end
describe
'#in_replicables_for_
geo_node
?'
do
it
'reuses replicables_for_
geo_node
'
do
expect
(
DummyModel
).
to
receive
(
:replicables_for_
geo_node
).
once
.
with
(
subject
).
and_call_original
describe
'#in_replicables_for_
current_secondary
?'
do
it
'reuses replicables_for_
current_secondary
'
do
expect
(
DummyModel
).
to
receive
(
:replicables_for_
current_secondary
).
once
.
with
(
subject
).
and_call_original
subject
.
in_replicables_for_
geo_node
?
subject
.
in_replicables_for_
current_secondary
?
end
end
end
ee/spec/lib/gitlab/geo/replicator_spec.rb
View file @
82f5bb0e
...
...
@@ -171,7 +171,7 @@ RSpec.describe Gitlab::Geo::Replicator do
end
end
describe
'#in_replicables_for_
geo_node
?'
do
it
{
is_expected
.
to
delegate_method
(
:in_replicables_for_
geo_node
?
).
to
(
:model_record
)
}
describe
'#in_replicables_for_
current_secondary
?'
do
it
{
is_expected
.
to
delegate_method
(
:in_replicables_for_
current_secondary
?
).
to
(
:model_record
)
}
end
end
ee/spec/models/ee/ci/job_artifact_spec.rb
View file @
82f5bb0e
...
...
@@ -133,7 +133,7 @@ RSpec.describe Ci::JobArtifact do
end
end
describe
'#replicables_for_
geo_node
'
do
describe
'#replicables_for_
current_secondary
'
do
# Selective sync is configured relative to the job artifact's project.
#
# Permutations of sync_object_storage combined with object-stored-artifacts
...
...
@@ -162,7 +162,7 @@ RSpec.describe Ci::JobArtifact do
end
with_them
do
subject
(
:job_artifact_included
)
{
described_class
.
replicables_for_
geo_node
(
ci_job_artifact
).
exists?
}
subject
(
:job_artifact_included
)
{
described_class
.
replicables_for_
current_secondary
(
ci_job_artifact
).
exists?
}
let
(
:project
)
{
create
(
*
project_factory
)
}
let
(
:ci_build
)
{
create
(
:ci_build
,
project:
project
)
}
...
...
ee/spec/models/ee/merge_request_diff_spec.rb
View file @
82f5bb0e
...
...
@@ -61,7 +61,7 @@ RSpec.describe MergeRequestDiff do
end
end
describe
'.replicables_for_
geo_node
'
do
describe
'.replicables_for_
current_secondary
'
do
context
'without selective sync or object storage'
do
let
(
:secondary
)
{
create
(
:geo_node
)
}
...
...
@@ -74,13 +74,13 @@ RSpec.describe MergeRequestDiff do
create
(
:merge_request
,
source_project:
project
)
expect
(
described_class
.
replicables_for_
geo_node
(
1
..
described_class
.
last
.
id
)).
to
be_empty
expect
(
described_class
.
replicables_for_
current_secondary
(
1
..
described_class
.
last
.
id
)).
to
be_empty
end
it
'excludes empty diffs'
do
create
(
:merge_request
,
source_project:
create
(
:project
))
expect
(
described_class
.
replicables_for_
geo_node
(
1
..
described_class
.
last
.
id
)).
to
be_empty
expect
(
described_class
.
replicables_for_
current_secondary
(
1
..
described_class
.
last
.
id
)).
to
be_empty
end
end
...
...
@@ -119,7 +119,7 @@ RSpec.describe MergeRequestDiff do
end
it
'returns the proper number of merge request diff states'
do
expect
(
described_class
.
replicables_for_
geo_node
(
1
..
described_class
.
last
.
id
)).
to
have_attributes
(
count:
synced_states
)
expect
(
described_class
.
replicables_for_
current_secondary
(
1
..
described_class
.
last
.
id
)).
to
have_attributes
(
count:
synced_states
)
end
end
end
...
...
ee/spec/models/ee/terraform/state_version_spec.rb
View file @
82f5bb0e
...
...
@@ -25,7 +25,7 @@ RSpec.describe Terraform::StateVersion do
end
end
describe
'.replicables_for_
geo_node
'
do
describe
'.replicables_for_
current_secondary
'
do
where
(
:selective_sync_enabled
,
:object_storage_sync_enabled
,
:terraform_object_storage_enabled
,
:synced_states
)
do
true
|
true
|
true
|
5
true
|
true
|
false
|
5
...
...
@@ -60,7 +60,7 @@ RSpec.describe Terraform::StateVersion do
end
it
'returns the proper number of terraform states'
do
expect
(
described_class
.
replicables_for_
geo_node
(
1
..
described_class
.
last
.
id
).
count
).
to
eq
(
synced_states
)
expect
(
described_class
.
replicables_for_
current_secondary
(
1
..
described_class
.
last
.
id
).
count
).
to
eq
(
synced_states
)
end
end
end
...
...
ee/spec/models/packages/package_file_spec.rb
View file @
82f5bb0e
...
...
@@ -36,8 +36,8 @@ RSpec.describe Packages::PackageFile, type: :model do
end
end
describe
'.replicables_for_
geo_node
'
do
subject
{
described_class
.
replicables_for_
geo_node
(
1
..
described_class
.
last
.
id
)
}
describe
'.replicables_for_
current_secondary
'
do
subject
{
described_class
.
replicables_for_
current_secondary
(
1
..
described_class
.
last
.
id
)
}
it
'returns a package files scope'
do
secondary
=
create
(
:geo_node
)
...
...
ee/spec/models/upload_spec.rb
View file @
82f5bb0e
...
...
@@ -6,7 +6,7 @@ RSpec.describe Upload do
include
EE
::
GeoHelpers
using
RSpec
::
Parameterized
::
TableSyntax
describe
'.replicables_for_
geo_node
'
do
describe
'.replicables_for_
current_secondary
'
do
# Selective sync is configured relative to the upload's model. Take care not
# to specify a model_factory that contradicts factory.
#
...
...
@@ -37,7 +37,7 @@ RSpec.describe Upload do
end
with_them
do
subject
(
:upload_included
)
{
described_class
.
replicables_for_
geo_node
(
upload
).
exists?
}
subject
(
:upload_included
)
{
described_class
.
replicables_for_
current_secondary
(
upload
).
exists?
}
let
(
:model
)
{
create
(
*
model_factory
)
}
let
(
:node
)
do
...
...
ee/spec/support/helpers/ee/geo_helpers.rb
View file @
82f5bb0e
...
...
@@ -83,7 +83,7 @@ module EE
with_replicator
Geo
::
DummyReplicator
def
self
.
replicables_for_
geo_node
(
primary_key_in
)
def
self
.
replicables_for_
current_secondary
(
primary_key_in
)
self
.
primary_key_in
(
primary_key_in
)
end
end
...
...
ee/spec/support/shared_examples/models/concerns/blob_replicator_strategy_shared_examples.rb
View file @
82f5bb0e
...
...
@@ -109,7 +109,7 @@ RSpec.shared_examples 'a blob replicator' do
describe
'created event consumption'
do
context
"when the blob's project is in replicables for this geo node"
do
it
'invokes Geo::BlobDownloadService'
do
expect
(
replicator
).
to
receive
(
:in_replicables_for_
geo_node
?
).
and_return
(
true
)
expect
(
replicator
).
to
receive
(
:in_replicables_for_
current_secondary
?
).
and_return
(
true
)
service
=
double
(
:service
)
expect
(
service
).
to
receive
(
:execute
)
...
...
@@ -121,7 +121,7 @@ RSpec.shared_examples 'a blob replicator' do
context
"when the blob's project is not in replicables for this geo node"
do
it
'does not invoke Geo::BlobDownloadService'
do
expect
(
replicator
).
to
receive
(
:in_replicables_for_
geo_node
?
).
and_return
(
false
)
expect
(
replicator
).
to
receive
(
:in_replicables_for_
current_secondary
?
).
and_return
(
false
)
expect
(
::
Geo
::
BlobDownloadService
).
not_to
receive
(
:new
)
...
...
ee/spec/support/shared_examples/models/concerns/replicable_model_shared_examples.rb
View file @
82f5bb0e
...
...
@@ -28,7 +28,7 @@ RSpec.shared_examples 'a replicable model' do
model_record
.
save!
end
describe
'.replicables_for_
geo_node
'
do
describe
'.replicables_for_
current_secondary
'
do
let_it_be
(
:secondary
)
{
create
(
:geo_node
)
}
before
do
...
...
@@ -36,7 +36,7 @@ RSpec.shared_examples 'a replicable model' do
end
it
'is implemented'
do
expect
(
model_record
.
class
.
replicables_for_
geo_node
(
model_record
.
id
)).
to
be_an
(
ActiveRecord
::
Relation
)
expect
(
model_record
.
class
.
replicables_for_
current_secondary
(
model_record
.
id
)).
to
be_an
(
ActiveRecord
::
Relation
)
end
end
end
ee/spec/support/shared_examples/models/concerns/repository_replicator_strategy_shared_examples.rb
View file @
82f5bb0e
...
...
@@ -71,7 +71,7 @@ RSpec.shared_examples 'a repository replicator' do
end
describe
'updated event consumption'
do
context
'in replicables_for_
geo_node
list'
do
context
'in replicables_for_
current_secondary
list'
do
it
'runs SnippetRepositorySyncService service'
do
model_record
.
save!
...
...
@@ -87,7 +87,7 @@ RSpec.shared_examples 'a repository replicator' do
end
end
context
'not in replicables_for_
geo_node
list'
do
context
'not in replicables_for_
current_secondary
list'
do
it
'runs SnippetRepositorySyncService service'
do
expect
(
::
Geo
::
FrameworkRepositorySyncService
)
.
not_to
receive
(
:new
)
...
...
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