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
870e135b
Commit
870e135b
authored
Apr 16, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid creating superfluous namespaces on Geo secondaries during sync
parent
7b41ff8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
ee/app/services/geo/base_sync_service.rb
ee/app/services/geo/base_sync_service.rb
+17
-6
ee/spec/services/geo/repository_sync_service_spec.rb
ee/spec/services/geo/repository_sync_service_spec.rb
+2
-2
No files found.
ee/app/services/geo/base_sync_service.rb
View file @
870e135b
...
@@ -201,17 +201,21 @@ module Geo
...
@@ -201,17 +201,21 @@ module Geo
# Remove the deleted path in case it exists, but it may not be there
# Remove the deleted path in case it exists, but it may not be there
gitlab_shell
.
remove_repository
(
project
.
repository_storage_path
,
deleted_disk_path_temp
)
gitlab_shell
.
remove_repository
(
project
.
repository_storage_path
,
deleted_disk_path_temp
)
# Make sure we have a namespace directory
gitlab_shell
.
add_namespace
(
project
.
repository_storage_path
,
deleted_disk_path_temp
)
# Make sure we have the most current state of exists?
# Make sure we have the most current state of exists?
repository
.
expire_exists_cache
repository
.
expire_exists_cache
if
repository
.
exists?
&&
!
gitlab_shell
.
mv_repository
(
project
.
repository_storage_path
,
repository
.
disk_path
,
deleted_disk_path_temp
)
# Move the current canonical repository to the deleted path for reference
raise
Gitlab
::
Shell
::
Error
,
'Can not move original repository out of the way'
if
repository
.
exists?
ensure_repository_namespace
(
deleted_disk_path_temp
)
unless
gitlab_shell
.
mv_repository
(
project
.
repository_storage_path
,
repository
.
disk_path
,
deleted_disk_path_temp
)
raise
Gitlab
::
Shell
::
Error
,
'Can not move original repository out of the way'
end
end
end
gitlab_shell
.
add_namespace
(
project
.
repository_storage_path
,
repository
.
disk_path
)
# Move the temporary repository to the canonical path
ensure_repository_namespace
(
repository
.
disk_path
)
unless
gitlab_shell
.
mv_repository
(
project
.
repository_storage_path
,
disk_path_temp
,
repository
.
disk_path
)
unless
gitlab_shell
.
mv_repository
(
project
.
repository_storage_path
,
disk_path_temp
,
repository
.
disk_path
)
raise
Gitlab
::
Shell
::
Error
,
'Can not move temporary repository'
raise
Gitlab
::
Shell
::
Error
,
'Can not move temporary repository'
...
@@ -223,6 +227,13 @@ module Geo
...
@@ -223,6 +227,13 @@ module Geo
end
end
end
end
def
ensure_repository_namespace
(
disk_path
)
gitlab_shell
.
add_namespace
(
project
.
repository_storage_path
,
File
.
dirname
(
disk_path
)
)
end
# To prevent the retry time from storing invalid dates in the database,
# To prevent the retry time from storing invalid dates in the database,
# cap the max time to a week plus some random jitter value.
# cap the max time to a week plus some random jitter value.
def
next_retry_time
(
retry_count
)
def
next_retry_time
(
retry_count
)
...
...
ee/spec/services/geo/repository_sync_service_spec.rb
View file @
870e135b
...
@@ -257,12 +257,12 @@ describe Geo::RepositorySyncService do
...
@@ -257,12 +257,12 @@ describe Geo::RepositorySyncService do
expect
(
subject
.
gitlab_shell
).
to
receive
(
:add_namespace
).
with
(
expect
(
subject
.
gitlab_shell
).
to
receive
(
:add_namespace
).
with
(
project
.
repository_storage_path
,
project
.
repository_storage_path
,
"@failed-geo-sync/
#{
repository
.
disk_path
}
"
"@failed-geo-sync/
#{
File
.
dirname
(
repository
.
disk_path
)
}
"
).
and_call_original
).
and_call_original
expect
(
subject
.
gitlab_shell
).
to
receive
(
:add_namespace
).
with
(
expect
(
subject
.
gitlab_shell
).
to
receive
(
:add_namespace
).
with
(
project
.
repository_storage_path
,
project
.
repository_storage_path
,
repository
.
disk_path
File
.
dirname
(
repository
.
disk_path
)
).
and_call_original
).
and_call_original
expect
(
subject
.
gitlab_shell
).
to
receive
(
:remove_repository
).
exactly
(
2
).
times
.
and_call_original
expect
(
subject
.
gitlab_shell
).
to
receive
(
:remove_repository
).
exactly
(
2
).
times
.
and_call_original
...
...
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