Commit 1e3eb8aa authored by Sean McGivern's avatar Sean McGivern

Merge branch 'bvl-remove-async-pages-ff' into 'master'

Remove the async pages feature flags

Closes #239318, #235808, #235802, and #235757

See merge request gitlab-org/gitlab!40980
parents a0f63899 66348c23
...@@ -24,28 +24,20 @@ module Storage ...@@ -24,28 +24,20 @@ module Storage
parent_full_path = parent&.full_path parent_full_path = parent&.full_path
Gitlab::UploadsTransfer.new.move_namespace(path, former_parent_full_path, parent_full_path) Gitlab::UploadsTransfer.new.move_namespace(path, former_parent_full_path, parent_full_path)
if ::Feature.enabled?(:async_pages_move_namespace_transfer, self) if any_project_with_pages_deployed?
if any_project_with_pages_deployed? run_after_commit do
run_after_commit do Gitlab::PagesTransfer.new.async.move_namespace(path, former_parent_full_path, parent_full_path)
Gitlab::PagesTransfer.new.async.move_namespace(path, former_parent_full_path, parent_full_path)
end
end end
else
Gitlab::PagesTransfer.new.move_namespace(path, former_parent_full_path, parent_full_path)
end end
else else
Gitlab::UploadsTransfer.new.rename_namespace(full_path_before_last_save, full_path) Gitlab::UploadsTransfer.new.rename_namespace(full_path_before_last_save, full_path)
if ::Feature.enabled?(:async_pages_move_namespace_rename, self) if any_project_with_pages_deployed?
if any_project_with_pages_deployed? full_path_was = full_path_before_last_save
full_path_was = full_path_before_last_save
run_after_commit do run_after_commit do
Gitlab::PagesTransfer.new.async.rename_namespace(full_path_was, full_path) Gitlab::PagesTransfer.new.async.rename_namespace(full_path_was, full_path)
end
end end
else
Gitlab::PagesTransfer.new.rename_namespace(full_path_before_last_save, full_path)
end end
end end
......
...@@ -3,11 +3,7 @@ ...@@ -3,11 +3,7 @@
module Pages module Pages
class DeleteService < BaseService class DeleteService < BaseService
def execute def execute
if Feature.enabled?(:async_pages_removal, project) PagesRemoveWorker.perform_async(project.id)
PagesRemoveWorker.perform_async(project.id)
else
PagesRemoveWorker.new.perform(project.id)
end
end end
end end
end end
...@@ -96,24 +96,18 @@ module Projects ...@@ -96,24 +96,18 @@ module Projects
.rename_project(path_before, project_path, namespace_full_path) .rename_project(path_before, project_path, namespace_full_path)
end end
if ::Feature.enabled?(:async_pages_move_project_rename, project) if project.pages_deployed?
if project.pages_deployed? # Block will be evaluated in the context of project so we need
# Block will be evaluated in the context of project so we need # to bind to a local variable to capture it, as the instance
# to bind to a local variable to capture it, as the instance # variable and method aren't available on Project
# variable and method aren't available on Project path_before_local = @path_before
path_before_local = @path_before
project.run_after_commit_or_now do
project.run_after_commit_or_now do Gitlab::PagesTransfer
Gitlab::PagesTransfer .new
.new .async
.async .rename_project(path_before_local, path, namespace.full_path)
.rename_project(path_before_local, path, namespace.full_path)
end
end end
else
Gitlab::PagesTransfer
.new
.rename_project(path_before, project_path, namespace_full_path)
end end
end end
......
...@@ -181,15 +181,9 @@ module Projects ...@@ -181,15 +181,9 @@ module Projects
end end
def move_pages(project) def move_pages(project)
transfer = Gitlab::PagesTransfer.new return unless project.pages_deployed?
if Feature.enabled?(:async_pages_move_project_transfer, project)
# Avoid scheduling moves for directories that don't exist.
return unless project.pages_deployed?
transfer = transfer.async
end
transfer = Gitlab::PagesTransfer.new.async
transfer.move_project(project.path, @old_namespace.full_path, @new_namespace.full_path) transfer.move_project(project.path, @old_namespace.full_path, @new_namespace.full_path)
end end
......
---
title: Remove the async pages feature flags
merge_request: 40980
author:
type: performance
---
name: async_pages_move_namespace_rename
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40259
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/235808
group: team::Scalability
type: development
default_enabled: false
---
name: async_pages_move_namespace_transfer
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40259
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/235808
group: team::Scalability
type: development
default_enabled: false
---
name: async_pages_move_project_rename
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40087
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/235802
group: team::Scalability
type: development
default_enabled: false
---
name: async_pages_move_project_transfer
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40492
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/235757
group: team::Scalability
type: development
default_enabled: false
---
name: async_pages_removal
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38313
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/239318
group: team::Scalability
type: development
default_enabled: false
\ No newline at end of file
...@@ -416,16 +416,6 @@ RSpec.describe Namespace do ...@@ -416,16 +416,6 @@ RSpec.describe Namespace do
end end
context 'renaming child' do context 'renaming child' do
context 'when async_pages_move_namespace_rename is disabled' do
it 'correctly moves the repository, uploads and pages' do
stub_feature_flags(async_pages_move_namespace_rename: false)
child.update!(path: 'renamed')
expect_project_directories_at('parent/renamed')
end
end
context 'when no projects have pages deployed' do context 'when no projects have pages deployed' do
it 'moves the repository and uploads', :sidekiq_inline do it 'moves the repository and uploads', :sidekiq_inline do
project.pages_metadatum.update!(deployed: false) project.pages_metadatum.update!(deployed: false)
...@@ -436,26 +426,25 @@ RSpec.describe Namespace do ...@@ -436,26 +426,25 @@ RSpec.describe Namespace do
end end
context 'when the project has pages deployed' do context 'when the project has pages deployed' do
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do before do
project.pages_metadatum.update!(deployed: true) project.pages_metadatum.update!(deployed: true)
end
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do
child.update!(path: 'renamed') child.update!(path: 'renamed')
expect_project_directories_at('parent/renamed') expect_project_directories_at('parent/renamed')
end end
end
end
context 'renaming parent' do it 'performs the move async of pages async' do
context 'when async_pages_move_namespace_rename is disabled' do expect(PagesTransferWorker).to receive(:perform_async).with('rename_namespace', ['parent/child', 'parent/renamed'])
it 'correctly moves the repository, uploads and pages' do
stub_feature_flags(async_pages_move_namespace_rename: false)
parent.update!(path: 'renamed')
expect_project_directories_at('renamed/child') child.update!(path: 'renamed')
end end
end end
end
context 'renaming parent' do
context 'when no projects have pages deployed' do context 'when no projects have pages deployed' do
it 'moves the repository and uploads', :sidekiq_inline do it 'moves the repository and uploads', :sidekiq_inline do
project.pages_metadatum.update!(deployed: false) project.pages_metadatum.update!(deployed: false)
...@@ -466,26 +455,25 @@ RSpec.describe Namespace do ...@@ -466,26 +455,25 @@ RSpec.describe Namespace do
end end
context 'when the project has pages deployed' do context 'when the project has pages deployed' do
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do before do
project.pages_metadatum.update!(deployed: true) project.pages_metadatum.update!(deployed: true)
end
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do
parent.update!(path: 'renamed') parent.update!(path: 'renamed')
expect_project_directories_at('renamed/child') expect_project_directories_at('renamed/child')
end end
end
end
context 'moving from one parent to another' do it 'performs the move async of pages async' do
context 'when async_pages_move_namespace_transfer is disabled' do expect(PagesTransferWorker).to receive(:perform_async).with('rename_namespace', %w(parent renamed))
it 'correctly moves the repository, uploads and pages' do
stub_feature_flags(async_pages_move_namespace_transfer: false)
child.update!(parent: new_parent)
expect_project_directories_at('new_parent/child') parent.update!(path: 'renamed')
end end
end end
end
context 'moving from one parent to another' do
context 'when no projects have pages deployed' do context 'when no projects have pages deployed' do
it 'moves the repository and uploads', :sidekiq_inline do it 'moves the repository and uploads', :sidekiq_inline do
project.pages_metadatum.update!(deployed: false) project.pages_metadatum.update!(deployed: false)
...@@ -496,26 +484,25 @@ RSpec.describe Namespace do ...@@ -496,26 +484,25 @@ RSpec.describe Namespace do
end end
context 'when the project has pages deployed' do context 'when the project has pages deployed' do
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do before do
project.pages_metadatum.update!(deployed: true) project.pages_metadatum.update!(deployed: true)
end
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do
child.update!(parent: new_parent) child.update!(parent: new_parent)
expect_project_directories_at('new_parent/child') expect_project_directories_at('new_parent/child')
end end
end
end
context 'moving from having a parent to root' do it 'performs the move async of pages async' do
context 'when async_pages_move_namespace_transfer is disabled' do expect(PagesTransferWorker).to receive(:perform_async).with('move_namespace', %w(child parent new_parent))
it 'correctly moves the repository, uploads and pages' do
stub_feature_flags(async_pages_move_namespace_transfer: false)
child.update!(parent: nil)
expect_project_directories_at('child') child.update!(parent: new_parent)
end end
end end
end
context 'moving from having a parent to root' do
context 'when no projects have pages deployed' do context 'when no projects have pages deployed' do
it 'moves the repository and uploads', :sidekiq_inline do it 'moves the repository and uploads', :sidekiq_inline do
project.pages_metadatum.update!(deployed: false) project.pages_metadatum.update!(deployed: false)
...@@ -526,26 +513,25 @@ RSpec.describe Namespace do ...@@ -526,26 +513,25 @@ RSpec.describe Namespace do
end end
context 'when the project has pages deployed' do context 'when the project has pages deployed' do
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do before do
project.pages_metadatum.update!(deployed: true) project.pages_metadatum.update!(deployed: true)
end
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do
child.update!(parent: nil) child.update!(parent: nil)
expect_project_directories_at('child') expect_project_directories_at('child')
end end
end
end
context 'moving from root to having a parent' do
context 'when async_pages_move_namespace_transfer is disabled' do
it 'correctly moves the repository, uploads and pages' do
stub_feature_flags(async_pages_move_namespace_transfer: false)
parent.update!(parent: new_parent) it 'performs the move async of pages async' do
expect(PagesTransferWorker).to receive(:perform_async).with('move_namespace', ['child', 'parent', nil])
expect_project_directories_at('new_parent/parent/child') child.update!(parent: nil)
end end
end end
end
context 'moving from root to having a parent' do
context 'when no projects have pages deployed' do context 'when no projects have pages deployed' do
it 'moves the repository and uploads', :sidekiq_inline do it 'moves the repository and uploads', :sidekiq_inline do
project.pages_metadatum.update!(deployed: false) project.pages_metadatum.update!(deployed: false)
...@@ -556,12 +542,21 @@ RSpec.describe Namespace do ...@@ -556,12 +542,21 @@ RSpec.describe Namespace do
end end
context 'when the project has pages deployed' do context 'when the project has pages deployed' do
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do before do
project.pages_metadatum.update!(deployed: true) project.pages_metadatum.update!(deployed: true)
end
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do
parent.update!(parent: new_parent) parent.update!(parent: new_parent)
expect_project_directories_at('new_parent/parent/child') expect_project_directories_at('new_parent/parent/child')
end end
it 'performs the move async of pages async' do
expect(PagesTransferWorker).to receive(:perform_async).with('move_namespace', ['parent', nil, 'new_parent'])
parent.update!(parent: new_parent)
end
end end
end end
end end
......
...@@ -27,16 +27,6 @@ RSpec.describe Pages::DeleteService do ...@@ -27,16 +27,6 @@ RSpec.describe Pages::DeleteService do
end end
end end
context 'with feature flag disabled' do
before do
stub_feature_flags(async_pages_removal: false)
expect(PagesRemoveWorker).not_to receive(:perform_async)
end
it_behaves_like 'remove pages'
end
context 'with feature flag enabled' do context 'with feature flag enabled' do
before do before do
expect(PagesRemoveWorker).to receive(:perform_async).and_call_original expect(PagesRemoveWorker).to receive(:perform_async).and_call_original
......
...@@ -64,16 +64,6 @@ RSpec.describe Projects::AfterRenameService do ...@@ -64,16 +64,6 @@ RSpec.describe Projects::AfterRenameService do
allow(project_storage).to receive(:rename_repo) { true } allow(project_storage).to receive(:rename_repo) { true }
end end
context 'when async_pages_move_project_rename is disabled' do
it 'moves pages folder to new location' do
stub_feature_flags(async_pages_move_project_rename: false)
expect_any_instance_of(Gitlab::PagesTransfer).to receive(:rename_project)
service_execute
end
end
context 'when the project has pages deployed' do context 'when the project has pages deployed' do
it 'schedules a move of the pages directory' do it 'schedules a move of the pages directory' do
allow(project).to receive(:pages_deployed?).and_return(true) allow(project).to receive(:pages_deployed?).and_return(true)
...@@ -183,16 +173,6 @@ RSpec.describe Projects::AfterRenameService do ...@@ -183,16 +173,6 @@ RSpec.describe Projects::AfterRenameService do
end end
context 'gitlab pages' do context 'gitlab pages' do
context 'when async_pages_move_project_rename is disabled' do
it 'moves pages folder to new location' do
stub_feature_flags(async_pages_move_project_rename: false)
expect_any_instance_of(Gitlab::PagesTransfer).to receive(:rename_project)
service_execute
end
end
context 'when the project has pages deployed' do context 'when the project has pages deployed' do
it 'schedules a move of the pages directory' do it 'schedules a move of the pages directory' do
allow(project).to receive(:pages_deployed?).and_return(true) allow(project).to receive(:pages_deployed?).and_return(true)
......
...@@ -510,20 +510,6 @@ RSpec.describe Projects::TransferService do ...@@ -510,20 +510,6 @@ RSpec.describe Projects::TransferService do
execute_transfer execute_transfer
end end
context 'when async_pages_move_project_transfer is disabled' do
before do
stub_feature_flags(async_pages_move_project_transfer: false)
end
it 'moves pages inline' do
expect_next_instance_of(Gitlab::PagesTransfer) do |transfer|
expect(transfer).to receive(:move_project).with(project.path, user.namespace.full_path, group.full_path)
end
execute_transfer
end
end
end end
def rugged_config def rugged_config
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment