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
e21422f0
Commit
e21422f0
authored
Sep 02, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put the streaming backfill worker behind a feature flag
parent
bb5b266b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
13 deletions
+29
-13
ee/app/workers/geo/repository_sync_worker.rb
ee/app/workers/geo/repository_sync_worker.rb
+5
-2
ee/spec/workers/geo/repository_sync_worker_spec.rb
ee/spec/workers/geo/repository_sync_worker_spec.rb
+24
-11
No files found.
ee/app/workers/geo/repository_sync_worker.rb
View file @
e21422f0
...
...
@@ -3,8 +3,11 @@
module
Geo
class
RepositorySyncWorker
<
Geo
::
Scheduler
::
Secondary
::
PerShardSchedulerWorker
def
schedule_job
(
shard_name
)
# TODO: Put this behind a feature flag
if
::
Feature
.
enabled?
(
:geo_streaming_results_repository_sync
)
Geo
::
Secondary
::
RepositoryBackfillWorker
.
perform_async
(
shard_name
)
else
Geo
::
RepositoryShardSyncWorker
.
perform_async
(
shard_name
)
end
end
end
end
ee/spec/workers/geo/repository_sync_worker_spec.rb
View file @
e21422f0
...
...
@@ -8,11 +8,8 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do
let!
(
:synced_group
)
{
create
(
:group
)
}
let!
(
:project_in_synced_group
)
{
create
(
:project
,
group:
synced_group
)
}
let!
(
:unsynced_project
)
{
create
(
:project
)
}
let
(
:healthy_shard_name
)
{
project_in_synced_group
.
repository
.
storage
}
subject
{
described_class
.
new
}
before
do
stub_current_geo_node
(
secondary
)
end
...
...
@@ -21,7 +18,7 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do
Sidekiq
::
Testing
.
inline!
{
example
.
run
}
end
describe
'#perform'
do
shared_examples
'#perform'
do
|
worker
|
context
'additional shards'
do
it
'skips backfill for repositories on other shards'
do
create
(
:project
,
:broken_storage
,
group:
synced_group
)
...
...
@@ -32,7 +29,7 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do
raise
GRPC
::
Unavailable
.
new
(
'No Gitaly available'
)
end
expect
(
Geo
::
RepositoryShardSyncW
orker
).
not_to
receive
(
:perform_async
).
with
(
'broken'
)
expect
(
w
orker
).
not_to
receive
(
:perform_async
).
with
(
'broken'
)
subject
.
perform
end
...
...
@@ -44,8 +41,8 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do
expect
(
Gitlab
::
HealthChecks
::
GitalyCheck
).
to
receive
(
:readiness
)
.
and_return
([
result
(
true
,
healthy_shard_name
),
result
(
true
,
'broken'
)])
expect
(
Geo
::
RepositoryShardSyncW
orker
).
to
receive
(
:perform_async
).
with
(
'default'
)
expect
(
Geo
::
RepositoryShardSyncW
orker
).
not_to
receive
(
:perform_async
).
with
(
'broken'
)
expect
(
w
orker
).
to
receive
(
:perform_async
).
with
(
'default'
)
expect
(
w
orker
).
not_to
receive
(
:perform_async
).
with
(
'broken'
)
subject
.
perform
end
...
...
@@ -61,8 +58,8 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do
# hide the 'broken' storage for this spec
stub_storage_settings
({})
expect
(
Geo
::
RepositoryShardSyncW
orker
).
to
receive
(
:perform_async
).
with
(
project_in_synced_group
.
repository
.
storage
)
expect
(
Geo
::
RepositoryShardSyncW
orker
).
not_to
receive
(
:perform_async
).
with
(
'unknown'
)
expect
(
w
orker
).
to
receive
(
:perform_async
).
with
(
project_in_synced_group
.
repository
.
storage
)
expect
(
w
orker
).
not_to
receive
(
:perform_async
).
with
(
'unknown'
)
subject
.
perform
end
...
...
@@ -77,14 +74,30 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do
expect
(
Gitlab
::
HealthChecks
::
GitalyCheck
).
to
receive
(
:readiness
)
.
and_return
([
result
(
true
,
healthy_shard_name
),
result
(
false
,
'broken'
)])
expect
(
Geo
::
RepositoryShardSyncW
orker
).
to
receive
(
:perform_async
).
with
(
healthy_shard_name
)
expect
(
Geo
::
RepositoryShardSyncW
orker
).
not_to
receive
(
:perform_async
).
with
(
'broken'
)
expect
(
w
orker
).
to
receive
(
:perform_async
).
with
(
healthy_shard_name
)
expect
(
w
orker
).
not_to
receive
(
:perform_async
).
with
(
'broken'
)
subject
.
perform
end
end
end
context
'when geo_streaming_results_repository_sync flag is enabled'
,
:geo_fdw
do
before
do
stub_feature_flags
(
geo_streaming_results_repository_sync:
true
)
end
include_examples
'#perform'
,
Geo
::
Secondary
::
RepositoryBackfillWorker
end
context
'when geo_streaming_results_repository_sync flag is disabled'
do
before
do
stub_feature_flags
(
geo_streaming_results_repository_sync:
false
)
end
include_examples
'#perform'
,
Geo
::
RepositoryShardSyncWorker
end
def
result
(
success
,
shard
)
Gitlab
::
HealthChecks
::
Result
.
new
(
success
,
nil
,
{
shard:
shard
})
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