Fix Missing Tail End of JIRA Agile Global Rank in Jira Data Center
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Jira Scrum/Kanban boards cannot be accessed.
Jira ranking fails.
Environment
Jira Software Data Center on any version from 7.0.0.
Diagnosis
The following exceptions are seen in the log files from the class com.atlassian.greenhopper.service.rank.RankIndexBuilder
in the atlassian-jira.log
:
2014-03-26 13:59:56,859 http-bio-1332-exec-12 ERROR jira4admin 839x1220x2 1uuvec6 172.22.1.102 /rest/greenhopper/1.0/xboard/work/allData.json [common.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service
com.atlassian.greenhopper.service.rank.RankException: The tail end of the GreenHopper Global Rank is missing. Please update the rank table and ensure that there is exactly one issue that has no child and exactly one that has no parent.
at com.atlassian.greenhopper.service.rank.RankIndexBuilder.validate(RankIndexBuilder.java:151)
at com.atlassian.greenhopper.service.rank.RankIndexBuilder.build(RankIndexBuilder.java:85)
at com.atlassian.greenhopper.service.rank.RankIndexServiceImpl$RankIndexSupplier.get(RankIndexServiceImpl.java:417)
at com.atlassian.greenhopper.service.rank.RankIndexServiceImpl$RankIndexSupplier.get(RankIndexServiceImpl.java:388)
at com.google.common.base.Suppliers$MemoizingSupplier.get(Suppliers.java:109)
at com.atlassian.greenhopper.service.rank.RankIndexServiceImpl.getIndex(RankIndexServiceImpl.java:385)
at com.atlassian.greenhopper.service.rank.RankIndexServiceImpl.fetchCreate(RankIndexServiceImpl.java:348)
at com.atlassian.greenhopper.service.rank.RankIndexServiceImpl.compare(RankIndexServiceImpl.java:61)
at com.atlassian.greenhopper.customfield.rank.RankLuceneFieldSorter$RankComparator.compare(RankLuceneFieldSorter.java:118)
at com.atlassian.greenhopper.customfield.rank.RankLuceneFieldSorter$RankComparator.compare(RankLuceneFieldSorter.java:101)
at com.atlassian.jira.issue.search.parameters.lucene.sort.MappedSortComparator$InternalFieldComparator.compare(MappedSortComparator.java:85)
at org.apache.lucene.search.FieldValueHitQueue$OneComparatorFieldValueHitQueue.lessThan(FieldValueHitQueue.java:85)
at org.apache.lucene.search.FieldValueHitQueue$OneComparatorFieldValueHitQueue.lessThan(FieldValueHitQueue.java:54)
at org.apache.lucene.util.PriorityQueue.upHeap(PriorityQueue.java:223)
at org.apache.lucene.util.PriorityQueue.add(PriorityQueue.java:132)
Cause
Something has corrupted the data in the ranking table. There has to be one record in the table where NEXT_ID is null. This is the tail end of the chain, the last ranked issue, so there's none after it. There is a sanity check in the JIRA code that verifies this is the case - if it is not the above exception is thrown.
Solution
Backup JIRA data to an XML format as per the guideline.
Stop JIRA.
Identify the last record in the ranking chain with the below SQL:
SELECT * FROM "AO_60DB71_ISSUERANKING" ORDER BY "ISSUE_ID" DESC;
This will return the final issue in the ranking chain. The "NEXT_ID" for that record should be null - if it isn't the above exception is thrown. This is what it should like (if it's broken):
CUSTOM_FIELD_ID | ID | ISSUE_ID | NEXT_ID -----------------+--------+----------+--------- 13672 | 100652 | 222184 | 222185 13672 | 100651 | 222183 | 222184 13672 | 100650 | 222182 | 222183 13672 | 100649 | 222181 | 222182 13672 | 100648 | 222180 | 222181
We can see this is broken as the "NEXT_ID" for "ISSUE_ID" 222184 (the last in the chain) is not null. This is bad.
Fix the chain with the below SQL, editing it for the appropriate "CUSTOM_FIELD_ID" and "ID" as based on the results returned above.
UPDATE "AO_60DB71_ISSUERANKING" SET "NEXT_ID" = null WHERE "CUSTOM_FIELD_ID" = <CUSTOM_FIELD_ID> AND "ID" = <BROKEN_NEXT_ID>;
Start JIRA.
Attempt to rank issues and access the JIRA Agile boards.
The above steps were verified with a PostgreSQL database - other databases may need different syntax - please consult with your resident DBA/Sys Admin guru or raise a support issue with us if you need more guidance.
If this does not resolve the case, contact https://support.atlassian.com and provide a XML backup as per Sending JIRA Data to Support. Please ensure the provided backup is from before when the above fixes were attempted.
Was this helpful?