-
Bug
-
Resolution: Fixed
-
Medium
-
None
-
None
-
14
-
Minor
Issue Summary
While migrating Jira Service Management project, some SLAs (time metric) fail to export because of dependence on invalid issue statuses.
Steps to Reproduce
- Go to Jira Administration -> Issues -> Statuses. Create a new Issue Status, say "Dismissed".
- Select any workflow that is used in the project. Edit it such that it now includes the newly created status "Dismissed"
- Go to Project Settings -> SLAs. Create a new SLA such that one of the Start/Stop/Pause conditions have the "Dismissed" status selected. Save the SLA.
- Edit the workflow (the one modified in step 2) such that it does not contain the "Dismissed" status anymore.
- Go to Jira Administration -> Issues -> Statuses. Delete the status "Dismissed"
- Migrate the project.
Expected Results
The project should be migrated successfully. The migrated SLA does not refer to the deleted status.
Actual Results
The below exception is thrown in the export error logs file:
2021-10-27 12:43:58.592 ERROR PROJ project-export We couldn't export Time Metric 12. Reason: java.lang.IllegalStateException: Entity mri:mig:jira/classic:issueStatus:10017 is expected to be exported, but it was not.
Verify the issue
The following SQL query (written for PostgreSQL) should ideally return an empty response. If the query returns one or more IDs, each ID represents a reference to an invalid status.
SELECT "CONDITION_ID" FROM "AO_54307E_METRICCONDITION" WHERE "FACTORY_KEY" = 'status-sla-condition-factory' AND "CONDITION_ID" NOT IN (SELECT ID FROM issuestatus);
(The query returns the IDs of those statuses that are referred to in SLAs but are not found in the status table (do not exist - likely because they were deleted)).
Workaround
NOTE: It is recommended to create a backup your server before executing the workarounds.
Workaround 1 (Using UI - recommended)
- Open project settings for the particular project.
- Go to SLAs.
- Select each SLA one-by-one. If the SLA contains invalid status reference, an error message should be displayed similar to attached image 1.png
- Edit the SLA. Remove the problematic statuses from the conditions and save the SLA. (2.png)
- Once all SLAs are fixed, click the update link below the SLA menu (shown in image 3.png).
- Attempt to migrate the project again.
Workaround 2 (Using DB)
- Remove the references to invalid statuses using the following query. Note: This query will also remove similar invalid status references in SLAs across all project.
DELETE FROM "AO_54307E_METRICCONDITION" WHERE "FACTORY_KEY" = 'status-sla-condition-factory' AND "CONDITION_ID" NOT IN (SELECT ID FROM issuestatus)
2. Attempt to migrate the project again.