Uploaded image for project: 'Migration Platform'
  1. Migration Platform
  2. MIG-894

Jira Service Management Time Metric Export Failure - "We couldn't export Time Metric"

    XMLWordPrintable

Details

    • 14
    • Minor

    Description

      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

      1. Go to Jira Administration -> Issues -> Statuses. Create a new Issue Status, say "Dismissed".
      2. Select any workflow that is used in the project. Edit it such that it now includes the newly created status "Dismissed"
      3. 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. 
      4. Edit the workflow (the one modified in step 2) such that it does not contain the "Dismissed" status anymore. 
      5. Go to Jira Administration -> Issues -> Statuses. Delete the status "Dismissed"
      6. 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)

      1. Open project settings for the particular project.
      2. Go to SLAs. 
      3. 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
      4. Edit the SLA. Remove the problematic statuses from the conditions and save the SLA. (2.png)
      5. Once all SLAs are fixed, click the update link below the SLA menu (shown in image 3.png).
      6. Attempt to migrate the project again.

      Workaround 2 (Using DB) 

      1. 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. 

      Attachments

        1. 3.png
          3.png
          919 kB
        2. 2.png
          2.png
          606 kB
        3. 1.png
          1.png
          533 kB

        Issue Links

          Activity

            People

              3e3e93f77c1d Basu Dubey (Inactive)
              3e3e93f77c1d Basu Dubey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: