LexoRank Integrity Check fails with rank out of bounds error in Jira server
Symptoms
The following appears in the atlassian-greenhopper.log
:
2014-09-03 15:57:07,788 http-bio-8080-exec-27 ERROR xxxx 956x1187782x2 sqr32v 10.4.247.101,10.30.15.31 /secure/QuickCreateIssue.jspa [greenhopper.service.lexorank.LexoRankIssueEventListener] Expected the first rank row to be of type MAXIMUM_MARKER_ROW. Found row[LexoRankRow{id=957804, fieldId=15200, issueId=696563, lockHash='null', lockTime=null, rank='2|zzzzzz:i', type=ISSUE_RANK_ROW}]
com.atlassian.greenhopper.manager.lexorank.LexoRankIntegrityException: Expected the first rank row to be of type MAXIMUM_MARKER_ROW. Found row[LexoRankRow{id=957804, fieldId=15200, issueId=696563, lockHash='null', lockTime=null, rank='2|zzzzzz:i', type=ISSUE_RANK_ROW}]
at com.atlassian.greenhopper.manager.lexorank.LexoRankDaoImpl.getMaximumMarkerRowAndPreviousRow(LexoRankDaoImpl.java:418)
at com.atlassian.greenhopper.service.lexorank.LexoRankOperation.rankInitially(LexoRankOperation.java:169)
at com.atlassian.greenhopper.service.lexorank.LexoRankOperation.execute(LexoRankOperation.java:111)
at com.atlassian.greenhopper.service.lexorank.LexoRankService.performRankOperation(LexoRankService.java:239)
at com.atlassian.greenhopper.service.lexorank.LexoRankService.getRankOrRankInitially(LexoRankService.java:130)
at com.atlassian.greenhopper.service.lexorank.LexoRankIssueEventListener.doOnIssueEvent(LexoRankIssueEventListener.java:42)
at com.atlassian.greenhopper.service.issue.AbstractIssueEventListener.onIssueEvent(AbstractIssueEventListener.java:38) <+2>
at java.lang.reflect.Method.invoke(Unknown Source)
Diagnosis
<JIRA_BASE_URL>/rest/greenhopper/1.0/lexorank/integrity
- for example https://jira.atlassian.com/rest/greenhopper/1.0/lexorank/integrity. You must be an admin to run this.It may help to copy/paste the results into something like jsonprettyprint.com as it will make it easier to read.
If the rank integrity checker doesn't pass on Rank out of bounds check, this KB will apply.
....
{
"name": "Rank out of bounds check",
"description": "Checks if there is a rank value for the rank field that is out of bounds.",
"passed": false,
"failureReason": "Found the following rank value(s) for rank field[id=15200] that are out of bounds: 0|1000003:",
"fatal":true
},
....
Cause
There is a rank value that exceeds the available ranking boundary. The ranking boundary is defined by the minimum and maximum marker row. For example, if the minimum and maximum marker rows are in bucket 1, and there is an issue in bucket 2 this error will be presented.
Resolution
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Delete the out of bounds error returned by the integrity checker. In the case above, we can use the below SQL to do so. This will mean the ranking is lost for that issue only.
DELETE FROM AO_60DB71_LEXORANK WHERE FIELD_ID=15200 AND RANK='0|1000003:';
Ensure to change the FIELD_ID and RANK values as per the integrity checker.