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
7b85f67a
Commit
7b85f67a
authored
Nov 28, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes and improve Repository Storage Migration
parent
c94f3da8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
2 deletions
+7
-2
app/services/geo/hashed_storage_migration_service.rb
app/services/geo/hashed_storage_migration_service.rb
+5
-0
spec/factories/geo/event_log.rb
spec/factories/geo/event_log.rb
+1
-1
spec/services/geo/hashed_storage_migration_service_spec.rb
spec/services/geo/hashed_storage_migration_service_spec.rb
+1
-1
No files found.
app/services/geo/hashed_storage_migration_service.rb
View file @
7b85f67a
module
Geo
class
HashedStorageMigrationService
include
::
Gitlab
::
Geo
::
LogHelpers
attr_reader
:project_id
,
:old_disk_path
,
:new_disk_path
,
:old_storage_version
def
initialize
(
project_id
,
old_disk_path
:,
new_disk_path
:,
old_storage_version
:)
...
...
@@ -22,9 +24,12 @@ module Geo
project
.
expire_caches_before_rename
(
old_disk_path
)
if
migrating_from_legacy_storage?
&&
!
move_repository
log_error
(
"Repository could not be migrated to Hashed Storage"
,
project_id:
project
.
id
,
source:
old_disk_path
,
target:
new_disk_path
)
raise
RepositoryCannotBeRenamed
,
"Repository
#{
old_disk_path
}
could not be renamed to
#{
new_disk_path
}
"
end
log_info
(
"Repository migrated to Hashed Storage"
,
project_id:
project
.
id
,
source:
old_disk_path
,
target:
new_disk_path
)
true
end
...
...
spec/factories/geo/event_log.rb
View file @
7b85f67a
...
...
@@ -82,7 +82,7 @@ FactoryGirl.define do
new_disk_path
{
project
.
path_with_namespace
+
'_new'
}
old_wiki_disk_path
{
project
.
wiki
.
path_with_namespace
}
new_wiki_disk_path
{
project
.
wiki
.
path_with_namespace
+
'_new'
}
new_storage_version
{
Project
::
LATEST_STORAGE_VERSION
}
new_storage_version
{
Project
::
HASHED_STORAGE_FEATURES
[
:repository
]
}
end
factory
:geo_hashed_storage_attachments_event
,
class:
Geo
::
HashedStorageAttachmentsEvent
do
...
...
spec/services/geo/hashed_storage_migration_service_spec.rb
View file @
7b85f67a
...
...
@@ -10,7 +10,7 @@ describe Geo::HashedStorageMigrationService do
describe
'#execute'
do
context
'project backed by legacy storage'
do
before
do
project
.
update_attribute
(
:storage_version
,
Project
::
LATEST_STORAGE_VERSION
)
project
.
update_attribute
(
:storage_version
,
Project
::
HASHED_STORAGE_FEATURES
[
:repository
]
)
end
it
'moves the project repositories'
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