summaryrefslogtreecommitdiff
path: root/lib/gitlab/hashed_storage
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2019-01-17 02:53:50 +0100
committerGabriel Mazetto <brodock@gmail.com>2019-01-25 20:26:35 +0100
commit7bc16889df458865ffbbb7bef8087c04a5768a1d (patch)
tree23842ae1d6de742eb8064f196e39dd90c179bd7c /lib/gitlab/hashed_storage
parentb88f27c8d1cb44201490bf51db143f4267735775 (diff)
downloadgitlab-ce-7bc16889df458865ffbbb7bef8087c04a5768a1d.tar.gz
Refactor Storage Migration
Specs were reviewed and improved to better cover the current behavior. There was some standardization done as well to facilitate the implementation of the rollback functionality. StorageMigratorWorker was extracted to HashedStorage namespace were RollbackerWorker will live one as well.
Diffstat (limited to 'lib/gitlab/hashed_storage')
-rw-r--r--lib/gitlab/hashed_storage/migrator.rb19
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/gitlab/hashed_storage/migrator.rb b/lib/gitlab/hashed_storage/migrator.rb
index 4794b1978db..bf463077dcc 100644
--- a/lib/gitlab/hashed_storage/migrator.rb
+++ b/lib/gitlab/hashed_storage/migrator.rb
@@ -13,35 +13,28 @@ module Gitlab
#
# @param [Integer] start first project id for the range
# @param [Integer] finish last project id for the range
- # @param [Symbol] operation [:migrate, :rollback]
- def bulk_schedule(start:, finish:, operation: :migrate)
- StorageMigratorWorker.perform_async(start, finish, operation)
+ def bulk_schedule(start:, finish:)
+ ::HashedStorage::MigratorWorker.perform_async(start, finish)
end
# Start migration of projects from specified range
#
- # Flagging a project to be migrated is a synchronous action,
+ # Flagging a project to be migrated is a synchronous action
# but the migration runs through async jobs
#
# @param [Integer] start first project id for the range
# @param [Integer] finish last project id for the range
- # @param [Symbol] operation [:migrate, :rollback]
# rubocop: disable CodeReuse/ActiveRecord
- def bulk_migrate(start:, finish:, operation: :migrate)
+ def bulk_migrate(start:, finish:)
projects = build_relation(start, finish)
projects.with_route.find_each(batch_size: BATCH_SIZE) do |project|
- case operation
- when :migrate
- migrate(project)
- when :rollback
- rollback(project)
- end
+ migrate(project)
end
end
# rubocop: enable CodeReuse/ActiveRecord
- # Flag a project to be migrated
+ # Flag a project to be migrated to Hashed Storage
#
# @param [Project] project that will be migrated
def migrate(project)