Fix logic used to determine project export status
Currently, lock files are used to determine the state of a project export. However, the lock files are not stored in a shared volume, causing the export states to be reported incorrectly. In order to fix this, we now store the export states in database as a more reliable mechanism. The table used is project_export_jobs. It stores the project_id, job_id and the current state. In addition to existing states, also added are two new states queued and regeneration_in_progress states. They are used to indicate a job that's waiting to be started and the case when a project export operation has been requested to be re-generated. Failed jobs are re-tried 3 times, after which the state is updated to failed. To account for jobs that get stuck, a cron job runs every hour to set the stuck jobs to failed state. Closes https://gitlab.com/gitlab-org/gitlab/issues/32203
显示
- app/finders/projects/export_job_finder.rb 29 个添加, 0 个删除app/finders/projects/export_job_finder.rb
- app/models/project.rb 17 个添加, 6 个删除app/models/project.rb
- app/models/project_export_job.rb 26 个添加, 0 个删除app/models/project_export_job.rb
- app/workers/all_queues.yml 7 个添加, 0 个删除app/workers/all_queues.yml
- app/workers/concerns/project_export_options.rb 25 个添加, 0 个删除app/workers/concerns/project_export_options.rb
- app/workers/project_export_worker.rb 8 个添加, 1 个删除app/workers/project_export_worker.rb
- app/workers/stuck_export_jobs_worker.rb 54 个添加, 0 个删除app/workers/stuck_export_jobs_worker.rb
- changelogs/unreleased/fix-export-state-logic.yml 5 个添加, 0 个删除changelogs/unreleased/fix-export-state-logic.yml
- config/initializers/1_settings.rb 3 个添加, 0 个删除config/initializers/1_settings.rb
- db/migrate/20200311165635_create_project_export_jobs.rb 19 个添加, 0 个删除db/migrate/20200311165635_create_project_export_jobs.rb
- db/schema.rb 14 个添加, 1 个删除db/schema.rb
- doc/api/project_import_export.md 11 个添加, 5 个删除doc/api/project_import_export.md
- ee/spec/lib/ee/gitlab/import_export/after_export_strategies/custom_template_export_import_strategy_spec.rb 15 个添加, 11 个删除...strategies/custom_template_export_import_strategy_spec.rb
- spec/controllers/projects_controller_spec.rb 3 个添加, 3 个删除spec/controllers/projects_controller_spec.rb
- spec/factories/project_export_jobs.rb 8 个添加, 0 个删除spec/factories/project_export_jobs.rb
- spec/finders/projects/export_job_finder_spec.rb 51 个添加, 0 个删除spec/finders/projects/export_job_finder_spec.rb
- spec/fixtures/api/schemas/public_api/v4/project/export_status.json 2 个添加, 1 个删除...ures/api/schemas/public_api/v4/project/export_status.json
- spec/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy_spec.rb 6 个添加, 0 个删除...fter_export_strategies/base_after_export_strategy_spec.rb
- spec/lib/gitlab/import_export/after_export_strategies/web_upload_strategy_spec.rb 6 个添加, 0 个删除...xport/after_export_strategies/web_upload_strategy_spec.rb
- spec/lib/gitlab/import_export/all_models.yml 1 个添加, 0 个删除spec/lib/gitlab/import_export/all_models.yml
加载中
想要评论请 注册 或 登录