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,19 +24,14 @@ module Storage
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?
run_after_commit do
Gitlab::PagesTransfer.new.async.move_namespace(path, former_parent_full_path, parent_full_path)
end
end
else
Gitlab::PagesTransfer.new.move_namespace(path, former_parent_full_path, parent_full_path)
end
else
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?
full_path_was = full_path_before_last_save
......@@ -44,9 +39,6 @@ module Storage
Gitlab::PagesTransfer.new.async.rename_namespace(full_path_was, full_path)
end
end
else
Gitlab::PagesTransfer.new.rename_namespace(full_path_before_last_save, full_path)
end
end
# If repositories moved successfully we need to
......
......@@ -3,11 +3,7 @@
module Pages
class DeleteService < BaseService
def execute
if Feature.enabled?(:async_pages_removal, project)
PagesRemoveWorker.perform_async(project.id)
else
PagesRemoveWorker.new.perform(project.id)
end
end
end
end
......@@ -96,7 +96,6 @@ module Projects
.rename_project(path_before, project_path, namespace_full_path)
end
if ::Feature.enabled?(:async_pages_move_project_rename, project)
if project.pages_deployed?
# Block will be evaluated in the context of project so we need
# to bind to a local variable to capture it, as the instance
......@@ -110,11 +109,6 @@ module Projects
.rename_project(path_before_local, path, namespace.full_path)
end
end
else
Gitlab::PagesTransfer
.new
.rename_project(path_before, project_path, namespace_full_path)
end
end
def log_completion
......
......@@ -181,15 +181,9 @@ module Projects
end
def move_pages(project)
transfer = Gitlab::PagesTransfer.new
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)
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
end
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
it 'moves the repository and uploads', :sidekiq_inline do
project.pages_metadatum.update!(deployed: false)
......@@ -436,26 +426,25 @@ RSpec.describe Namespace do
end
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)
end
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do
child.update!(path: 'renamed')
expect_project_directories_at('parent/renamed')
end
end
end
context 'renaming parent' 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)
parent.update!(path: 'renamed')
it 'performs the move async of pages async' do
expect(PagesTransferWorker).to receive(:perform_async).with('rename_namespace', ['parent/child', 'parent/renamed'])
expect_project_directories_at('renamed/child')
child.update!(path: 'renamed')
end
end
end
context 'renaming parent' do
context 'when no projects have pages deployed' do
it 'moves the repository and uploads', :sidekiq_inline do
project.pages_metadatum.update!(deployed: false)
......@@ -466,26 +455,25 @@ RSpec.describe Namespace do
end
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)
end
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do
parent.update!(path: 'renamed')
expect_project_directories_at('renamed/child')
end
end
end
context 'moving from one parent to another' 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)
it 'performs the move async of pages async' do
expect(PagesTransferWorker).to receive(:perform_async).with('rename_namespace', %w(parent renamed))
child.update!(parent: new_parent)
expect_project_directories_at('new_parent/child')
parent.update!(path: 'renamed')
end
end
end
context 'moving from one parent to another' do
context 'when no projects have pages deployed' do
it 'moves the repository and uploads', :sidekiq_inline do
project.pages_metadatum.update!(deployed: false)
......@@ -496,26 +484,25 @@ RSpec.describe Namespace do
end
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)
end
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do
child.update!(parent: new_parent)
expect_project_directories_at('new_parent/child')
end
end
end
context 'moving from having a parent to root' 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)
child.update!(parent: nil)
it 'performs the move async of pages async' do
expect(PagesTransferWorker).to receive(:perform_async).with('move_namespace', %w(child parent new_parent))
expect_project_directories_at('child')
child.update!(parent: new_parent)
end
end
end
context 'moving from having a parent to root' do
context 'when no projects have pages deployed' do
it 'moves the repository and uploads', :sidekiq_inline do
project.pages_metadatum.update!(deployed: false)
......@@ -526,26 +513,25 @@ RSpec.describe Namespace do
end
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)
end
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do
child.update!(parent: nil)
expect_project_directories_at('child')
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
context 'moving from root to having a parent' do
context 'when no projects have pages deployed' do
it 'moves the repository and uploads', :sidekiq_inline do
project.pages_metadatum.update!(deployed: false)
......@@ -556,12 +542,21 @@ RSpec.describe Namespace do
end
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)
end
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do
parent.update!(parent: new_parent)
expect_project_directories_at('new_parent/parent/child')
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
......
......@@ -27,16 +27,6 @@ RSpec.describe Pages::DeleteService do
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
before do
expect(PagesRemoveWorker).to receive(:perform_async).and_call_original
......
......@@ -64,16 +64,6 @@ RSpec.describe Projects::AfterRenameService do
allow(project_storage).to receive(:rename_repo) { true }
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
it 'schedules a move of the pages directory' do
allow(project).to receive(:pages_deployed?).and_return(true)
......@@ -183,16 +173,6 @@ RSpec.describe Projects::AfterRenameService do
end
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
it 'schedules a move of the pages directory' do
allow(project).to receive(:pages_deployed?).and_return(true)
......
......@@ -510,20 +510,6 @@ RSpec.describe Projects::TransferService do
execute_transfer
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
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