Skip to content

Process stuck jira import jobs

Alexandru Croitor requested to merge refactor-stuck-imports-jobs-worker into master

What does this MR do?

Handle stuck Jira import jobs and set them to failed with respective timeout error message.

It also makes a lightweight refactoring of StuckImportJobsWorker, by extracting common code for both project import and jira import workers.

Adding the worker should help fix the issues with stuck jobs reported in #217395 (closed)

Database

DB table to which the new column is being added is tiny at the moment even on gitlab.com

Seq Scan on jira_imports  (cost=0.00..22.98 rows=298 width=8) (actual time=1.067..2.180 rows=236 loops=1)
  Buffers: shared read=5
  I/O Timings: read=1.874
Planning Time: 0.708 ms
Execution Time: 2.242 ms
UP
$ Rake db:migrate:up VERSION=20200519101002
== 20200519101002 AddErrorMessageColumnToJiraImports: migrating ===============
-- add_column(:jira_imports, :error_message, :text)
   -> 0.0027s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE jira_imports\nADD CONSTRAINT check_9ed451c5b1\nCHECK ( char_length(error_message) <= 1000 )\nNOT VALID;\n")
   -> 0.0025s
-- execute("ALTER TABLE jira_imports VALIDATE CONSTRAINT check_9ed451c5b1;")
   -> 0.0005s
== 20200519101002 AddErrorMessageColumnToJiraImports: migrated (0.0159s) ======
DOWN
$ Rake db:migrate:down VERSION=20200519101002
== 20200519101002 AddErrorMessageColumnToJiraImports: reverting ===============
-- remove_column(:jira_imports, :error_message)
   -> 0.0035s
== 20200519101002 AddErrorMessageColumnToJiraImports: reverted (0.0036s) ======

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Alexandru Croitor

Merge request reports