From 11fff9b33e7977cc54f57a0da5c098c594fb09ef Mon Sep 17 00:00:00 2001 From: Joe Woodward <j@joewoodward.me> Date: Fri, 5 Jul 2024 13:54:56 +0100 Subject: [PATCH] Do not finish_replication until the new storage is tracked When we move the repository storage we were calling `repository_storage_move.finish_replication!` before we called `track_repository(destination_storage_name)`. `track_repository` is telling the group, project, or snippet to use the new storage location. When we call `repository_storage_move.finish_replication!` we are setting the repository to writable again in the state machine event with `storage_move.container.set_repository_writable!`. This means users can begin pushing again, however, if they push before the new storage is tracked they will push commits to the old storage and that would then be untracked once the new storage is tracked causing a loss of information. The risks of this happening are fairly low as moving storage is a manual task which shouldn't be triggered often and the gap between making the repo writable and tracking the correct storage should be very small. --- app/services/concerns/update_repository_storage_methods.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/concerns/update_repository_storage_methods.rb b/app/services/concerns/update_repository_storage_methods.rb index 952e80c7df7b..f1b614bfa32f 100644 --- a/app/services/concerns/update_repository_storage_methods.rb +++ b/app/services/concerns/update_repository_storage_methods.rb @@ -33,12 +33,12 @@ def execute mirror_repositories end - repository_storage_move.finish_replication! - repository_storage_move.transaction do track_repository(destination_storage_name) end + repository_storage_move.finish_replication! + remove_old_paths unless same_filesystem? repository_storage_move.finish_cleanup! -- GitLab