summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2018-11-15 06:53:47 +0100
committerGabriel Mazetto <brodock@gmail.com>2018-11-15 15:33:25 +0100
commitf208f4c236b4ea464842407a23d428d84e07038a (patch)
tree85a53669ab3e9c09f993d3c5fc659ad69f43314a
parentbf31bd0d82affc29963d7d15c850ae0a0cc362a3 (diff)
downloadgitlab-ce-53700-hashed-storagemigration.tar.gz
Allow partially migrated repositories to continue migration53700-hashed-storagemigration
Previously we verified if the projecthave at least migrated their repository to hashed storage and prevented the migration command to start a new migration. The new version checks for the latest storage version available (fully migrated), otherwise it allows migration to be triggered again.
-rw-r--r--app/models/project.rb2
-rw-r--r--changelogs/unreleased/53700-hashed-storagemigration.yml5
-rw-r--r--spec/models/project_spec.rb8
3 files changed, 14 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index d87fc1e4b86..7bd44f6a37c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1968,7 +1968,7 @@ class Project < ActiveRecord::Base
end
def migrate_to_hashed_storage!
- return if hashed_storage?(:repository)
+ return unless storage_upgradable?
update!(repository_read_only: true)
diff --git a/changelogs/unreleased/53700-hashed-storagemigration.yml b/changelogs/unreleased/53700-hashed-storagemigration.yml
new file mode 100644
index 00000000000..899012ffd22
--- /dev/null
+++ b/changelogs/unreleased/53700-hashed-storagemigration.yml
@@ -0,0 +1,5 @@
+---
+title: 'Hashed Storage: allow migration to be retried in partially migrated projects'
+merge_request: 23087
+author:
+type: fixed
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index bdff68cee8b..51278836604 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -3087,6 +3087,14 @@ describe Project do
it 'does not flag as read-only' do
expect { project.migrate_to_hashed_storage! }.not_to change { project.repository_read_only }
end
+
+ context 'when partially migrated' do
+ it 'returns true' do
+ project = create(:project, storage_version: 1, skip_disk_validation: true)
+
+ expect(project.migrate_to_hashed_storage!).to be_truthy
+ end
+ end
end
end