summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2019-01-17 02:57:35 +0100
committerGabriel Mazetto <brodock@gmail.com>2019-03-01 15:49:20 +0100
commit1592b5830f7b2847dff02ef2c66b745cdc60565a (patch)
tree27066c127717d21ed67f8081c3a6f3ef0332d178 /lib
parentff2ca3569e704bb26c770ba5c28a888789d27230 (diff)
downloadgitlab-ce-1592b5830f7b2847dff02ef2c66b745cdc60565a.tar.gz
Adds Rollback functionality to HashedStorage migration
We are adding sidekiq workers and service classes to allow to rollback a hashed storage migration. There are some refactoring involved as well as part of the code can be reused by both the migration and the rollback logic.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/hashed_storage/migrator.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/gitlab/hashed_storage/migrator.rb b/lib/gitlab/hashed_storage/migrator.rb
index bf463077dcc..73ed57ea584 100644
--- a/lib/gitlab/hashed_storage/migrator.rb
+++ b/lib/gitlab/hashed_storage/migrator.rb
@@ -45,8 +45,15 @@ module Gitlab
Rails.logger.error("#{err.message} migrating storage of #{project.full_path} (ID=#{project.id}), trace - #{err.backtrace}")
end
+ # Flag a project to be rolled-back to Legacy Storage
+ #
+ # @param [Project] project that will be rolled-back
def rollback(project)
- # TODO: implement rollback strategy
+ Rails.logger.info "Starting storage rollback of #{project.full_path} (ID=#{project.id})..."
+
+ project.rollback_to_legacy_storage!
+ rescue => err
+ Rails.logger.error("#{err.message} rolling-back storage of #{project.full_path} (ID=#{project.id}), trace - #{err.backtrace}")
end
private