summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2018-08-18 06:34:05 +0200
committerGabriel Mazetto <brodock@gmail.com>2018-08-22 05:41:15 +0200
commita440c2be018e79ee671543c2c96cc1f741336fde (patch)
treea3a0597a75d53eb3b57276ae93c8e40c2209d71b /app/models
parentfe77eb4df112409ef1f951afebef1d45927cd8e4 (diff)
downloadgitlab-ce-a440c2be018e79ee671543c2c96cc1f741336fde.tar.gz
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.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project.rb8
1 files changed, 7 insertions, 1 deletions
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)