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
2f37d406
Commit
2f37d406
authored
May 18, 2018
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Geo] Don't remove project registry records
parent
cb8118df
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
22 deletions
+15
-22
ee/app/services/geo/base_sync_service.rb
ee/app/services/geo/base_sync_service.rb
+3
-15
ee/changelogs/unreleased/geo-prevent-removing-registry-records.yml
...logs/unreleased/geo-prevent-removing-registry-records.yml
+5
-0
ee/spec/services/geo/repository_sync_service_spec.rb
ee/spec/services/geo/repository_sync_service_spec.rb
+6
-6
ee/spec/support/services/base_sync_service_shared_examples.rb
...pec/support/services/base_sync_service_shared_examples.rb
+1
-1
No files found.
ee/app/services/geo/base_sync_service.rb
View file @
2f37d406
...
...
@@ -16,8 +16,7 @@ module Geo
GEO_REMOTE_NAME
=
'geo'
.
freeze
LEASE_TIMEOUT
=
8
.
hours
.
freeze
LEASE_KEY_PREFIX
=
'geo_sync_service'
.
freeze
RETRY_BEFORE_REDOWNLOAD
=
5
RETRY_LIMIT
=
8
RETRIES_BEFORE_REDOWNLOAD
=
5
def
initialize
(
project
)
@project
=
project
...
...
@@ -29,13 +28,8 @@ module Geo
if
should_be_retried?
sync_repository
elsif
should_be_redownloaded?
sync_repository
(
true
)
else
# Clean up the state of sync to start a new cycle
registry
.
delete
log_info
(
"Clean up
#{
type
}
sync status"
)
break
sync_repository
(
true
)
end
log_info
(
"Finished
#{
type
}
sync"
)
...
...
@@ -97,13 +91,7 @@ module Geo
def
should_be_retried?
return
false
if
registry
.
public_send
(
"force_to_redownload_
#{
type
}
"
)
# rubocop:disable GitlabSecurity/PublicSend
retry_count
<=
RETRY_BEFORE_REDOWNLOAD
end
def
should_be_redownloaded?
return
true
if
registry
.
public_send
(
"force_to_redownload_
#{
type
}
"
)
# rubocop:disable GitlabSecurity/PublicSend
(
RETRY_BEFORE_REDOWNLOAD
..
RETRY_LIMIT
)
===
retry_count
retry_count
<=
RETRIES_BEFORE_REDOWNLOAD
end
def
current_node
...
...
ee/changelogs/unreleased/geo-prevent-removing-registry-records.yml
0 → 100644
View file @
2f37d406
---
title
:
"
[Geo]
Don't
remove
project
registry
records"
merge_request
:
author
:
type
:
fixed
ee/spec/services/geo/repository_sync_service_spec.rb
View file @
2f37d406
...
...
@@ -252,7 +252,7 @@ describe Geo::RepositorySyncService do
context
'retries'
do
it
'tries to fetch repo'
do
create
(
:geo_project_registry
,
project:
project
,
repository_retry_count:
Geo
::
BaseSyncService
::
RETR
Y
_BEFORE_REDOWNLOAD
-
1
)
create
(
:geo_project_registry
,
project:
project
,
repository_retry_count:
Geo
::
BaseSyncService
::
RETR
IES
_BEFORE_REDOWNLOAD
-
1
)
expect
(
subject
).
to
receive
(
:sync_repository
).
with
(
no_args
)
...
...
@@ -260,7 +260,7 @@ describe Geo::RepositorySyncService do
end
it
'sets the redownload flag to false after success'
do
registry
=
create
(
:geo_project_registry
,
project:
project
,
repository_retry_count:
Geo
::
BaseSyncService
::
RETR
Y
_BEFORE_REDOWNLOAD
+
1
,
force_to_redownload_repository:
true
)
registry
=
create
(
:geo_project_registry
,
project:
project
,
repository_retry_count:
Geo
::
BaseSyncService
::
RETR
IES
_BEFORE_REDOWNLOAD
+
1
,
force_to_redownload_repository:
true
)
subject
.
execute
...
...
@@ -268,7 +268,7 @@ describe Geo::RepositorySyncService do
end
it
'tries to redownload repo'
do
create
(
:geo_project_registry
,
project:
project
,
repository_retry_count:
Geo
::
BaseSyncService
::
RETR
Y
_BEFORE_REDOWNLOAD
+
1
)
create
(
:geo_project_registry
,
project:
project
,
repository_retry_count:
Geo
::
BaseSyncService
::
RETR
IES
_BEFORE_REDOWNLOAD
+
1
)
expect
(
subject
).
to
receive
(
:sync_repository
).
with
(
true
).
and_call_original
expect
(
subject
.
gitlab_shell
).
to
receive
(
:mv_repository
).
exactly
(
2
).
times
.
and_call_original
...
...
@@ -294,7 +294,7 @@ describe Geo::RepositorySyncService do
create
(
:geo_project_registry
,
project:
project
,
repository_retry_count:
Geo
::
BaseSyncService
::
RETR
Y
_BEFORE_REDOWNLOAD
-
1
,
repository_retry_count:
Geo
::
BaseSyncService
::
RETR
IES
_BEFORE_REDOWNLOAD
-
1
,
force_to_redownload_repository:
true
)
...
...
@@ -307,7 +307,7 @@ describe Geo::RepositorySyncService do
create
(
:geo_project_registry
,
project:
project
,
repository_retry_count:
Geo
::
BaseSyncService
::
RETR
Y
_BEFORE_REDOWNLOAD
-
1
,
repository_retry_count:
Geo
::
BaseSyncService
::
RETR
IES
_BEFORE_REDOWNLOAD
-
1
,
force_to_redownload_repository:
true
)
...
...
@@ -323,7 +323,7 @@ describe Geo::RepositorySyncService do
registry
=
create
(
:geo_project_registry
,
project:
project
,
repository_retry_count:
Geo
::
BaseSyncService
::
RETR
Y
_BEFORE_REDOWNLOAD
+
2000
,
repository_retry_count:
Geo
::
BaseSyncService
::
RETR
IES
_BEFORE_REDOWNLOAD
+
2000
,
repository_retry_at:
timestamp
,
force_to_redownload_repository:
true
)
...
...
ee/spec/support/services/base_sync_service_shared_examples.rb
View file @
2f37d406
...
...
@@ -119,7 +119,7 @@ shared_examples 'geo base sync fetch and repack' do
end
shared_examples
'sync retries use the snapshot RPC'
do
let
(
:retry_count
)
{
Geo
::
BaseSyncService
::
RETR
Y
_BEFORE_REDOWNLOAD
}
let
(
:retry_count
)
{
Geo
::
BaseSyncService
::
RETR
IES
_BEFORE_REDOWNLOAD
}
context
'snapshot synchronization method'
do
before
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