diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-06-17 21:41:08 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-06-17 21:41:08 +0000 |
commit | 30bddd546f117043f2b7389ad06ba5257184c148 (patch) | |
tree | b28fb216755e83fb2d13a5d285904dba8fe83c90 | |
parent | 92f10517ac421d230915b98e4aade45aca54ba1d (diff) | |
parent | 39229eed34eb0ec27a09aeb174668919239d8a8c (diff) | |
download | gitlab-ce-30bddd546f117043f2b7389ad06ba5257184c148.tar.gz |
Merge branch 'hashed-storage-enabled-default' into 'master'
Hashed Storage is enabled by default on new installations
See merge request gitlab-org/gitlab-ce!29586
-rw-r--r-- | changelogs/unreleased/hashed-storage-enabled-default.yml | 5 | ||||
-rw-r--r-- | db/migrate/20190613030606_enable_hashed_storage_by_default.rb | 15 | ||||
-rw-r--r-- | db/schema.rb | 4 | ||||
-rw-r--r-- | doc/administration/repository_storage_types.md | 14 | ||||
-rw-r--r-- | spec/finders/fork_projects_finder_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 13 | ||||
-rw-r--r-- | spec/services/projects/after_rename_service_spec.rb | 1 | ||||
-rw-r--r-- | spec/services/projects/create_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/projects/fork_service_spec.rb | 3 |
9 files changed, 33 insertions, 26 deletions
diff --git a/changelogs/unreleased/hashed-storage-enabled-default.yml b/changelogs/unreleased/hashed-storage-enabled-default.yml new file mode 100644 index 00000000000..9a34505785c --- /dev/null +++ b/changelogs/unreleased/hashed-storage-enabled-default.yml @@ -0,0 +1,5 @@ +--- +title: Hashed Storage is enabled by default on new installations +merge_request: 29586 +author: +type: changed diff --git a/db/migrate/20190613030606_enable_hashed_storage_by_default.rb b/db/migrate/20190613030606_enable_hashed_storage_by_default.rb new file mode 100644 index 00000000000..8edefd1273e --- /dev/null +++ b/db/migrate/20190613030606_enable_hashed_storage_by_default.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class EnableHashedStorageByDefault < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + change_column_default :application_settings, :hashed_storage_enabled, true + end + + def down + change_column_default :application_settings, :hashed_storage_enabled, false + end +end diff --git a/db/schema.rb b/db/schema.rb index a50ab02f718..c6186c52699 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20190611161641) do +ActiveRecord::Schema.define(version: 20190613030606) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -141,7 +141,7 @@ ActiveRecord::Schema.define(version: 20190611161641) do t.boolean "help_page_hide_commercial_content", default: false t.string "help_page_support_url" t.integer "performance_bar_allowed_group_id" - t.boolean "hashed_storage_enabled", default: false, null: false + t.boolean "hashed_storage_enabled", default: true, null: false t.boolean "project_export_enabled", default: true, null: false t.boolean "auto_devops_enabled", default: true, null: false t.boolean "throttle_unauthenticated_enabled", default: false, null: false diff --git a/doc/administration/repository_storage_types.md b/doc/administration/repository_storage_types.md index 38842693d73..834b41b3a2c 100644 --- a/doc/administration/repository_storage_types.md +++ b/doc/administration/repository_storage_types.md @@ -47,18 +47,12 @@ Any change in the URL will need to be reflected on disk (when groups / users or projects are renamed). This can add a lot of load in big installations, especially if using any type of network based filesystem. -CAUTION: **Caution:** -For Geo in particular: Geo does work with legacy storage, but in some -edge cases due to race conditions it can lead to errors when a project is -renamed multiple times in short succession, or a project is deleted and -recreated under the same name very quickly. We expect these race events to be -rare, and we have not observed a race condition side-effect happening yet. -This pattern also exists in other objects stored in GitLab, like issue -Attachments, GitLab Pages artifacts, Docker Containers for the integrated -Registry, etc. Hashed storage is a requirement for Geo. - ## Hashed Storage +CAUTION: **Important:** +Geo requires Hashed Storage since 12.0. If you haven't migrated yet, +check the [migration instructions](#how-to-migrate-to-hashed-storage) ASAP. + Hashed Storage is the new storage behavior we rolled out with 10.0. Instead of coupling project URL and the folder structure where the repository will be stored on disk, we are coupling a hash, based on the project's ID. This makes diff --git a/spec/finders/fork_projects_finder_spec.rb b/spec/finders/fork_projects_finder_spec.rb index b3fdffc3331..98cff37205e 100644 --- a/spec/finders/fork_projects_finder_spec.rb +++ b/spec/finders/fork_projects_finder_spec.rb @@ -12,6 +12,8 @@ describe ForkProjectsFinder do let(:private_fork_member) { create(:user) } before do + stub_feature_flags(object_pools: { enabled: false, thing: source_project }) + private_fork.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE) private_fork.add_developer(private_fork_member) diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index e6d5e8fc320..269d2bb90d3 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -3478,6 +3478,7 @@ describe Project do before do allow(project).to receive(:gitlab_shell).and_return(gitlab_shell) + stub_application_setting(hashed_storage_enabled: false) end describe '#base_dir' do @@ -3584,10 +3585,6 @@ describe Project do let(:hashed_prefix) { File.join('@hashed', hash[0..1], hash[2..3]) } let(:hashed_path) { File.join(hashed_prefix, hash) } - before do - stub_application_setting(hashed_storage_enabled: true) - end - describe '#legacy_storage?' do it 'returns false' do expect(project.legacy_storage?).to be_falsey @@ -4729,10 +4726,6 @@ describe Project do subject { project.object_pool_params } - before do - stub_application_setting(hashed_storage_enabled: true) - end - context 'when the objects cannot be pooled' do let(:project) { create(:project, :repository, :private) } @@ -4778,10 +4771,6 @@ describe Project do context 'when objects are poolable' do let(:project) { create(:project, :repository, :public) } - before do - stub_application_setting(hashed_storage_enabled: true) - end - it { is_expected.to be_git_objects_poolable } end end diff --git a/spec/services/projects/after_rename_service_spec.rb b/spec/services/projects/after_rename_service_spec.rb index b8055a285f2..8585d495ffb 100644 --- a/spec/services/projects/after_rename_service_spec.rb +++ b/spec/services/projects/after_rename_service_spec.rb @@ -23,6 +23,7 @@ describe Projects::AfterRenameService do allow(project).to receive(:gitlab_shell).and_return(gitlab_shell) stub_feature_flags(skip_hashed_storage_upgrade: false) + stub_application_setting(hashed_storage_enabled: false) end it 'renames a repository' do diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index a4c48991807..b0b74407812 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -228,6 +228,7 @@ describe Projects::CreateService, '#execute' do context 'with legacy storage' do before do + stub_application_setting(hashed_storage_enabled: false) gitlab_shell.create_repository(repository_storage, "#{user.namespace.full_path}/existing", 'group/project') end @@ -259,7 +260,6 @@ describe Projects::CreateService, '#execute' do let(:hashed_path) { '@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b' } before do - stub_application_setting(hashed_storage_enabled: true) allow(Digest::SHA2).to receive(:hexdigest) { hash } end diff --git a/spec/services/projects/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb index 6afc91d5e95..0c109e26a6a 100644 --- a/spec/services/projects/fork_service_spec.rb +++ b/spec/services/projects/fork_service_spec.rb @@ -116,11 +116,12 @@ describe Projects::ForkService do end end - context 'repository already exists' do + context 'repository in legacy storage already exists' do let(:repository_storage) { 'default' } let(:repository_storage_path) { Gitlab.config.repositories.storages[repository_storage].legacy_disk_path } before do + stub_application_setting(hashed_storage_enabled: false) gitlab_shell.create_repository(repository_storage, "#{@to_user.namespace.full_path}/#{@from_project.path}", "#{@to_user.namespace.full_path}/#{@from_project.path}") end |