Child pages
  • All Epic Link data appears to be lost
Skip to end of metadata
Go to start of metadata

Symptoms

  • All Epic associations or links appear to be lost. Issues or Stories are no longer associated with their Epics correctly both in the JIRA view and on the Agile boards. This problem may have appeared after an upgrade to JIRA or JIRA Agile.

  • Manually, trying to re-add the Epic link between a Story and it's Epic may appear to work without any error messages thrown.

Diagnosis

Run the following SQL queries against JIRA's database. If atleast one of the following SQL queries returns multiple rows then this article is applicable.

SELECT * FROM `issuelinktype` WHERE linkname = "Epic-Story Link";

SELECT * FROM propertynumber where ID IN (select id from propertyentry where PROPERTY_KEY = 'GreenHopper.Epic.Default.linktype.id');

The following is an example of the kind of results that may be returned if the problem exists:

mysql> SELECT * FROM `issuelinktype` WHERE linkname = "Epic-Story Link";
+-------+-----------------+----------+------------+--------------------+
| ID | LINKNAME | INWARD | OUTWARD | pstyle |
+-------+-----------------+----------+------------+--------------------+
| 10030 | Epic-Story Link | has Epic | is Epic of | jira_gh_epic_story |
| 10031 | Epic-Story Link | has Epic | is Epic of | jira_gh_epic_story |
| 10032 | Epic-Story Link | has Epic | is Epic of | jira_gh_epic_story |
| 10033 | Epic-Story Link | has Epic | is Epic of | jira_gh_epic_story |
| 10034 | Epic-Story Link | has Epic | is Epic of | jira_gh_epic_story |
| 10035 | Epic-Story Link | has Epic | is Epic of | jira_gh_epic_story |
| 10036 | Epic-Story Link | has Epic | is Epic of | jira_gh_epic_story |
| 10037 | Epic-Story Link | has Epic | is Epic of | jira_gh_epic_story |
| 10038 | Epic-Story Link | has Epic | is Epic of | jira_gh_epic_story |
| 10039 | Epic-Story Link | has Epic | is Epic of | jira_gh_epic_story |
+-------+-----------------+----------+------------+--------------------+
10 rows in set (0.00 sec)

mysql> SELECT * FROM propertynumber where ID IN (select id from propertyentry where PROPERTY_KEY = 'GreenHopper.Epic.Default.linktype.id');
+-------+---------------+
| ID | propertyvalue |
+-------+---------------+
| 47972 | 10030 |
| 47973 | 10031 |
| 47974 | 10031 |
+-------+---------------+
3 rows in set (0.01 sec)

(info) If only a single row is returned for both of the queries then this article is not applicable to you.

Cause

This is a database integrity issue. The problem is that there are duplicate entries for the Epic Link type in the database. The issue is related to this bug  GHS-10243 - Getting issue details... STATUS .

Resolution

The broken data would need to be fixed from the database by running the following SQL statements against your JIRA database.

  1. Setup a test JIRA instance, which is a replica of the current production instance. Only proceed to perform the queries on your actual production database after you have confirmed that they resolve the problem on the test JIRA instance.
  2. Shutdown JIRA
  3. Backup your JIRA database
  4. Run the following SQL queries against your JIRA database:
    • The following will change all existing Epic links to use the first Epic-Story link ID on the issuelinktype table, before we proceed to delete the duplicates of the EPIC link type

      update issuelink set linktype = xxxxx where linktype in (SELECT ID FROM `issuelinktype` WHERE linkname = "Epic-Story Link";)

      (warning) Remember to replace xxxxx in this query with the first issuelinktype id returned in the first sql query from the Diagnosis section above. In our sample data above the first issuelinktype id is 10030 for instance.

       

    • The following will remove all the duplicates of the Epic Link type

      delete from `issuelinktype` WHERE linkname = "Epic-Story Link" AND ID != xxxxx;

      (warning) Remember to replace xxxxx in this query with the first issuelinktype id returned in the first sql query from the Diagnosis section above. In our sample data above the first issuelinktype id is 10030 for instance

    • Execute the following to remove duplicates from JIRA Agile property tables:

      delete FROM propertynumber where ID IN (select id from propertyentry where PROPERTY_KEY = 'GreenHopper.Epic.Default.linktype.id') AND ID != yyyyy;
      delete from propertyentry where PROPERTY_KEY = 'GreenHopper.Epic.Default.linktype.id' AND ID != yyyyy;

      (warning) Remember to replace yyyyy with the first id corresponding to our chosen issuelinktype id from the Diagnosis section above. In our sample data above the id corresponding to our issuelinktype id of 10030 is 47972. So we replace yyyyy with 47972 for instance.

5. Restart JIRA

(info) All the queries are tested on MySQL, you may need to adjust the syntax for your specific database if you run into any errors (your local DBA can help fix that easily) 

(info) Contact Atlassian Support (https://support.atlassian.com) if you encounter any specific problem about implementing this resolution.

Help us improve!
  • No labels

1 Comment

  1. When choosing the "first" Epic-Story link ID, should that correlate with the/a found property? What if there is no matching propertyvalue? I guess you should not use the first id, but any id that has a matching property.

    Regarding portable SQL:

    • Tablenames don't need to be quoted, if they don't use upper case letters or special characters. But when quoting, don't use backticks but double quotes.
    • String constants are quoted with single quotes.