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
ff2ca356
Commit
ff2ca356
authored
Dec 22, 2018
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rake task for storage rollback
parent
4471ab81
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
lib/tasks/gitlab/storage.rake
lib/tasks/gitlab/storage.rake
+45
-0
No files found.
lib/tasks/gitlab/storage.rake
View file @
ff2ca356
...
...
@@ -45,6 +45,51 @@ namespace :gitlab do
puts
' Done!'
end
desc
'GitLab | Storage | Rollback existing projects to Legacy Storage'
task
rollback_to_legacy: :environment
do
if
Gitlab
::
Database
.
read_only?
warn
'This task requires database write access. Exiting.'
next
end
storage_migrator
=
Gitlab
::
HashedStorage
::
Migrator
.
new
helper
=
Gitlab
::
HashedStorage
::
RakeHelper
if
helper
.
range_single_item?
project
=
Project
.
with_storage_feature
(
:repository
).
find_by
(
id:
helper
.
range_from
)
unless
project
warn
"There are no projects that can be rolledback with ID=
#{
helper
.
range_from
}
"
next
end
puts
"Enqueueing storage rollback of
#{
project
.
full_path
}
(ID=
#{
project
.
id
}
)..."
storage_migrator
.
rollback
(
project
)
next
end
hashed_projects_count
=
Project
.
with_storage_feature
(
:repository
).
count
if
hashed_projects_count
==
0
warn
'There are no projects that can have storage rolledback. Nothing to do!'
next
end
print
"Enqueuing rollback of
#{
hashed_projects_count
}
projects in batches of
#{
helper
.
batch_size
}
"
helper
.
project_id_batches
do
|
start
,
finish
|
storage_migrator
.
bulk_schedule
(
start:
start
,
finish:
finish
,
operation: :rollback
)
print
'.'
end
puts
' Done!'
end
desc
'Gitlab | Storage | Summary of existing projects using Legacy Storage'
task
legacy_projects: :environment
do
helper
=
Gitlab
::
HashedStorage
::
RakeHelper
...
...
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