Add exclusive lock for UpdateRepositoryStorageWorker
Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/429049 **Problem** 1. It's possible to run multiple migration workers for the same project/snippet/group simultaneously 2. The worker can be killed and rescheduled by Sidekiq interrupt signal. It will leave the migration in inconsistent state. **Solution** Use an exclusive lock in storage migration workers. The exclusive lease key includes a project/snippet/group id to prevent simultaneous updates. The key value is a Sidekiq worker jid to track the owner of the update. This setup should handle following situations: 1. Worker tries to migrate a repository under existing migration (result: job is marked as failed) 2. Worker started a migration but was interrupted and rescheduled. (result: job is marked as failed, lock is released) Changelog: fixed
显示
- app/workers/concerns/update_repository_storage_worker.rb 33 个添加, 1 个删除app/workers/concerns/update_repository_storage_worker.rb
- config/feature_flags/development/use_lock_for_update_repository_storage.yml 8 个添加, 0 个删除...gs/development/use_lock_for_update_repository_storage.yml
- spec/support/shared_examples/workers/update_repository_move_shared_examples.rb 73 个添加, 4 个删除...xamples/workers/update_repository_move_shared_examples.rb
- spec/workers/projects/update_repository_storage_worker_spec.rb 1 个添加, 1 个删除...workers/projects/update_repository_storage_worker_spec.rb
想要评论请 注册 或 登录