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
3236bff8
Commit
3236bff8
authored
Nov 07, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send a Geo hashed migration event when migrating to hashed storage
parent
2307b35f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
15 deletions
+18
-15
app/services/geo/hashed_storage_migrated_event_store.rb
app/services/geo/hashed_storage_migrated_event_store.rb
+1
-1
app/services/projects/hashed_storage_migration_service.rb
app/services/projects/hashed_storage_migration_service.rb
+4
-2
ee/app/services/ee/projects/hashed_storage_migration_service.rb
.../services/ee/projects/hashed_storage_migration_service.rb
+4
-3
spec/ee/spec/services/ee/projects/hashed_storage_migration_service_spec.rb
...ices/ee/projects/hashed_storage_migration_service_spec.rb
+9
-9
No files found.
app/services/geo/hashed_storage_migrated_event_store.rb
View file @
3236bff8
...
@@ -27,7 +27,7 @@ module Geo
...
@@ -27,7 +27,7 @@ module Geo
end
end
def
old_wiki_disk_path
def
old_wiki_disk_path
"
#{
old_disk_path
}
.wiki"
params
.
fetch
(
:old_wiki_disk_path
)
end
end
end
end
end
end
app/services/projects/hashed_storage_migration_service.rb
View file @
3236bff8
...
@@ -4,7 +4,7 @@ module Projects
...
@@ -4,7 +4,7 @@ module Projects
prepend
::
EE
::
Projects
::
HashedStorageMigrationService
prepend
::
EE
::
Projects
::
HashedStorageMigrationService
attr_reader
:old_disk_path
,
:new_disk_path
attr_reader
:old_disk_path
,
:new_disk_path
,
:old_wiki_disk_path
,
:old_storage_version
def
initialize
(
project
,
logger
=
nil
)
def
initialize
(
project
,
logger
=
nil
)
@project
=
project
@project
=
project
...
@@ -17,6 +17,7 @@ module Projects
...
@@ -17,6 +17,7 @@ module Projects
@old_disk_path
=
project
.
disk_path
@old_disk_path
=
project
.
disk_path
has_wiki
=
project
.
wiki
.
repository_exists?
has_wiki
=
project
.
wiki
.
repository_exists?
@old_storage_version
=
project
.
storage_version
project
.
storage_version
=
Storage
::
HashedProject
::
STORAGE_VERSION
project
.
storage_version
=
Storage
::
HashedProject
::
STORAGE_VERSION
project
.
ensure_storage_path_exists
project
.
ensure_storage_path_exists
...
@@ -25,7 +26,8 @@ module Projects
...
@@ -25,7 +26,8 @@ module Projects
result
=
move_repository
(
@old_disk_path
,
@new_disk_path
)
result
=
move_repository
(
@old_disk_path
,
@new_disk_path
)
if
has_wiki
if
has_wiki
result
&&=
move_repository
(
"
#{
@old_disk_path
}
.wiki"
,
"
#{
@new_disk_path
}
.wiki"
)
@old_wiki_disk_path
=
"
#{
@old_disk_path
}
.wiki"
result
&&=
move_repository
(
@old_wiki_disk_path
,
"
#{
@new_disk_path
}
.wiki"
)
end
end
unless
result
unless
result
...
...
ee/app/services/ee/projects/hashed_storage_migration_service.rb
View file @
3236bff8
...
@@ -5,10 +5,11 @@ module EE
...
@@ -5,10 +5,11 @@ module EE
raise
NotImplementedError
.
new
unless
defined?
(
super
)
raise
NotImplementedError
.
new
unless
defined?
(
super
)
super
do
super
do
::
Geo
::
RepositoryRenam
edEventStore
.
new
(
::
Geo
::
HashedStorageMigrat
edEventStore
.
new
(
project
,
project
,
old_path:
File
.
basename
(
old_disk_path
),
old_storage_version:
old_storage_version
,
old_path_with_namespace:
old_disk_path
old_disk_path:
old_disk_path
,
old_wiki_disk_path:
old_wiki_disk_path
).
create
).
create
end
end
end
end
...
...
spec/ee/spec/services/ee/projects/hashed_storage_migration_service_spec.rb
View file @
3236bff8
...
@@ -10,19 +10,19 @@ describe Projects::HashedStorageMigrationService do
...
@@ -10,19 +10,19 @@ describe Projects::HashedStorageMigrationService do
set
(
:primary
)
{
create
(
:geo_node
,
:primary
)
}
set
(
:primary
)
{
create
(
:geo_node
,
:primary
)
}
set
(
:secondary
)
{
create
(
:geo_node
)
}
set
(
:secondary
)
{
create
(
:geo_node
)
}
it
'creates a Geo::
RepositoryRenam
edEvent on success'
do
it
'creates a Geo::
HashedStorageMigrat
edEvent on success'
do
expect
{
service
.
execute
}.
to
change
{
Geo
::
EventLog
.
count
}
.
by
(
1
)
expect
{
service
.
execute
}.
to
change
(
Geo
::
EventLog
,
:count
)
.
by
(
1
)
event
=
Geo
::
EventLog
.
first
.
event
event
=
Geo
::
EventLog
.
first
.
event
expect
(
event
).
to
be_a
(
Geo
::
RepositoryRenam
edEvent
)
expect
(
event
).
to
be_a
(
Geo
::
HashedStorageMigrat
edEvent
)
expect
(
event
).
to
have_attributes
(
expect
(
event
).
to
have_attributes
(
old_
path:
project
.
path
,
old_
storage_version:
nil
,
new_
path:
project
.
path
,
new_
storage_version:
Storage
::
HashedProject
::
STORAGE_VERSION
,
old_
path_with_namespace
:
legacy_storage
.
disk_path
,
old_
disk_path
:
legacy_storage
.
disk_path
,
new_
path_with_namespace
:
hashed_storage
.
disk_path
,
new_
disk_path
:
hashed_storage
.
disk_path
,
old_wiki_
path_with_namespace
:
legacy_storage
.
disk_path
+
'.wiki'
,
old_wiki_
disk_path
:
legacy_storage
.
disk_path
+
'.wiki'
,
new_wiki_
path_with_namespace
:
hashed_storage
.
disk_path
+
'.wiki'
new_wiki_
disk_path
:
hashed_storage
.
disk_path
+
'.wiki'
)
)
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