Commit 607ec3ea authored by Sean McGivern's avatar Sean McGivern

Put Pages moves from namespace renames in Sidekiq

When we rename a namespace, any projects in that namespace with Pages
enabled have to have their directories moved on the filesystem to match.
We want all operations that touch Pages disk paths to happen in Sidekiq,
not Puma; this puts that in Sidekiq behind the
`async_pages_move_namespace_rename` feature flag.
parent 0fb3f3a8
......@@ -26,7 +26,16 @@ module Storage
Gitlab::PagesTransfer.new.move_namespace(path, former_parent_full_path, parent_full_path)
else
Gitlab::UploadsTransfer.new.rename_namespace(full_path_before_last_save, full_path)
Gitlab::PagesTransfer.new.rename_namespace(full_path_before_last_save, full_path)
if ::Feature.enabled?(:async_pages_move_namespace_rename, self)
full_path_was = full_path_before_last_save
run_after_commit do
Gitlab::PagesTransfer.new.async.rename_namespace(full_path_was, full_path)
end
else
Gitlab::PagesTransfer.new.rename_namespace(full_path_before_last_save, full_path)
end
end
# If repositories moved successfully we need to
......
---
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
......@@ -407,8 +407,24 @@ RSpec.describe Namespace do
FileUtils.mkdir_p(File.join(pages_dir, project.full_path))
end
after do
FileUtils.remove_entry(File.join(TestEnv.repos_path, parent.full_path), true)
FileUtils.remove_entry(File.join(uploads_dir, project.full_path), true)
FileUtils.remove_entry(File.join(pages_dir, project.full_path), true)
end
context 'renaming child' do
it 'correctly moves the repository, uploads and pages' 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
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do
child.update!(path: 'renamed')
expect_project_directories_at('parent/renamed')
......@@ -416,7 +432,17 @@ RSpec.describe Namespace do
end
context 'renaming parent' do
it 'correctly moves the repository, uploads and pages' 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')
expect_project_directories_at('renamed/child')
end
end
it 'correctly moves the repository, uploads and pages', :sidekiq_inline do
parent.update!(path: 'renamed')
expect_project_directories_at('renamed/child')
......
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