How To Fix Duplicate Rank Values For a Rank Field

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

One or more of the below symptoms may apply to JIRA Software (also called JIRA Agile):

  • Ranking operations are not possible.
  • The balance job is never completed.

Diagnosis

If using JIRA Software (JIRA Agile) 6.7.0 or higher, use the  LexoRank Management tool to run an integrity check. Otherwise, access  <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.

(info) 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 Duplicate Ranks Check, this KB will apply.

        ....
		{
          "name": "Duplicate ranks check",
          "description": "Checks if there are any duplicate rank values for a rank field.",
          "passed": false,
          "failureReason": "Detected duplicate ranks for rank field 15201 : {0|11t9b4:=2, 0|11sqnc:=2, 0|11suow:=2, 0|11tm0w:=2, 0|11thk8:=2, 0|11spog:=2, 0|11tes0:=2, 0|11sx00:=2, 0|11t2qg:=2, 0|11sqx4:=2, 0|11tde8:=2, 0|11t9zc:=2, 0|11sxcw:=2, 0|11ssi0:=2, 0|11teqo:=2, 0|11tlm0:=2, 0|11t140:=2, 0|11tbp4:=2, 0|11tg5s:=2, 0|11srhs:=2, 0|11t03s:=2, 0|11t4bc:=2, 0|11taow:=2, 0|11td48:=2}",
          "fatal": false
        },
		....

Resolution

  • There is a REST endpoint that can be accessed, which will automatically heal the duplicate records.
  • This must be run as a System Administrator, which is defined in one of the groups as per Managing Global Permissions.
  • The endpoint requires a PUT, which is not something a browser can do without an additional plugin.
  • A PUT can also be done by executing it on the command line using cURL.

Option 1 - Browser Plugin

  1. Install Postman - REST client.
  2. Load it up and put in the URL <JIRA_BASE_URL>/rest/greenhopper/1.0/lexorank/duplicates, for example https://jira.atlassian.com/rest/greenhopper/1.0/lexorank/duplicates.
  3. Ensure the Content Type is set to JSON, otherwise errors will occur. The screenshot below illustrates the configuration.
  4. Submit the command and then run the Integrity Check again.

Option 2 - Command Line

(warning) This requires cURL to be installed. The installation is platform-specific, and can be downloaded from http://curl.haxx.se/download.html.

Run the below, replacing admin:password with the appropriate administrative user and their password, and populating <JIRA_BASE_URL> appropriately.

curl -X PUT <JIRA_BASE_URL>/rest/greenhopper/1.0/lexorank/duplicates -u admin:password


Manual Process

(warning) Only perform the manual process if an error is returned from the REST client

If REST client returns an error follow these steps to remove the duplicate manually.

For every result on the "failureReason" of the Diagnosis section, run:

DELETE from "AO_60DB71_LEXORANK" where "FIELD_ID" = <rank field> and "RANK" like '%<value after | and before :>%' and "TYPE" <> 2;
see example
DELETE from "AO_60DB71_LEXORANK" where "FIELD_ID" = 15201 and "RANK" like '%11t9b4%' and "TYPE" <> 2;
DELETE from "AO_60DB71_LEXORANK" where "FIELD_ID" = 15201 and "RANK" like '%11sqnc%' and "TYPE" <> 2;
...

Last modified on Jul 12, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.