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
7c8fe2ec
Commit
7c8fe2ec
authored
Jun 07, 2018
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Automatically clean up stale lock files on Geo secondary
parent
96643d0b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
26 deletions
+23
-26
ee/app/services/geo/base_sync_service.rb
ee/app/services/geo/base_sync_service.rb
+2
-1
ee/changelogs/unreleased/5533-geo-automatically-clean-up-stale-lock-files-on-geo-secondary.yml
...omatically-clean-up-stale-lock-files-on-geo-secondary.yml
+1
-1
ee/spec/services/geo/repository_sync_service_spec.rb
ee/spec/services/geo/repository_sync_service_spec.rb
+11
-16
ee/spec/services/geo/wiki_sync_service_spec.rb
ee/spec/services/geo/wiki_sync_service_spec.rb
+9
-8
No files found.
ee/app/services/geo/base_sync_service.rb
View file @
7c8fe2ec
...
...
@@ -167,8 +167,9 @@ module Geo
attrs
[
"resync_
#{
type
}
"
]
=
true
attrs
[
"last_
#{
type
}
_sync_failure"
]
=
"
#{
message
}
:
#{
error
.
message
}
"
attrs
[
"
#{
type
}
_retry_count"
]
=
retry_count
+
1
registry
.
update!
(
attrs
)
repository
.
clean_stale_repository_files
end
def
type
...
...
ee/changelogs/unreleased/5533-geo-automatically-clean-up-stale-lock-files-on-geo-secondary.yml
View file @
7c8fe2ec
---
title
:
'
Geo:
Automatically
clean
up
stale
lock
files
on
Geo
secondary'
merge_request
:
merge_request
:
6034
author
:
type
:
fixed
ee/spec/services/geo/repository_sync_service_spec.rb
View file @
7c8fe2ec
...
...
@@ -224,28 +224,23 @@ describe Geo::RepositorySyncService do
allow
(
repository
).
to
receive
(
:fetch_as_mirror
)
.
with
(
url_to_repo
,
remote_name:
'geo'
,
forced:
true
)
.
and_raise
(
Gitlab
::
Shell
::
Error
.
new
(
'shell error'
))
subject
.
execute
end
it
'sets last_repository_synced_at'
do
expect
(
registry
.
last_repository_synced_at
).
not_to
be_nil
end
it
'resets last_repository_successful_sync_at'
do
expect
(
registry
.
last_repository_successful_sync_at
).
to
be_nil
end
it
'sets correct values for registry record'
do
subject
.
execute
it
'resets repository_retry_count'
do
expect
(
registry
.
repository_retry_count
).
to
eq
(
1
)
expect
(
registry
).
to
have_attributes
(
last_repository_synced_at:
be_present
,
last_repository_successful_sync_at:
nil
,
repository_retry_count:
1
,
repository_retry_at:
be_present
,
last_repository_sync_failure:
'Error syncing repository: shell error'
)
end
it
'resets repository_retry_at'
do
expect
(
registry
.
repository_retry_at
).
to
be_present
end
it
'calls repository cleanup'
do
expect
(
repository
).
to
receive
(
:clean_stale_repository_files
)
it
'sets last_repository_sync_failure'
do
expect
(
registry
.
last_repository_sync_failure
).
to
eq
(
'Error syncing repository: shell error'
)
subject
.
execute
end
end
end
...
...
ee/spec/services/geo/wiki_sync_service_spec.rb
View file @
7c8fe2ec
...
...
@@ -184,20 +184,21 @@ RSpec.describe Geo::WikiSyncService do
allow
(
repository
).
to
receive
(
:fetch_as_mirror
)
.
with
(
url_to_repo
,
remote_name:
'geo'
,
forced:
true
)
.
and_raise
(
Gitlab
::
Shell
::
Error
.
new
(
'shell error'
))
end
it
'sets correct values for registry record'
do
subject
.
execute
end
it
'sets last_wiki_synced_at'
do
expect
(
registry
.
last_wiki_synced_at
).
not_to
be_nil
expect
(
registry
).
to
have_attributes
(
last_wiki_synced_at:
be_present
,
last_wiki_successful_sync_at:
nil
,
last_wiki_sync_failure:
'Error syncing wiki repository: shell error'
)
end
it
'resets last_wiki_successful_sync_at'
do
expect
(
registry
.
last_wiki_successful_sync_at
).
to
be_nil
end
it
'calls repository cleanup'
do
expect
(
repository
).
to
receive
(
:clean_stale_repository_files
)
it
'sets last_wiki_sync_failure'
do
expect
(
registry
.
last_wiki_sync_failure
).
to
eq
(
'Error syncing wiki repository: shell error'
)
subject
.
execute
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