From a440c2be018e79ee671543c2c96cc1f741336fde Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Sat, 18 Aug 2018 06:34:05 +0200 Subject: Add FeatureFlag to disable hashed storage migration when renaming We usually want a feature flag to be disabled by default and hide the feature until it's enabled. This is an unconventional use: when the flag is enabled, it will "DISABLE" the behavior. --- app/models/project.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/models/project.rb') diff --git a/app/models/project.rb b/app/models/project.rb index 8f631d7f0ed..40dad8cfb36 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -2072,13 +2072,19 @@ class Project < ActiveRecord::Base private def rename_or_migrate_repository! - if Gitlab::CurrentSettings.hashed_storage_enabled? && storage_version != LATEST_STORAGE_VERSION + if Gitlab::CurrentSettings.hashed_storage_enabled? && + storage_upgradable? && + Feature.disabled?(:disable_hashed_storage_upgrade) # kill switch in case we need to disable upgrade behavior ::Projects::HashedStorageMigrationService.new(self, full_path_was).execute else storage.rename_repo end end + def storage_upgradable? + storage_version != LATEST_STORAGE_VERSION + end + def after_rename_repository(full_path_before, path_before) execute_rename_repository_hooks!(full_path_before) -- cgit v1.2.1